about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--linux/util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/linux/util.h b/linux/util.h
index 2f329bb..cce1453 100644
--- a/linux/util.h
+++ b/linux/util.h
@@ -39,6 +39,14 @@ int	fmt_scaled(long long number, char *result);
 #define	TAILQ_END(head)			NULL
 #endif
 
+#ifndef TAILQ_FOREACH_SAFE
+#define TAILQ_FOREACH_SAFE(var, head, field, tvar)                      \
+	for ((var) = TAILQ_FIRST(head);                                 \
+	    (var) != TAILQ_END(head) &&                                 \
+	    ((tvar) = TAILQ_NEXT(var, field), 1);                       \
+	    (var) = (tvar))
+#endif
+
 /*
  * fmt_scaled(3) specific flags. (from OpenBSD util.h)
  */