Advanced Programming in UNIX Environment Episode 126


The do_driver function for the pty program

Advanced Features
Packet Mode

Packet mode lets the PTY master learn of state changes in the PTY slave. On Solaris, this mode is enabled by pushing the STREAMS module pckt onto the PTY master side. On FreeBSD, Linux, and Mac OS X, this mode is enabled with the TIOCPKT ioctl command.

Remote Mode

A PTY master can set the PTY slave to remote mode by issuing the TIOCREMOTE ioctl command. Although Mac OS X 10.6.8 and Solaris 10 use the same command to enable and disable this feature, under Solaris the third argument to ioctl is an integer, whereas with Mac OS X, it is a pointer to an integer. (FreeBSD 8.0 and Linux 3.2.0 don’t support this command.)

Window Size Changes

The process above the PTY master can issue the TIOCSWINSZ ioctl command to set the window size of the slave. If the new size differs from the current size, a SIGWINCH signal is sent to the foreground process group of the PTY slave.

Signal Generation

The process reading and writing the PTY master can send signals to the process group of the PTY slave. Under Solaris 10, this is done using the TIOCSIGNAL ioctl command. With FreeBSD 8.0, Linux 3.2.0, and Mac OS X 10.6.8, the ioctl command is TIOCSIG. In both cases, the third argument is set to the signal number.

The last two chapters are the implementing the knowledge of previous chapters, therefore I won’t take any notes for these two chapters. Put the other hand, this is the final part of the serial notes of Advanced Programming in the Unix Environment.

That is the end of this series. Thank you for your patience to read these notes.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值