svn commit: r185193 - head/sys/sys
Kip Macy
kmacy at FreeBSD.org
Sat Nov 22 16:20:51 PST 2008
Author: kmacy
Date: Sun Nov 23 00:20:51 2008
New Revision: 185193
URL: http://svn.freebsd.org/changeset/base/185193
Log:
buf_ring_peek should return NULL if the ring is empty rather than
whatever happened to be at cons_tail last time it was in use
Modified:
head/sys/sys/buf_ring.h
Modified: head/sys/sys/buf_ring.h
==============================================================================
--- head/sys/sys/buf_ring.h Sun Nov 23 00:16:10 2008 (r185192)
+++ head/sys/sys/buf_ring.h Sun Nov 23 00:20:51 2008 (r185193)
@@ -216,7 +216,10 @@ buf_ring_peek(struct buf_ring *br)
panic("lock not held on single consumer dequeue");
#endif
mb();
- return (br->br_ring[br->br_cons_tail]);
+ if (br->br_cons_head == br->br_prod_tail)
+ return (NULL);
+
+ return (br->br_ring[br->br_cons_head]);
}
static __inline int
More information about the svn-src-all
mailing list