Page MenuHomeFreeBSD

Improve missing tty handling in init(8)
ClosedPublic

Authored by trasz on Feb 10 2018, 8:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 29, 6:56 PM
Unknown Object (File)
Sun, Apr 21, 10:08 PM
Unknown Object (File)
Mar 11 2024, 6:22 AM
Unknown Object (File)
Mar 11 2024, 6:22 AM
Unknown Object (File)
Mar 11 2024, 6:22 AM
Unknown Object (File)
Mar 11 2024, 6:22 AM
Unknown Object (File)
Mar 7 2024, 10:14 PM
Unknown Object (File)
Feb 10 2024, 1:46 AM
Subscribers

Details

Summary

Improve missing tty handling in init(8). This removes a check that did nothing - it was checking for ENXIO, which, with devfs, is no longer returned - and was badly placed anyway, and replaces it with similar one that works, and is done just before starting getty, instead of being done when rereading ttys.

From the practical point of view, this makes init(8) handle disappearing terminals (eg /dev/ttyU*) gracefully, without unneccessary getty restarts and resulting error messages.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

trasz added a reviewer: imp.
trasz edited the summary of this revision. (Show Details)

Don't check if the device node exists for entries marked "on", as opposed to "onifexists" and "onifconsole".

This revision is now accepted and ready to land.Feb 26 2018, 9:00 PM
jilles added inline comments.
lib/libc/gen/getttyent.3
121 ↗(On Diff #39745)

typo: neccessarily should be necessarily

sbin/init/init.c
1517–1522 ↗(On Diff #39745)

Is it indeed deliberate that this is an open() and not just a stat() or eaccess()?

This revision was automatically updated to reflect the committed changes.
trasz added inline comments.
lib/libc/gen/getttyent.3
121 ↗(On Diff #39745)

Good catch, fixed. Thanks!

sbin/init/init.c
1517–1522 ↗(On Diff #39745)

In theory this should be access(2), yeah. But in my testing the open(2) seems to work a bit better. Can't really explain it, but with access(2) you get false positives (zero return) every five attempts. In other words, I've been repeatedly plugging the USB serial dongle in and out, and with access(2) it seems to sometimes restart getty even when it shouldn't.