Date: Wed, 18 Apr 2001 06:40:38 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> Cc: "John W. De Boskey" <jwd@bsdwins.com>, Current List <freebsd-current@FreeBSD.ORG> Subject: Re: FIO* doc added to tty.4 (review) Message-ID: <Pine.BSF.4.21.0104180626350.12270-100000@besplex.bde.org> In-Reply-To: <200104171817.OAA13546@khavrinen.lcs.mit.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 17 Apr 2001, Garrett Wollman wrote: > <<On Tue, 17 Apr 2001 03:38:05 -0400, "John W. De Boskey" <jwd@bsdwins.com> said: > > > ie: FIONREAD will succeed from a backgrounded process, but the > > data read itself with hang (tty driver). > > You are describing a general property of the terminal subsystem, which > any process dealing with terminals needs to be aware of. > > (AFAIK, ioctl(tty, FIONREAD, &n) should set n to zero if the process > is in the background; if it does not that's probably a bug.) It doesn't. However, applications should be prepared to deal with there being no readable data. Success of FIONREAD doesn't guarantee non-blocking of a blocking read in general -- the data may have been read by another process, or there may not be enough data to satisfy the programmed MIN/TIME requirements. > The new POSIX revision group discussed this briefly in the > mailing-list, but the group did not want to innovate in this area. select() and poll() would give the same false positive as FIONREAD, and probably doesn't handle MIN/TIME right. Does POSIX now specify select() and/or poll() precisely enough to show that the current behaviour is wrong? Related bug: ttioctl() doesn't understand all driver ioctls well enough to know which ones should wait until the progress is in the foreground; drivers know even less about background processes. So background processes an do some ioctls that change the device state underneath forground processes. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0104180626350.12270-100000>