From owner-freebsd-arch Wed Sep 11 6:54:21 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 1026D37B400 for ; Wed, 11 Sep 2002 06:54:17 -0700 (PDT) Received: from hawk.mail.pas.earthlink.net (hawk.mail.pas.earthlink.net [207.217.120.22]) by mx1.FreeBSD.org (Postfix) with ESMTP id A674A43E6A for ; Wed, 11 Sep 2002 06:54:16 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0034.cvx40-bradley.dialup.earthlink.net ([216.244.42.34] helo=mindspring.com) by hawk.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 17p7wP-00046T-00; Wed, 11 Sep 2002 06:54:02 -0700 Message-ID: <3D7F4ABC.6C84FC79@mindspring.com> Date: Wed, 11 Sep 2002 06:53:00 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Bruce Evans Cc: Archie Cobbs , Bakul Shah , freebsd-arch@FreeBSD.ORG Subject: Re: /dev/stdout behavior References: <20020911204937.G1092-100000@gamplex.bde.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 Bruce Evans wrote: > > $ uname -a > > Linux foobar.packetdesign.com 2.4.9 #19 SMP Mon Oct 29 11:55:31 PST 2001 i686 unknown > > $ ./flags > > O_NONBLOCK is not set > > This is a bug in Linux IMO. This is such a misinterpretation of O_NONBLOCK. The values of O_NDELAY and O_NONBLOCK are identical in their effects, with the exception of the return value of read(2) or write(2), in the case of a potential blocking operation: O_NDELAY is set: returns 0. O_NONBLOCK is set: returns -1 and sets errno to EAGAIN. Other than that they are identical. So it's reasonable to go looking at the behaviour of O_NDELAY. Realize that the existance of the O_NDELAY flag preceeds the ability to turn it off on an fd once it has been turned on. That is, there did not used to be an option to fcntl(, f_SETFL, flasg @ ~O_NDELAY);, and there did not used to be a FIONBIO ability to turn off the non-blocking I/O. You can obtain your own copy of the SVID, and other documents that are related to the System V ABI, from: http://www.caldera.com/developers/devspecs/ Unfortunately, they didn't also make the compliance validcation suite available online. 8-(. > /dev/stdout should be as much like the real > stdout as possible. E.g., it should share the file offset. This requires > its descriptor to be a dup of stdout's descriptor for seekable files, and > it would be surprising if non-seekable files like ttys were different. > Sharing of O_NONBLOCK goes with sharing of the file (via diferent > descriptors). Some device drivers have broken support for O_NONBLOCK > (they do extra work to make it per-device), but tty devies get this right. It's not standardized at all. The difference seems to be that FreeBSD takes it as an alias for a descriptor, whereas Linux takes it as an alias for the FS object to which the descriptor refers. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message