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.