On Tue, 17 Apr 2001, Garrett Wollman wrote:
> <<On Tue, 17 Apr 2001 03:38:05 -0400, "John W. De Boskey" <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message