On Wed, 13 Oct 2021, Johnny Billquist wrote:
You need to open the device to check to see if clocal is set.Yes. Is that a problem?With getty, it has to open the device anyway. And then it's just a question of doing a delay at close if it is not. Seems like the most natural thing.
It sleeps before opening the device to ensure that the last close had enough time to send the hangup signal. It doesn't actually close the device itself, as the tty stays open for exec of the login process.
The code is in src/libexec/getty/ if you care to look for yourself. Take care, Jared