UNIX mAn pAges:pty(7)
来源:互联网 发布:分水岭分割算法 博客 编辑:程序博客网 时间:2024/04/30 02:15
PTY(7M) PTY(7M)NAME pty, pts -pseudo terminaldriverDESCRIPTION The pty driver provides a device-pair termed a pseudo terminal. Apseudo terminal is a pairof character devices, amaster device and a slave device. The slavedevice providesprocesses an interface identical to that described in termio(7). However, whereas allother devices which provide the interface described intermio(7) have a hardware device of some sort behind them, theslave device has, instead, another process manipulating it through the masterhalf ofthe pseudo terminal. That is, anything written on the master device is given to the slave deviceas input and anythingwrittenon the slave device is presented as input on the masterdevice. The following ioctl calls apply only to pseudo terminals: TIOCPKT Enable/disable packetmode. Packet mode is enabled by specifying (by reference) a nonzero parameter and disabled by specifying(by reference) a zero parameter.When applied tothe master sideof a pseudo terminal, eachsubsequent readfrom the terminal will return data written on the slave part of thepseudo terminalpreceded by a zero byte (symbolically defined as TIOCPKT_DATA), or a singlebyte reflecting control status information. In the lattercase, the byte is aninclusive-or ofzero ormore ofthe bits: TIOCPKT_FLUSHREAD wheneverthe read queue for the terminalis flushed. TIOCPKT_FLUSHWRITE wheneverthe write queuefor theterminal is flushed. TIOCPKT_STOP wheneveroutput to the terminal is stopped a la ^S. TIOCPKT_START wheneveroutput to the terminal is restarted. TIOCPKT_DOSTOP whenevert_stopcis ^S and t_startc is ^Q. TIOCPKT_NOSTOP wheneverthe 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 1PTY(7M) PTY(7M)ALLOCATION The code sequence shown below demonstrateshow to allocatepseudo terminals. Pseudoterminals, likeall files, musthave the correct file permissions to be accessible. The__getpty(3) library function takes care ofthis problem. #include #include /* *Find a pseudo tty to use and open both sides. * filedes[0] receives the masterfile descriptorwhile filedes[1] * receives the slave. The master is opened withO_NDELAY as commonly * neededin daemons suchas 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; } return0; }FILES /dev/ptc - master pseudo terminal /dev/tty[qrstuvwxyz][0-99] - slave pseudo terminals /dev/pts - equivalentto /dev/ttyq[0-9]SEE ALSO getpty(3)
- UNIX mAn pAges:pty(7)
- View and search Unix/Linux man pages
- man pages
- Linux man pages
- 安装 man pages
- 给 man pages 着色
- cygwin 安装man pages
- op03-export man pages
- linux帮助文件man-pages man命令详解
- The Linux man-pages project
- Socket BSD API man pages
- 给 man pages 设置颜色
- 给man pages设置颜色
- 给man pages设置颜色
- ubuntu 安装 kernel man pages
- 给man pages设置颜色
- The Linux man-pages project
- 安装最新的man-pages
- 探讨实体化视图的刷新机制
- 游客心中的婺源
- 深入解析Java的新特性assertion
- 通过java.net.URL类抓取某个网页的内容 选择自 cqq 的 Blog
- Windows Rundll 和 Rundll32 接口
- UNIX mAn pAges:pty(7)
- Microsoft Windows 2000 应用程序兼容性
- 在 ASP 中读取和显示二进制数据
- CSDN Oracle杂志正式启动
- 对事件与委托的理解(2) 引发事件
- WindowsXP 巧妙搜索文件
- 40种网页常用小技巧(javascript一 二)
- 使用公共语言运行库强制代码访问权
- Telnet的攻击