shims: flesh out generic_sys_queue.h further
The 1121 merge introduced additional usage of sys/queue.h.  Flesh out
the shims header further to repair the build on Windows.
} \
} while(0)
+#define TAILQ_HEAD_INITIALIZER(head) \
+ { NULL, (head).tq_first }
+
+#define TAILQ_CONCAT(head1, head2, field) do { \
+ if (!TAILQ_EMPTY(head2)) { \
+ (head1)->tq_last = (head2)->tq_first; \
+ (head1)->tq_first->field.te_prev = (head1)->tq_last; \
+ (head1)->tq_last = (head2)->tq_last; \
+ TAILQ_INIT((head2)); \
+ } \
+ } while (0)
+
+#define LIST_HEAD(name, type) struct name { \
+ struct type *lh_first; \
+ }
+
+#define LIST_ENTRY(type) struct { \
+ struct type *le_next; \
+ struct type *le_prev; \
+ }
+
+#define LIST_FIRST(head) ((head)->lh_first)
+
+#define LIST_FOREACH(var, head, field) \
+ for ((var) = LIST_FIRST((head)); \
+ (var); \
+ (var) = LIST_NEXT((var), field))
+
+#define LIST_NEXT(elm, field) ((elm)->field.le_next)
+
+#define LIST_REMOVE(elm, field) do { \
+ if (LIST_NEXT((elm), field) != NULL) \
+ LIST_NEXT((elm), field)->field.le_prev = (elm)->field.le_prev; \
+ } while (0)
+
+#define LIST_INSERT_HEAD(head, elm, field) do { \
+ if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \
+ LIST_FIRST((head))->field.le_prev = LIST_NEXT((elm), field); \
+ LIST_FIRST((head)) = (elm); \
+ (elm)->field.le_prev = LIST_FIRST((head)); \
+ } while (0)
+
#endif // __DISPATCH_SHIMS_SYS_QUEUE__
