From owner-freebsd-bugs@FreeBSD.ORG Tue Dec 6 11:30:14 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F18F7106567A for ; Tue, 6 Dec 2011 11:30:14 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id E08038FC12 for ; Tue, 6 Dec 2011 11:30:14 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id pB6BUEaZ070218 for ; Tue, 6 Dec 2011 11:30:14 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id pB6BUE4d070215; Tue, 6 Dec 2011 11:30:14 GMT (envelope-from gnats) Date: Tue, 6 Dec 2011 11:30:14 GMT Message-Id: <201112061130.pB6BUE4d070215@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: "Poul-Henning Kamp" Cc: Subject: Re: kern/163076: It is not possible to read in chunks from linprocfs and procfs. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Poul-Henning Kamp List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 11:30:15 -0000 The following reply was made to PR kern/163076; it has been noted by GNATS. From: "Poul-Henning Kamp" To: Jaakko Heinonen Cc: Petr Salinger , bug-followup@FreeBSD.org Subject: Re: kern/163076: It is not possible to read in chunks from linprocfs and procfs. Date: Tue, 06 Dec 2011 11:20:09 +0000 In message <20111205214201.GA37871@jh>, Jaakko Heinonen writes: >On 2011-12-05, Poul-Henning Kamp wrote: >> Sbufs were designed to have "latching error semantics" and any errors >> should not be cleared by sbuf_finish() for exactly that reason. > >Shouldn't sbuf_finish() then check s->s_error before appending the >trailing '\0' and setting the SBUF_FINISHED flag? The problem in >question wasn't caught earlier because sbuf_finish() happily finishes >the buffer even if it has an error. I belive the code is written so that there is always reserved space for the final '\0' sbuf_finish() should finish _any_ sbuf, and return zero only if the finished buffer is fully OK. I belive it does that, if not its a bug. The intent is that you don't have to check for errors more than one place: sbuf_finish() -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.