=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/systat/netstat.c,v retrieving revision 1.38 retrieving revision 1.39 diff -c -r1.38 -r1.39 *** src/usr.bin/systat/netstat.c 2013/12/24 22:26:20 1.38 --- src/usr.bin/systat/netstat.c 2013/12/25 01:46:00 1.39 *************** *** 1,4 **** ! /* $OpenBSD: netstat.c,v 1.38 2013/12/24 22:26:20 tedu Exp $ */ /* $NetBSD: netstat.c,v 1.3 1995/06/18 23:53:07 cgd Exp $ */ /*- --- 1,4 ---- ! /* $OpenBSD: netstat.c,v 1.39 2013/12/25 01:46:00 tedu Exp $ */ /* $NetBSD: netstat.c,v 1.3 1995/06/18 23:53:07 cgd Exp $ */ /*- *************** *** 232,239 **** read_ns(void) { struct inpcbtable pcbtable; ! struct inpcb *next; ! struct inpcb inpcb; struct socket sockb; struct tcpcb tcpcb; void *off; --- 232,239 ---- read_ns(void) { struct inpcbtable pcbtable; ! struct inpcb *next, *prev; ! struct inpcb inpcb, prevpcb; struct socket sockb; struct tcpcb tcpcb; void *off; *************** *** 262,271 **** --- 262,280 ---- again: KREAD(off, &pcbtable, sizeof (struct inpcbtable)); + prev = NULL; next = TAILQ_FIRST(&pcbtable.inpt_queue); while (next != NULL) { KREAD(next, &inpcb, sizeof (inpcb)); + if (prev != NULL) { + KREAD(prev, &prevpcb, sizeof (prevpcb)); + if (TAILQ_NEXT(&prevpcb, inp_queue) != next) { + error("Kernel state in transition"); + return 0; + } + } + prev = next; next = TAILQ_NEXT(&inpcb, inp_queue); if (!aflag) {