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)
Thu, May 16, 7:46 AM
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
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 Passed
Unit
No Test Coverage
Build Status
Buildable 15275
Build 15334: arc lint + arc unit

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

typo: neccessarily should be necessarily

sbin/init/init.c
1517–1522

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

Good catch, fixed. Thanks!

sbin/init/init.c
1517–1522

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.