From owner-freebsd-net Wed Feb 28 7:30:29 2001 Delivered-To: freebsd-net@freebsd.org Received: from curly.chiaro.com (us.chiaro.com [63.88.196.33]) by hub.freebsd.org (Postfix) with ESMTP id 2948637B71A for ; Wed, 28 Feb 2001 07:30:27 -0800 (PST) (envelope-from plawthers@chiaro.com) Received: from chiaro.com (192-168-25-122.chiaro.com [192.168.25.122]) by curly.chiaro.com (8.9.3+Sun/8.9.1) with ESMTP id JAA19730; Wed, 28 Feb 2001 09:30:06 -0600 (CST) Message-ID: <3A9D196F.49310D36@chiaro.com> Date: Wed, 28 Feb 2001 09:29:51 -0600 From: Peter Lawthers Organization: Chiaro Networks X-Mailer: Mozilla 4.75 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: Garrett Wollman Cc: freebsd-net@FreeBSD.ORG Subject: Re: sendfile with headers (struct sf_hdtr) References: <3A9AE15D.103DFBB7@chiaro.com> <200102270350.WAA71013@khavrinen.lcs.mit.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Actually, sendfile(2) returns either 0 or -1 (with errno set). The optional 'sbytes' argument indicates how many bytes were sent. Maybe I wasn't clear in my original posting. If you use the optional headers, then the *return value* from sendfile is non-zero, and is *only * the amount sent via writev. Not 0, or -1 as the code and the man page lead one to believe. Garrett Wollman wrote: > > < said: > > > When using sendfile(2) with the optional headers, it appears > > that sendfile inadvertently returns the number of bytes written > > via writev > > If any data was sent, sendfile() should tell you so. > > -GAWollman > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-net" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message