[3621] | 1 | Getty
|
---|
| 2 |
|
---|
| 3 | ??? Should getty open tty with or without O_NONBLOCK?
|
---|
| 4 | For serial lines, it means "should getty wait for Carrier Detect pin?"
|
---|
| 5 | I 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),
|
---|
| 11 | when getty should send -I INITSTR data to tty? After open succeeds?
|
---|
| 12 | What 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
|
---|
| 17 | select/poll, and when input is available, it checks lock file.
|
---|
| 18 | If it exists, mgetty exits (it assumes someone else uses the line).
|
---|
| 19 | If no, it creates the file (lock the tty). Sounds like a good algorithm
|
---|
| 20 | to use if we are called with -w...
|
---|
| 21 |
|
---|
| 22 | Getty should establish a new session and process group, and ensure
|
---|
| 23 | that tty is a ctty.
|
---|
| 24 |
|
---|
| 25 | ??? Should getty ensure that other processes which might have opened
|
---|
| 26 | fds to this tty be dusconnected? agetty has a -R option which makes
|
---|
| 27 | agetty call vhangup() after tty is opened. (Then agetty opens it again,
|
---|
| 28 | since it probably vhangup'ed its own fd too).
|
---|
| 29 |
|
---|
| 30 | Getty should leave the tty in approximately the same state as "stty sane"
|
---|
| 31 | before 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 -
|
---|
| 35 | is it useful?
|
---|
| 36 |
|
---|
| 37 | It should be possible to run "getty 0 -" from a shell prompt.
|
---|
| 38 | [This currently doesn't work from interactive shell since setsid()
|
---|
| 39 | fails in process group leader. The workaround is to run it as a child
|
---|
| 40 | of something. sh -c 'getty - 0; true' usually works. Should we fix this?]
|
---|
| 41 | It should leave tty in a sane state when it exits (Ctrl-D, -t SEC timeout):
|
---|
| 42 | echo should be on, speed, control chars properly set, etc.
|
---|
| 43 | (However, it can't restore ctty. The symptom is that "</dev/tty"
|
---|
| 44 | fails in the parent shell after getty exits: /dev/tty can't be opened).
|
---|
| 45 |
|
---|
| 46 | Getty should write LOGIN_PROCESS utmp record before it starts waiting
|
---|
| 47 | for username to be entered.
|
---|
| 48 |
|
---|
| 49 | Login
|
---|
| 50 |
|
---|
| 51 | Login should not try to set up tty parameters - apart from switching echo
|
---|
| 52 | off while entering password, and switching it back on after.
|
---|
| 53 |
|
---|
| 54 | Login should not leave "echo off" state when it times out reading password
|
---|
| 55 | or otherwise terminates (Ctrl-C, Ctrl-D etc).
|
---|
| 56 |
|
---|
| 57 | ??? Should login establish a new session and/or process group, and ensure
|
---|
| 58 | that tty is a ctty? Without this, running login directly (not via getty)
|
---|
| 59 | from e.g. initscript will usually result with a login session without
|
---|
| 60 | ctty and without session/pgrp properly created...
|
---|
| 61 |
|
---|
| 62 | It should be possible to run "login [USER]" from a shell prompt,
|
---|
| 63 | and it should work (not block/die/error out).
|
---|
| 64 | Similarly 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
|
---|
| 67 | for username/password to be entered?
|
---|
| 68 |
|
---|
| 69 | Login should write USER_PROCESS utmp record just before it is about
|
---|
| 70 | to exec user's shell.
|
---|