README 2.9 KB

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