I'm pretty sure 'a read() of those bytes' (by emacs) is one part of a proccess of sending output to the
device. Emacs is 'the device' here and terminal line can not be closed and disconnected until all data
is sent. There should be no chance for the application to exit until the output is 'sent to the device'
hence no chance for the kernel to thow SIGCHLD.
It's not a pipe nor stream, it's an intaractive tty/pty.
Posted Aug 3, 2009 22:30 UTC (Mon) by nix (subscriber, #2304)
[Link]
The process of sending the data through a pty or tty is desynchronized
from the state of the process doing the sending. If a process sends data,
then exits, it can be gone (and SIGCHLD fired) *long* before the buffers
are flushed to the receiving app. This has always been true (I first
remember noticing it on SunOS 4, but it was old even then) and is
essential for good performance over slower lines or under high load.
(Emacs is not the device. The device and buffering for it are kernel
entities. Emacs is merely the entity on the *master side* of the device.)
A tempest in a tty pot
Posted Aug 4, 2009 8:46 UTC (Tue) by alex_the_d (guest, #59935)
[Link]
> The device and buffering for it are kernel entities.
No, 'kernel entities' are 'device driver(s)'. THE device is that beige box on the table or a piece of
code emulating it (emacs).
A tempest in a tty pot
Posted Aug 4, 2009 21:06 UTC (Tue) by nix (subscriber, #2304)
[Link]
The fact remains that POSIX does not require process exit signal / TTY
flush synchronization, and I know of no Unix that ensures that these
things are synchronized. Your musings about what constitutes 'the device'
are thus not terribly relevant. The system simply does not work the way
you would like it to (and the way some app authors assume).