From owner-svn-src-head@FreeBSD.ORG Sun Nov 23 00:20:51 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA2941065673; Sun, 23 Nov 2008 00:20:51 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A705B8FC14; Sun, 23 Nov 2008 00:20:51 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mAN0KpPZ033358; Sun, 23 Nov 2008 00:20:51 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mAN0KpYQ033357; Sun, 23 Nov 2008 00:20:51 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200811230020.mAN0KpYQ033357@svn.freebsd.org> From: Kip Macy Date: Sun, 23 Nov 2008 00:20:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r185193 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2008 00:20:51 -0000 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