*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> pty (7)              


PTY(7M)								       PTY(7M)

NAME    [Toc]    [Back]

     pty, pts -	pseudo terminal	driver

DESCRIPTION    [Toc]    [Back]

     The pty driver provides a device-pair termed a pseudo terminal.  A	pseudo
     terminal is a pair	of character devices, a	master device and a slave
     device.  The slave	device provides	processes an interface identical to
     that described in termio(7).  However, whereas all	other devices which
     provide the interface described in	termio(7) have a hardware device of
     some sort behind them, the	slave device has, instead, another process
     manipulating it through the master	half of	the pseudo terminal.  That is,
     anything written on the master device is given to the slave device	as
     input and anything	written	on the slave device is presented as input on
     the master	device.

     The following ioctl calls apply only to pseudo terminals:

	  Enable/disable packet	mode.  Packet mode is enabled by specifying
	  (by reference) a nonzero parameter and disabled by specifying	(by
	  reference) a zero parameter.	When applied to	the master side	of a
	  pseudo terminal, each	subsequent read	from the terminal will return
	  data written on the slave part of the	pseudo terminal	preceded by a
	  zero byte (symbolically 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:

	       whenever	the read queue for the terminal	is flushed.

	       whenever	the write queue	for the	terminal is flushed.

	       whenever	output to the terminal is stopped a la ^S.

	       whenever	output to the terminal is restarted.

	       whenever	t_stopc	is ^S and t_startc is ^Q.

	       whenever	the start and stop characters are not ^S/^Q.

	  This mode is used by rlogin(1C) and rlogind(1M) to implement a
	  remote-echoed, locally ^S/^Q flow-controlled remote login with
	  proper back-flushing of output; it can be used by other similar

									Page 1

PTY(7M)								       PTY(7M)

ALLOCATION    [Toc]    [Back]

     The code sequence shown below demonstrates	how to allocate	pseudo
     terminals.	 Pseudo	terminals, like	all files, must	have the correct file
     permissions to be accessible.  The	_getpty(3) library function takes care
     of	this problem.

     #include <fcntl.h>
     #include <unistd.h>

      *	Find a pseudo tty to use and open both sides.
      *	 filedes[0] receives the master	file descriptor	while filedes[1]
      *	 receives the slave.  The master is opened with	O_NDELAY as commonly
      *	 needed	in daemons such	as rlogind and telnetd.
     int		 /* -1 on failure */
     findPseudoTTY(int *filedes)
	 char *line;

	 line =	_getpty(&filedes[0], O_RDWR|O_NDELAY, 0600, 0);
	 if (0 == line)
	     return -1;
	 if (0 > (filedes[1] = open(line, O_RDWR))) {
	     return -1;
	 return	0;

FILES    [Toc]    [Back]

     /dev/ptc			   - master pseudo terminal
     /dev/tty[qrstuvwxyz][0-99]	   - slave pseudo terminals
     /dev/pts			   - equivalent	to /dev/ttyq[0-9]

SEE ALSO    [Toc]    [Back]


									PPPPaaaaggggeeee 2222
[ Back ]
 Similar pages
Name OS Title
pts HP-UX STREAMS slave pty (pseudo-terminal) driver
ptm HP-UX STREAMS master pty (pseudo-terminal) driver
telm HP-UX STREAMS Telnet slave (pseudo-terminal) driver, STREAMS Telnet master driver (used by telnetd only), respective
tels HP-UX STREAMS Telnet slave (pseudo-terminal) driver, STREAMS Telnet master driver (used by telnetd only), respective
unlockpt FreeBSD pseudo-terminal access functions
ptsname FreeBSD pseudo-terminal access functions
posix_openpt FreeBSD pseudo-terminal access functions
grantpt FreeBSD pseudo-terminal access functions
ptsname IRIX get name of the slave pseudo-terminal device
pty FreeBSD auxiliary functions to obtain a pseudo-terminal
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service