[Toybox] [PATCH] getty: ensure utmp is updated.

Rob Landley rob at landley.net
Sat Aug 15 04:43:48 PDT 2020



On 8/13/20 10:02 AM, Rob Landley wrote:
> On 8/11/20 2:25 PM, enh via Toybox wrote:
>> The key issues here turned out to be that getty is responsible for
>> creating the file if it doesn't exist, and that the -H flag doesn't
>> control whether utmp is updated, but whether or not to override the
>> hostname within the utmp entry.
>>
>> While I'm here switch to the more modern utx APIs that all the non-pending
>> parts of toybox use, and remove the duplication.
> 
> Applied and pushed, but this reminds me I should really clean this up and
> promote it.
> 
> The reason I haven't is I don't really have a test environment for it? (This
> waits for a modem to dial in to a serial port, adjusts the baud rate, and calls
> login. I got my first broadband connection in 2001 and haven't owned a modem since.)

Do you have the FOGGIEST idea why:

    xopen_stdio(TT.tty_name, O_RDWR|O_NDELAY|O_CLOEXEC);
    fcntl(0, F_SETFL, fcntl(0, F_GETFL) & ~O_NONBLOCK); // Block read

O_NDELAY == O_NONBLOCK so it opens the tty nonblock and then immediately
switches off the nonblock. What (if anything) does that DO? Why is it here? Is
this something BSD 2.x needed in 1983 because of certain defective ASR-33
teletype variants when plugged into one of the HP minicomputers with the "zero
and add packed" instruction?

The man page is unenlightening, and the kernel source has 373 _files_ with
O_NONBLOCK in them...

Rob



More information about the Toybox mailing list