home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume25 / pty4 / part04 / NOTES < prev    next >
Encoding:
Text File  |  1992-02-18  |  5.4 KB  |  139 lines

  1. Random implementation notes:
  2.  
  3. Master now runs with uid set to euid. This ensures the integrity of
  4. various log files at the expense of proper CPU time accounting. On the
  5. other hand, telnetd and rlogind run as root, so who cares?
  6.  
  7. The rotate scripts kludge a bit to preserve the owner of each log file.
  8. Any better solutions?
  9.  
  10. Makefile uses cc -E and makes several assumptions about cpp for creating
  11. wtmprotate and friends.
  12.  
  13. Certain C programs had control charaters, but they're gone. script.tidy
  14. has control characters, but script.tidy.sh doesn't---Makefile fixes it.
  15.  
  16. Note that the assumption of two-byte tty extensions runs throughout the
  17. code.
  18.  
  19. It might be good to have the master refuse info requests while preco.
  20.  
  21. If the signaller can't change to PTYDIR, or if it can't read the
  22. extension over a pipe from the master, or if various other
  23. pseudo-possible conditions happen, the master may end up disconnected
  24. even if it's not a session. The child will not run until the first
  25. successful reconnect.
  26.  
  27. Note that the master switches controlling ttys only as a service to the
  28. slave. Nothing in the pty code depends on having the new tty as a ctty.
  29. This is a good thing, as BSD does not provide any reliable way to
  30. dissociate from the current controlling terminal. (Exercise: Show how
  31. TIOCEXCL may be used to prevent dissociation.)
  32.  
  33. Note that -R forces -T---a lot of things could go wrong otherwise.
  34.  
  35. Note that the slave unblocks various signals and sets various others to
  36. SIG_DFL; this will undo any blocking set up before pty was invoked.
  37.  
  38. Under -R, the master will ignore the tostop setting on the original tty.
  39. There's no good way to solve this---if you consider it a problem.
  40.  
  41. There'd be a race between fdsigler and fdsig2us if both master and
  42. sigler wrote and blocked at once. The solution is simple: fdsig2us is
  43. *ONLY* for sigler-to-master communication. The signaller never waits for
  44. a reply on an fdsig2us message; instead it listens attentively for other
  45. commands. (Similarly, fdsigler is only for master-to-sigler
  46. communication, but only one way is necessary to avoid deadlock.)
  47.  
  48. Sun broke the behavior of getdtablesize(); I don't care.
  49.  
  50.  
  51.  
  52. command to change flagreading?
  53.  
  54. at last possible moment, check all ifdefs
  55.  
  56.  
  57. should ttydetach trash all tty descriptors?
  58.  
  59. should write isatty() and friends, use a cache of /dev stats
  60. also, isatty() should look at tty* before others. devname.c...
  61. verify cached device->name mapping by doing one stat()?
  62.  
  63. if system runs out of fds, won't be able to talk to master. is this a
  64. problem?
  65.  
  66. if a program like sesslist gets stopped or blocked, master won't be able
  67. to reconnect. is this a problem?
  68.  
  69. ptysuspend -sp7 - suspend as if child had stopped
  70. ptycont -sp7  ???
  71. pty -xtp7  ?????
  72.  
  73. should checkptys do a pff /dev/tty*?
  74.  
  75. last - clone
  76. tachywho
  77.  
  78. if child stops while master is disconnected, stop will be held for
  79. reconnecting signaller; child will be automatically continued on
  80. reconnect
  81.  
  82. should probably ignore SIGPIPE for utilities
  83.  
  84. note that an independent sesslist may temporarily show master as
  85. disconnected
  86.  
  87. definitely should not optimize sigsched
  88.  
  89.  
  90.  
  91. from ptypaper.9:
  92. : Instead of copying pseudo-terminal modes from the original terminal, pty
  93. : will set up a generic new-discipline line-at-a-time mode. (Footnote:
  94. : This generic mode is defined in tty_initmodes() in the pty source. It
  95. : should instead be described in further detail in some manual page.)
  96. now defined in ttydfl.7.
  97. : Note that pty handles job control
  98. : correctly
  99. it now handles it even better than correctly.
  100. : Note that a
  101. : session ``program'' is always restarted when it is reconnected.
  102. still true
  103. : TERM signals
  104. no longer---master-sigler communication uses file descriptors
  105. : Note that if it weren't for WINCH handling and the kernel support for
  106. : controlling terminals, all mention of the original tty could disappear
  107. : from the master. This would greatly simplify reconnect, though some
  108. : stopping complexity would move into the signaller.
  109. this is now done---winch and cttys are both handled differently now
  110. : Like all programs, this pty implementation has its caveats. Because the
  111. : master needs a tty to reconnect to, the reconnecting signaller has to
  112. : have a file descriptor open and pointing to its current tty.
  113. no longer true
  114. : As documented, pseudo-ttys cannot handle EOF.
  115. doesn't really matter now given nobuf
  116. : Raw-mode tty processing is problematic. There is no way to set a
  117. : terminal's modes so that it does no processing and acts just like a
  118. : pipe.
  119. ditto
  120. : pty's random pseudo-tty searching should not be in a fixed order.
  121. it isn't any more
  122. : None of the above (except TIOCEXCL, but there are still races) address
  123. : the problem of a background process keeping access to a pseudo-tty.
  124. : pty's test for previous access is completely reliable under some
  125. : variants of the BSD kernel, and completely unreliable under others.
  126. new test is (i think) completely reliable under all variants
  127. : A much better solution is to have utmp initialized at system startup to
  128. : list all available ptys, in the order that login requires; then pty will
  129. : conform to that order.
  130. now done, see utmpinit (thanks to paul graham)
  131. : Even better would be to dedicate a file to
  132. : session information: /etc/stmp, with permanent records in /usr/adm/ttmp.
  133. now done, sesslog/sessnow
  134. : The association between connections and sessions is still logically
  135. : separate and belongs in yet another file: say /etc/cstmp and
  136. : /usr/adm/dttmp. pty would maintain these files along with stmp and ttmp.
  137. now done, sclog/scnow
  138.  
  139.