Index: sys/sys/_callout.h =================================================================== --- sys/sys/_callout.h +++ sys/sys/_callout.h @@ -40,6 +40,7 @@ #include +struct callout; struct lock_object; LIST_HEAD(callout_list, callout); Index: sys/sys/proc.h =================================================================== --- sys/sys/proc.h +++ sys/sys/proc.h @@ -164,6 +164,7 @@ struct kaudit_record; struct kdtrace_proc; struct kdtrace_thread; +struct ktr_request; struct mqueue_notifier; struct nlminfo; struct p_sched; Index: sys/sys/queue.h =================================================================== --- sys/sys/queue.h +++ sys/sys/queue.h @@ -143,12 +143,21 @@ #define TRASHIT(x) #endif /* QUEUE_MACRO_DEBUG */ +#ifdef __cplusplus +/* + * In C++ there can be structure lists and class lists: + */ +#define QUEUE_TYPEOF(type) type +#else +#define QUEUE_TYPEOF(type) struct type +#endif + /* * Singly-linked List declarations. */ #define SLIST_HEAD(name, type) \ struct name { \ - struct type *slh_first; /* first element */ \ + QUEUE_TYPEOF(type) *slh_first; /* first element */ \ } #define SLIST_HEAD_INITIALIZER(head) \ @@ -156,7 +165,7 @@ #define SLIST_ENTRY(type) \ struct { \ - struct type *sle_next; /* next element */ \ + QUEUE_TYPEOF(type) *sle_next; /* next element */ \ } /* @@ -213,7 +222,7 @@ SLIST_REMOVE_HEAD((head), field); \ } \ else { \ - struct type *curelm = SLIST_FIRST((head)); \ + QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head); \ while (SLIST_NEXT(curelm, field) != (elm)) \ curelm = SLIST_NEXT(curelm, field); \ SLIST_REMOVE_AFTER(curelm, field); \ @@ -231,7 +240,7 @@ } while (0) #define SLIST_SWAP(head1, head2, type) do { \ - struct type *swap_first = SLIST_FIRST(head1); \ + QUEUE_TYPEOF(type) *swap_first = SLIST_FIRST(head1); \ SLIST_FIRST(head1) = SLIST_FIRST(head2); \ SLIST_FIRST(head2) = swap_first; \ } while (0) @@ -241,8 +250,8 @@ */ #define STAILQ_HEAD(name, type) \ struct name { \ - struct type *stqh_first;/* first element */ \ - struct type **stqh_last;/* addr of last next element */ \ + QUEUE_TYPEOF(type) *stqh_first;/* first element */ \ + QUEUE_TYPEOF(type) **stqh_last;/* addr of last next element */ \ } #define STAILQ_HEAD_INITIALIZER(head) \ @@ -250,7 +259,7 @@ #define STAILQ_ENTRY(type) \ struct { \ - struct type *stqe_next; /* next element */ \ + QUEUE_TYPEOF(type) *stqe_next; /* next element */ \ } /* @@ -311,9 +320,10 @@ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ } while (0) -#define STAILQ_LAST(head, type, field) \ - (STAILQ_EMPTY((head)) ? NULL : \ - __containerof((head)->stqh_last, struct type, field.stqe_next)) +#define STAILQ_LAST(head, type, field) \ + (STAILQ_EMPTY((head)) ? NULL : \ + __containerof((head)->stqh_last, \ + QUEUE_TYPEOF(type), field.stqe_next)) #define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) @@ -323,7 +333,7 @@ STAILQ_REMOVE_HEAD((head), field); \ } \ else { \ - struct type *curelm = STAILQ_FIRST((head)); \ + QUEUE_TYPEOF(type) *curelm = STAILQ_FIRST(head); \ while (STAILQ_NEXT(curelm, field) != (elm)) \ curelm = STAILQ_NEXT(curelm, field); \ STAILQ_REMOVE_AFTER(head, curelm, field); \ @@ -344,8 +354,8 @@ } while (0) #define STAILQ_SWAP(head1, head2, type) do { \ - struct type *swap_first = STAILQ_FIRST(head1); \ - struct type **swap_last = (head1)->stqh_last; \ + QUEUE_TYPEOF(type) *swap_first = STAILQ_FIRST(head1); \ + QUEUE_TYPEOF(type) **swap_last = (head1)->stqh_last; \ STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \ (head1)->stqh_last = (head2)->stqh_last; \ STAILQ_FIRST(head2) = swap_first; \ @@ -362,7 +372,7 @@ */ #define LIST_HEAD(name, type) \ struct name { \ - struct type *lh_first; /* first element */ \ + QUEUE_TYPEOF(type) *lh_first; /* first element */ \ } #define LIST_HEAD_INITIALIZER(head) \ @@ -370,8 +380,8 @@ #define LIST_ENTRY(type) \ struct { \ - struct type *le_next; /* next element */ \ - struct type **le_prev; /* address of previous next element */ \ + QUEUE_TYPEOF(type) *le_next; /* next element */ \ + QUEUE_TYPEOF(type) **le_prev; /* address of previous next element */ \ } /* @@ -458,9 +468,10 @@ #define LIST_NEXT(elm, field) ((elm)->field.le_next) -#define LIST_PREV(elm, head, type, field) \ - ((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \ - __containerof((elm)->field.le_prev, struct type, field.le_next)) +#define LIST_PREV(elm, head, type, field) \ + ((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \ + __containerof((elm)->field.le_prev, \ + QUEUE_TYPEOF(type), field.le_next)) #define LIST_REMOVE(elm, field) do { \ QMD_SAVELINK(oldnext, (elm)->field.le_next); \ @@ -476,7 +487,7 @@ } while (0) #define LIST_SWAP(head1, head2, type, field) do { \ - struct type *swap_tmp = LIST_FIRST((head1)); \ + QUEUE_TYPEOF(type) *swap_tmp = LIST_FIRST(head1); \ LIST_FIRST((head1)) = LIST_FIRST((head2)); \ LIST_FIRST((head2)) = swap_tmp; \ if ((swap_tmp = LIST_FIRST((head1))) != NULL) \ @@ -490,8 +501,8 @@ */ #define TAILQ_HEAD(name, type) \ struct name { \ - struct type *tqh_first; /* first element */ \ - struct type **tqh_last; /* addr of last next element */ \ + QUEUE_TYPEOF(type) *tqh_first; /* first element */ \ + QUEUE_TYPEOF(type) **tqh_last; /* addr of last next element */ \ TRACEBUF \ } @@ -500,8 +511,8 @@ #define TAILQ_ENTRY(type) \ struct { \ - struct type *tqe_next; /* next element */ \ - struct type **tqe_prev; /* address of previous next element */ \ + QUEUE_TYPEOF(type) *tqe_next; /* next element */ \ + QUEUE_TYPEOF(type) **tqe_prev; /* address of previous next element */ \ TRACEBUF \ } @@ -675,8 +686,8 @@ } while (0) #define TAILQ_SWAP(head1, head2, type, field) do { \ - struct type *swap_first = (head1)->tqh_first; \ - struct type **swap_last = (head1)->tqh_last; \ + QUEUE_TYPEOF(type) *swap_first = (head1)->tqh_first; \ + QUEUE_TYPEOF(type) **swap_last = (head1)->tqh_last; \ (head1)->tqh_first = (head2)->tqh_first; \ (head1)->tqh_last = (head2)->tqh_last; \ (head2)->tqh_first = swap_first; \ Index: sys/sys/socketvar.h =================================================================== --- sys/sys/socketvar.h +++ sys/sys/socketvar.h @@ -58,6 +58,7 @@ typedef u_quad_t so_gen_t; struct socket; +struct aiocblist; /*- * Locking key to struct socket: