pty(4d) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

pty(4d)

pty(4D)                   Device Drivers & /dev files                  pty(4D)

NAME
       pty - pseudo-terminal driver

DESCRIPTION
       The  pty  driver  provides  support  for a pair of devices collectively
       known as a pseudo-terminal. The two devices comprising a  pseudo-termi‐
       nal are known as a manager and a subsidiary. The subsidiary device dis‐
       tinguishes  between  the B0 baud rate and other baud rates specified in
       the c_cflag word of the termios structure, and the CLOCAL flag in  that
       word.  It  does  not support any of the other termio(4I) device control
       functions specified by flags in the c_cflag word of the termios  struc‐
       ture  and  by the IGNBRK, IGNPAR, PARMRK, or INPCK flags in the c_iflag
       word of the termios structure, as these functions apply only  to  asyn‐
       chronous serial ports. All other termio(4I) functions must be performed
       by  STREAMS modules pushed atop the driver; when a subsidiary device is
       opened, the ldterm(4M) and ttcompat(4M)  STREAMS modules are  automati‐
       cally  pushed  on  top of the stream, providing the standard termio(4I)
       interface.


       Instead of having a hardware interface  and  associated  hardware  that
       supports  the  terminal functions, the functions are implemented by an‐
       other process manipulating the manager device of the pseudo-terminal.


       The manager and the  subsidiary  devices  of  the  pseudo-terminal  are
       tightly  connected.  Any data written on the manager device is given to
       the subsidiary device as input, as though it had been received  from  a
       hardware  interface. Any data written on the subsidiary terminal can be
       read from the manager device (rather  than  being  transmitted  from  a
       UAR).


       By default, 48 pseudo-terminal pairs are configured as follows:

         /dev/pty[p-r][0-9a-f] manager devices
         /dev/tty[p-r][0-9a-f] subsidiary devices


IOCTLS
       The  standard  set of termio ioctls are supported by the subsidiary de‐
       vice. None of the bits in the c_cflag  word  have  any  effect  on  the
       pseudo-terminal, except that if the baud rate is set to B0, it will ap‐
       pear to the process on the manager device as if the last process on the
       subsidiary  device  had closed the line; thus, setting the baud rate to
       B0 has the effect of "hanging up" the pseudo-terminal, just as  it  has
       the effect of "hanging up" a real terminal.


       There is no notion of parity on a pseudo-terminal, so none of the flags
       in  the  c_iflag word that control the processing of parity errors have
       any effect. Similarly, there is no notion of a break, so  none  of  the
       flags  that  control  the  processing of breaks, and none of the ioctls
       that generate breaks, have any effect.


       Input flow control is automatically performed; a process that  attempts
       to  write  to the manager device will be blocked if too much unconsumed
       data is buffered on the subsidiary device. The input flow control  pro‐
       vided by the IXOFF flag in the c_iflag word is not supported.


       The delays specified in the c_oflag word are not supported.


       As  there  are no modems involved in a pseudo-terminal, the ioctls that
       return or alter the state of modem control lines are silently ignored.


       A few special ioctls are provided on the manager devices of pseudo-ter‐
       minals to provide the functionality needed by applications programs  to
       emulate real hardware interfaces:

       TIOCSTOP

           The  argument  is  ignored.  Output  to the pseudo-terminal is sus‐
           pended, as if a STOP character had been typed.


       TIOCSTART

           The  argument  is  ignored.  Output  to  the   pseudo-terminal   is
           restarted, as if a START character had been typed.


       TIOCPKT

           The  argument  is  a  pointer to an int. If the value of the int is
           non-zero, packet mode is enabled; if the value of the int is  zero,
           packet  mode is disabled. When a pseudo-terminal is in packet mode,
           each subsequent read(2) from the manager device  will  return  data
           written  on the subsidiary device preceded by a zero byte (symboli‐
           cally defined as TIOCPKT_DATA), or a single byte reflecting control
           status information. In the latter case, the byte is an inclusive-or
           of zero or more of the bits:

           TIOCPKT_FLUSHREAD

               whenever the read queue for the terminal is flushed.


           TIOCPKT_FLUSHWRITE

               whenever the write queue for the terminal is flushed.


           TIOCPKT_STOP

               whenever output to the terminal is stopped using ^S.


           TIOCPKT_START

               whenever output to the terminal is restarted.


           TIOCPKT_DOSTOP

               whenever XON/XOFF flow control is enabled after being disabled;
               it is considered enabled when the IXON flag in the c_iflag word
               is set, the VSTOP member of the c_cc array is ^S, and  the  VS‐
               TART member of the c_cc array is ^Q.


           TIOCPKT_NOSTOP

               whenever XON/XOFF flow control is disabled after being enabled.



       TIOCREMOTE

           The  argument  is  a  pointer to an int. If the value of the int is
           non-zero, remote mode is enabled; if the value of the int is  zero,
           remote mode is disabled. This mode can be enabled or disabled inde‐
           pendently of packet mode. When a pseudo-terminal is in remote mode,
           input  to the subsidiary device of the pseudo-terminal is flow con‐
           trolled and not input edited (regardless of the mode the subsidiary
           side of the pseudo-terminal). Each write to the manager device pro‐
           duces a record boundary for the process reading the subsidiary  de‐
           vice.  In normal usage, a write of data is like the data typed as a
           line on the terminal; a write of 0 bytes  is  like  typing  an  EOF
           character. Note: this means that a process writing to a pseudo-ter‐
           minal  manager  in  remote mode must keep track of line boundaries,
           and write only one line at a time to the manager. If, for  example,
           it  were  to buffer up several NEWLINE characters and write them to
           the manager with one write(), it would appear to a process  reading
           from  the subsidiary as if a single line containing several NEWLINE
           characters had been typed (as if, for example, a user had typed the
           LNEXT character before typing all but the  last  of  those  NEWLINE
           characters). Remote mode can be used when doing remote line editing
           in a window manager, or whenever flow controlled input is required.


EXAMPLES
         #include <fcntl.h>
         #include <sys/termios.h>

         int fdm, fds;
         fdm = open("/dev/ptyp0", O_RDWR);  /* open manager */
         fds = open("/dev/ttyp0", O_RDWR);  /* open subsidiary */


FILES
       /dev/pty[p-z][0-9a-f]    pseudo-terminal manager devices


       /dev/tty[p-z][0-9a-f]    pseudo-terminal subsidiary devices


SEE ALSO
       grantpt(3C), openpty(3C), termio(4I), ldterm(4M), ttcompat(4M)

NOTES
       In  previous  releases  and earlier standards, manager devices were re‐
       ferred to as "master" or "controller" devices, and  subsidiary  devices
       were referred to as "slave" devices. This release has adopted the "man‐
       ager"  and  "subsidiary"  terminology  used in the POSIX.1-2024 and The
       Open Group Standard Base Specifications, Issue 8 standards.


       It is not possible to send an EOT by writing zero bytes  in  TIOCREMOTE
       mode.

Oracle Solaris 11.4               19 Jun 2024                          pty(4D)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3