From: Landry Breuil Date: Mon, 27 Oct 2014 08:37:58 +0000 (+0100) Subject: inpt_queue is a TAILQ on OpenBSD X-Git-Tag: collectd-5.5.0~168^2~2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=d3306ba2402a98f70e885e79cebaaa4c824c39e5;p=collectd.git inpt_queue is a TAILQ on OpenBSD --- diff --git a/src/tcpconns.c b/src/tcpconns.c index bb089b0f..6f14bce6 100644 --- a/src/tcpconns.c +++ b/src/tcpconns.c @@ -951,7 +951,9 @@ static int conn_init (void) static int conn_read (void) { struct inpcbtable table; +#ifndef __OpenBSD__ struct inpcb *head; +#endif struct inpcb *next; struct inpcb inpcb; struct tcpcb tcpcb; @@ -964,18 +966,30 @@ static int conn_read (void) if (status != 0) return (-1); +#ifdef __OpenBSD__ + /* inpt_queue is a TAILQ on OpenBSD */ + /* Get the first pcb */ + next = (struct inpcb *)TAILQ_FIRST (&table.inpt_queue); + while (next) +#else /* Get the `head' pcb */ head = (struct inpcb *) &(inpcbtable_ptr->inpt_queue); /* Get the first pcb */ next = (struct inpcb *)CIRCLEQ_FIRST (&table.inpt_queue); while (next != head) +#endif { /* Read the pcb pointed to by `next' into `inpcb' */ kread ((u_long) next, &inpcb, sizeof (inpcb)); /* Advance `next' */ +#ifdef __OpenBSD__ + /* inpt_queue is a TAILQ on OpenBSD */ + next = (struct inpcb *)TAILQ_NEXT (&inpcb, inp_queue); +#else next = (struct inpcb *)CIRCLEQ_NEXT (&inpcb, inp_queue); +#endif /* Ignore sockets, that are not connected. */ #ifdef __NetBSD__