tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: flock(2): locking against itself?



On Mon, Apr 17, 2023 at 12:19:19AM +0000, David Holland wrote:
 > However, I'd expect that getting a second open of the same tty for the
 > output would work around this. (dup isn't enough, but a new open
 > should work, because non-blocking I/O is a file-handle-level mode, not
 > a tty driver mode.)

Since there seems to have been some confusion about this upthread:
FIONBIO works by setting FNONBLOCK on the struct file. This then
results in IO_NDELAY being set on VOP_READ/VOP_WRITE calls.

The FIONBIO is also forwarded to underlying objects, ioctl being the
mess it is, but it seems the primary consumer of that is the socket
layer; in particular tty.c does nothing upon receiving it.

This means the state is per-open.


Also, regarding something else mentioned upthread, see O_NOSIGPIPE.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index