busybox/loginutils/README
<<
>>
Prefs
   1        Getty
   2
   3??? Should getty open tty with or without O_NONBLOCK?
   4For serial lines, it means "should getty wait for Carrier Detect pin?"
   5I checked other getties:
   6
   7- agetty always uses O_NONBLOCK
   8- mgetty uses O_NONBLOCK unless run with -b, or as "getty"
   9
  10??? If we decided to use O_NONBLOCK (perhaps optionally with -b),
  11when getty should send -I INITSTR data to tty? After open succeeds?
  12What if we also want to initialize *modem* with some AT commands?
  13
  14??? Should we check/create /var/lock/LCK..ttyPFX lockfiles?
  15
  16??? mgetty opens tty but does NOT lock it, then waits for input via
  17select/poll, and when input is available, it checks lock file.
  18If it exists, mgetty exits (it assumes someone else uses the line).
  19If no, it creates the file (lock the tty). Sounds like a good algorithm
  20to use if we are called with -w...
  21
  22Getty should establish a new session and process group, and ensure
  23that tty is a ctty.
  24
  25??? Should getty ensure that other processes which might have opened
  26fds to this tty be disconnected? agetty has a -R option which makes
  27agetty call vhangup() after tty is opened. (Then agetty opens it again,
  28since it probably vhangup'ed its own fd too).
  29
  30Getty should leave the tty in approximately the same state as "stty sane"
  31before it execs login program. Minor things we do conditionally are:
  32        c_iflag |= ICRNL; // if '\r' was used to end username
  33
  34??? mgetty uses per-tty file to ignore connects, /etc/nologin.ttyxx -
  35is it useful?
  36
  37It should be possible to run "getty 0 -" from a shell prompt.
  38[This currently doesn't work from interactive shell since setsid()
  39fails in process group leader. The workaround is to run it as a child
  40of something. sh -c 'getty - 0; true' usually works. Should we fix this?]
  41It should leave tty in a sane state when it exits (Ctrl-D, -t SEC timeout):
  42echo should be on, speed, control chars properly set, etc.
  43(However, it can't restore ctty. The symptom is that "</dev/tty"
  44fails in the parent shell after getty exits: /dev/tty can't be opened).
  45
  46Getty should write LOGIN_PROCESS utmp record before it starts waiting
  47for username to be entered.
  48
  49        Login
  50
  51Login should not try to set up tty parameters - apart from switching echo
  52off while entering password, and switching it back on after.
  53
  54Login should not leave "echo off" state when it times out reading password
  55or otherwise terminates (Ctrl-C, Ctrl-D etc).
  56
  57??? Should login establish a new session and/or process group, and ensure
  58that tty is a ctty? Without this, running login directly (not via getty)
  59from e.g. initscript will usually result with a login session without
  60ctty and without session/pgrp properly created...
  61
  62It should be possible to run "login [USER]" from a shell prompt,
  63and it should work (not block/die/error out).
  64Similarly to getty, it should leave tty in the sane state when it exits.
  65
  66??? Should login write LOGIN_PROCESS utmp record before it starts waiting
  67for username/password to be entered?
  68
  69Login should write USER_PROCESS utmp record just before it is about
  70to exec user's shell.
  71