[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: cannot start detached sessions (with -m -d) back to back
On Sat, Jan 01, 2022 at 21:49:00 +0000, RVP wrote:
> OK, but, I think we can do better than rudely sending processes a SIGHUP.
> Using the BSD-native /dev/ptm device (via openpty(3) & friends) instead of
> /dev/ptmx seems to do the right thing: EOF when the PTY master is closed.
> File a PR (Category: pkg)
Why pkg? This is a kernel bug. POSIX doesn't seem to say anything
about this, but Christos pointed out e.g.
A read() request made on the slave side of a pty after the master
side is closed returns 0 bytes. Closing the master side of a pty
sends a SIGHUP hangup signal to the tty process group number of the
corresponding slave side and flushes pending input and output.
Solaris docs for (STREAMS-based) ptys say:
When the master device is closed, an M_HANGUP message is sent to the
slave device to render the device unusable. The process on the slave
side gets the errno ENXIO when attempting to write on that stream,
but it will be able to read any data remaining on the stream head
read queue. When all the data has been read, read(2) returns 0,
indicating that the stream can no longer be used.
Main Index |
Thread Index |