2 ms·
> Just like ctrl-c generates INT and ctrl-z generates STP. It's very different. Ctrl-D does not generate signals. When written into the tty master, it forces t
by majewsky 8y ago
> Just like ctrl-c generates INT and ctrl-z generates STP.
It's very different. Ctrl-D does not generate signals. When written into the tty master, it forces the kernel to answer any pending read() syscalls on the tty slave, even if it means returning 0 bytes.
Programs then apply the convention of treating a read() that returns 0 bytes as meaning EOF (because that's how it works with all other file types that are not tty slaves).