From owner-freebsd-arch Tue Oct 29 10:45:29 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9B56E37B401 for ; Tue, 29 Oct 2002 10:45:27 -0800 (PST) Received: from pimout1-ext.prodigy.net (pimout1-ext.prodigy.net [207.115.63.77]) by mx1.FreeBSD.org (Postfix) with ESMTP id C87DD43E6E for ; Tue, 29 Oct 2002 10:45:21 -0800 (PST) (envelope-from kbyanc@posi.net) Received: from gateway.posi.net (adsl-63-201-92-224.dsl.snfc21.pacbell.net [63.201.92.224]) by pimout1-ext.prodigy.net (8.12.3 da nor stuldap/8.12.3) with ESMTP id g9TIjDX8537702; Tue, 29 Oct 2002 13:45:14 -0500 Received: from localhost (localhost [127.0.0.1]) by gateway.posi.net (8.12.6/8.12.5) with ESMTP id g9TIjCOQ035545; Tue, 29 Oct 2002 10:45:12 -0800 (PST) (envelope-from kbyanc@posi.net) Date: Tue, 29 Oct 2002 10:45:12 -0800 (PST) From: Kelly Yancey To: Julian Elischer Cc: Kelly Yancey , Subject: Re: RFC: Exporting number of bytes of protocol data to userland In-Reply-To: Message-ID: <20021029101832.X35506-100000@gateway.posi.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, 28 Oct 2002, Julian Elischer wrote: > It seems reasonable to me, but have you run a lot of apps? > Also I'd like to know what the standards say about these interfaces. > > On Mon, 28 Oct 2002, Kelly Yancey wrote: > > > > > The attached patch is rather short so the impatient can probably skip > > right to the source. > > > > The background is that there are at least 3 interfaces which report the > > "number of bytes in the socket buffer" to userland: > > ioctl(s, FIONREAD, &len) > > stat(2) via the st_size member of struct stat > > kqueue(2) via data member of struct kevents returned for > > EVFILT_READ filters. > > > [...] > Thanks for the feedback, I've had the kqueue portion of the patch running on my workstation for a couple of weeks now. Needless to say, not a lot of applications use kqueue yet so that doesn't really say much. :| However my UDP applicates which use kqueue are rather happy with the change. :) In any event, kqueue isn't covered by any standards so it is the safest to modify. The stat change I've been running for a few days with no ill effects so far which I more or less expected: I seriously doubt too many applications rely on fstat's behavior on sockets. Heck, according to the fstat(2) man page[*], practically the entire struct sb (including st_size) should be 0 which, despite not being the case on either -stable or -current, if anything relied on the old st_size value being anything other than 0 then they already knew they were dancing with the devil. All this is moot anyway because the change is a no-op for sockets without non-protocol data in the socket buffer (i.e. TCP) and for sockets that do put non-protocol data in the socket buffer the old value was practically useless anyway. Thanks again, Kelly [*] The fstat(2) man page's BUGS section is horribly out-of-touch with reality with regards to sockets. -- Kelly Yancey -- kbyanc@{posi.net,FreeBSD.org} FreeBSD, The Power To Serve: http://www.freebsd.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message