anyone believe this KASSERT?

Ian Dowse iedowse at maths.tcd.ie
Thu Oct 23 17:27:24 PDT 2003


In message <200310231441.36966.sam at errno.com>, Sam Leffler writes:
>uipc_socket.c has a KASSERT in soreceive that I think is wrong.  It dates from
> 
>a long time ago but I can't tell exactly who created it since some 
>intermediate munging buggered the CVS logs.

It was there in revision 1.1 as:

	m = so->so_rcv.sb_mb;
	...
	if (m == 0 || (...) &&
	    m->m_nextpkt == 0 && (pr->pr_flags & PR_ATOMIC) == 0) {
#ifdef DIAGNOSTIC
		if (m == 0 && so->so_rcv.sb_cc)
			panic("receive 1");
#endif

Seems to be clearer there except for the lack of brackets around
the (a && b && c) - it's just saying that if sb_mb is NULL then
sb_cc should be zero. The current code appears to do the same thing,
so looks reasonable unless I'm missing something (sb_mb should be
NULL when there is no data queued shouldn't it?).

Digging back even further:

REV:7.13                uipc_socket.c       1989/04/22 12:26:53       sklower

   checkpoint for version to be handed to NIST, simple tp4 connection

...
-       if (so->so_rcv.sb_cc == 0) {
+       m = so->so_rcv.sb_mb;
+       if (m == 0) {
+               if (so->so_rcv.sb_cc)
+                       panic("receive 1");

Ian


More information about the freebsd-net mailing list