⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tty.4

📁 Unix操作系统minix 2.0源码
💻 4
📖 第 1 页 / 共 2 页
字号:

TTY(4)                    Minix Programmer's Manual                     TTY(4)


     PARENB
          Enable parity generation.

     PARODD
          Generate odd parity if parity is generated, otherwise even parity.

     HUPCL
          Drop the modem control lines on the last close of the terminal line.
          (Not implemented.)

  Local Modes
     The c_lflag field contains the following single bit  flags  that  control
     various functions:

     ECHO Enable echoing of  input  characters.   Most  input  characters  are
          echoed  as they are.  Control characters are echoed as ^X where X is
          the letter used to say that the control character  is  CTRL-X.   The
          CR, NL and TAB characters are echoed with their normal effect unless
          they are escaped by LNEXT.

     ECHOE
          If ICANON and ECHO are set then echo ERASE and KILL as one  or  more
          backspace-space-backspace  sequences  to wipe out the last character
          or the entire line, otherwise they are echoed as they are.

     ECHOK
          If ICANON and ECHO are set and ECHOE is not set then  output  an  NL
          after  the  KILL  character.   (For hardcopy terminals it is best to
          unset ECHOE and to set ECHOK.)

     ECHONL
          Echo NL even if ECHO is not set, but ICANON is set.

     ICANON
          Canonical input.  This enables line oriented  input  and  erase  and
          kill processing.

     IEXTEN
          Enable implementation defined input extensions.

     ISIG Enable the signal characters INTR, QUIT and SUSP.

     NOFLSH
          Disable the flushing of the input and output queues that is normally
          done if a signal is sent.

     TOSTOP
          Send a SIGTTOU signal if job control is implemented and a background
          process tries to write.  (Minix has no job control.)



                                                                             6



TTY(4)                    Minix Programmer's Manual                     TTY(4)


  Input and output speed
     The input and output speed are encoded into  the  c_ispeed  and  c_ospeed
     fields.   <termios.h> defines the symbols B0, B50, B75, B110, B134, B150,
     B200, B300, B600, B1200, B1800,  B2400,  B4800,  B9600,  B19200,  B38400,
     B57600  and B115200 as values used to indicate the given baud rates.  The
     zero baud rate, B0, if used for the input speed causes the input speed to
     be  equal to the output speed.  Setting the output speed to zero hangs up
     the line.  One should use  the  functions  cfgetispeed(),  cfgetospeed(),
     cfsetispeed()  and  cfsetospeed()  to  get  or  set  a speed, because the
     c_ispeed  and  c_ospeed  fields  may   not   be   visible   under   other
     implementations.   (The  c_ispeed  and c_ospeed fields and the B57600 and
     B115200 symbols are Minix specific.)

  Special characters
     The c_cc array contains the special characters that can be modified.  The
     array  has  length  NCCS  and  is  subscripted by the symbols VEOF, VEOL,
     VERASE, VINTR, VKILL, VMIN, VQUIT, VTIME, VSUSP, VSTART, VSTOP, VREPRINT,
     VLNEXT and VDISCARD.  All these symbols are defined in <termios.h>.  Some
     implementations may give the same values to the VMIN and VTIME subscripts
     and  the VEOF and VEOL subscripts respectively, and may ignore changes to
     START and STOP.  (Under Minix all special characters have there own  c_cc
     slot and can all be modified.)

  Raw I/O Parameters
     The MIN and TIME parameters can be used to adjust  a  raw  connection  to
     bursty  input.   MIN  represents  a  minimum number of bytes that must be
     received before a read call returns.  TIME  is  a  timer  of  0.1  second
     granularity that can be used to time out a read.  Setting either of these
     parameters to zero has special meaning, which leads to the following four
     possibilities:

     MIN > 0, TIME > 0
          TIME is an inter-byte timer that is started (and restarted)  when  a
          byte is received.  A read succeeds when either the minimum number of
          characters is received or the timer expires.  Note  that  the  timer
          starts  after  the first character, so the read returns at least one
          byte.

     MIN > 0, TIME = 0
          Now the timer is disabled, and a reader blocks indefinitely until at
          least MIN characters are received.

     MIN = 0, TIME > 0
          TIME is now a read timer that is started when a  read  is  executed.
          The  read  will  return if the read timer expires or if at least one
          byte is input.  (Note that a value of zero may be  returned  to  the
          reader.)





                                                                             7



TTY(4)                    Minix Programmer's Manual                     TTY(4)


     MIN = 0, TIME = 0
          The bytes currently available are returned.  Zero is returned if  no
          bytes are available.

  User Level Functions
     Termios attributes are set or examined,  and  special  functions  can  be
     performed by using the functions described in termios(2).

  Session Leaders and Process Groups
     With the use of the setsid() function can  a  process  become  a  session
     leader.   A  session leader forms a process group with a process group id
     equal to the process id of the session leader.  If a session leader opens
     a  terminal device file then this terminal becomes the controlling tty of
     the session leader.  Unless the terminal is already the  controlling  tty
     of  another  process,  or unless the O_NOCTTY flag is used to prevent the
     allocation of a controlling tty.  The process group of the session leader
     is  now  remembered as the terminal process group for signals sent by the
     terminal driver.  All the  children  and  grandchildren  of  the  session
     leader  inherit  the  controlling  terminal  and process group until they
     themselves use setsid().

     The controlling tty becomes inaccessible to the children of  the  session
     leader  when the session leader exits, and a hangup signal is sent to all
     the members of the process  group.   The  input  and  output  queues  are
     flushed  on  the last close of a terminal and all attributes are reset to
     the default state.

     A special device /dev/tty is a synonym  for  the  controlling  tty  of  a
     process.   It  allows  a process to reach the terminal even when standard
     input, output and error are redirected.  Opening this device can also  be
     used as a test to see if a process has a controlling tty or not.

     For Minix a special write-only device /dev/log exists for processes  that
     want  to  write  messages to the system console.  Unlike the console this
     device is still accessible when a session leader exits.

     Minix-vmd also has a /dev/log device, but this device is read-write.  All
     messages  written  to the log device or to the console when X11 is active
     can be read from /dev/log.  The system tries to preserve the  log  buffer
     over  a  reboot  so that panic messages reappear in the log if the system
     happens to crash.

  Pseudo Terminals
     Pseudo ttys allow a process such as a remote login daemon  to  set  up  a
     terminal  for  a  remote  login session.  The login session uses a device
     like /dev/ttyp0 for input and output, and the remote  login  daemon  uses
     the  device  /dev/ptyp0  to supply input to or take output from the login
     session and transfer this to or from  the  originating  system.   So  the
     character  flow  may  be:   Local user input sent to the remote system is
     written to  /dev/ptyp0  by  the  remote  login  daemon,  undergoes  input


                                                                             8



TTY(4)                    Minix Programmer's Manual                     TTY(4)


     processing and appears on /dev/ttyp0  as  input  to  the  login  session.
     Output  from the login session to /dev/ttyp0 undergoes output processing,
     is read from /dev/ptyp0 by the remote login daemon and is  send  over  to
     the  local  system to be displayed for the user.  (So there are only four
     data streams to worry about in a pseudo terminal.)

     A pseudo terminal can be allocated by trying to open all the  controlling
     devices /dev/ptynn one by one until it succeeds.  Further opens will fail
     once a pty is open.  The process should now fork, the child should become
     session leader, open the tty side of the pty and start a login session.

     If the tty side is eventually closed down then reads from  the  pty  side
     will  return zero and writes return -1 with errno set to EIO.  If the pty
     side is closed first then a SIGHUP signal is sent to the  session  leader
     and further reads from the tty side return zero and writes return -1 with
     errno set to EIO.  (Special note:  A line erase may  cause  up  to  three
     times  the  size  of  the tty input queue to be sent to the pty reader as
     backspace overstrikes.  Some of this output  may  get  lost  if  the  pty
     reader cannot accept it all at once in a single read call.)

  Backwards compatibility
     The TIOCGETP, TIOCSETP, TIOCGETC and TIOCSETC ioctl  functions  that  are
     used  by  the  old  sgtty  terminal  interface are still supported by the
     terminal driver by emulation.   Note  that  these  old  functions  cannot
     control  all  termios attributes, so the terminal must be in a relatively
     sane state to avoid problems.

FILES
     The list below shows all devices that Minix and Minix-vmd have.  Not  all
     of  these  devices  are  configured  in  by  default, as indicated by the
     numbers (i/j/k,  l/m/n)  that  tell  the  minimum,  default  and  maximum
     possible number of these devices for Minix (i/j/k) and Minix-vmd (l/m/n).

     /dev/console        System console.

     /dev/ttyc[1-7]      Virtual consoles.  (0/1/7, 0/1/7)

     /dev/log            Console log device.

     /dev/tty0[0-3]      Serial lines.  (0/2/2, 4/4/4)

     /dev/tty[p-w][0-f]  Pseudo ttys.  (0/0/64, 1/32/128)

     /dev/pty[p-w][0-f]  Associated pseudo tty controllers.

SEE ALSO
     stty(1), termios(3), setsid(2), read(2), write(2).





                                                                             9



TTY(4)                    Minix Programmer's Manual                     TTY(4)


BUGS
     A fair number of flags are not implemented under  Minix  (yet).   Luckily
     they  are  very limited utility and only apply to RS-232, not to the user
     interface.

AUTHOR
     Kees J. Bot (kjb@cs.vu.nl)













































                                                                            10

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -