From owner-freebsd-hackers@FreeBSD.ORG Thu Jan 13 12:45:01 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 699A716A4CE for ; Thu, 13 Jan 2005 12:45:01 +0000 (GMT) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by mx1.FreeBSD.org (Postfix) with ESMTP id B324343D39 for ; Thu, 13 Jan 2005 12:45:00 +0000 (GMT) (envelope-from smckay@internode.on.net) Received: from dungeon.home (ppp231-141.lns1.bne1.internode.on.net [203.122.231.141])j0DCiwsW089760; Thu, 13 Jan 2005 23:14:59 +1030 (CST) Received: from dungeon.home (localhost [127.0.0.1]) by dungeon.home (8.13.1/8.11.6) with ESMTP id j0DCiGga008717; Thu, 13 Jan 2005 22:44:16 +1000 (EST) (envelope-from mckay) Message-Id: <200501131244.j0DCiGga008717@dungeon.home> To: Jilles Tjoelker References: <200501120949.j0C9nQCZ000573@dungeon.home> <200501121354.j0CDscrR002027@dungeon.home> <20050113074721.GC79646@cirb503493.alcatel.com.au> <20050113110558.GA27286@stack.nl> In-Reply-To: <20050113110558.GA27286@stack.nl> from Jilles Tjoelker at "Thu, 13 Jan 2005 12:05:58 +0100" Date: Thu, 13 Jan 2005 22:44:16 +1000 From: Stephen McKay cc: Peter Jeremy cc: freebsd-hackers@freebsd.org cc: Stephen McKay Subject: Re: Background processes setting O_NONBLOCK on ttys X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jan 2005 12:45:01 -0000 On Thursday, 13th January 2005, Jilles Tjoelker wrote: >POSIX states that the O_NONBLOCK flag is per open file description. File >descriptors created with dup(2), fork(2) or similar methods share the >same open file description, while new descriptors created with open(2) >do not. Can you quote chapter and verse on this? Or is it merely implied? A pointer to an online copy would be best. I found that "The Open Group Base Specifications Issue 6" at http://www.opengroup.org/onlinepubs/009695399/toc.htm is not clear on the matter. Also "The Single UNIX Specification, Version 2" at http://www.opengroup.org/onlinepubs/007908799/ is similarly unclear. >Consequently, a POSIX-compliant implementation of O_NONBLOCK does not >solve the problem, as all descriptors to the terminal refer to the same >open file description. O_NONBLOCK is indeed unusable for descriptions >shared with other unknowing processes :( If we must be POSIX compliant and if you accept that POSIX demands that dup'd file descriptors share a single O_NONBLOCK flag, then the logical end position is that the threads library must not routinely set stdin, stdout and stderr to non-blocking. Right? Personally, I have no qualms being non-POSIX compliant in a good cause. Wouldn't being non-POSIX on this issue be easier? Hmm. Should this be on -arch now? Stephen.