UNIX mAn pAges:pty(7)

转载 2004年10月18日 18:45:00
PTY(7M) PTY(7M) NAME pty, pts - pseudo terminal driver DESCRIPTION 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: TIOCPKT 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: 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 a la ^S. TIOCPKT_START whenever output to the terminal is restarted. TIOCPKT_DOSTOP whenever t_stopc is ^S and t_startc is ^Q. TIOCPKT_NOSTOP 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 programs. Page 1 PTY(7M) PTY(7M) ALLOCATION 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 #include /* * 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))) { (void)close(filedes[0]); return -1; } return 0; } FILES /dev/ptc - master pseudo terminal /dev/tty[qrstuvwxyz][0-99] - slave pseudo terminals /dev/pts - equivalent to /dev/ttyq[0-9] SEE ALSO getpty(3)

Unix man 手册(学习笔记)

         在unix下面做开发,查看man手册是非常必要,也是非常需要的。如何更快速的使用man?         当然,平时有不会的命令,或者记不住命令的参数时,就会man一下,可是在uni...
  • shuangfeiyiyu
  • shuangfeiyiyu
  • 2008年07月25日 17:01
  • 4591

unix man使用

在unix下面做开发,查看man手册是非常必要,也是非常需要的。如何更快速的使用man?          当然,平时有不会的命令,或者记不住命令的参数时,就会man一下,可是在unix man手册里...
  • u014338577
  • u014338577
  • 2015年09月19日 23:03
  • 327

Linux man pages

  • sweechie
  • sweechie
  • 2006年10月15日 15:43
  • 558

【Unix/Linux】【命令】查看命令帮助 —— man

第一个你需要知道的Linux命令就是man命令,该命令可以显示指定命令的用法和描述。比如你想知道ls命令的用法和选项,可以在终端执行“man ls”:语法: man man ls root@de...
  • robinjwong
  • robinjwong
  • 2009年10月22日 17:44
  • 777


最近在学习epoll,在对比man pages和wangsh
  • gogdizzy
  • gogdizzy
  • 2014年05月20日 15:36
  • 1180


  • robertsong2004
  • robertsong2004
  • 2014年08月27日 21:08
  • 2073

man pthread_mutex_lock,man pthread_cond_wait没文档的解决办法

  • Mengxihe29
  • Mengxihe29
  • 2016年09月22日 11:32
  • 536

man pages

Those numbers represent the section of the man pages: Executable programs or shell commands System c...
  • visionfans
  • visionfans
  • 2015年08月19日 13:28
  • 288

centos7 man手册更新

新安装的centos7,发现man手册不完全 [root@localhost daiyu]# man 2 socket No manual entry for socket in section 2 ...
  • daiyudong2020
  • daiyudong2020
  • 2017年03月04日 22:50
  • 1516

View and search Unix/Linux man pages

这篇文章转载自:http://www.tuxfiles.org/linuxhelp/manpages.html How to use man pages > If you're wonderi...
  • zhoumg
  • zhoumg
  • 2011年12月13日 14:28
  • 346
您举报文章:UNIX mAn pAges:pty(7)