- The /dev/ptmx is UNIX 98 master clone device Source
- When a process opens /dev/ptmx, it gets a file descriptor for a pseudoterminal master (PTM), and a pseudoterminal slave (PTS) device is created in the /dev/pts directory Source. There are no nodes in the file system for master devices Source.
- Data written to the slave is presented on the master descriptor as input. Data written to the master is presented to the slave as input Source.
- In Unix and related computer operating systems, a file descriptor (FD, less frequently fildes) is an abstract indicator (handle) used to access a file or other input/output resource, such as a pipe or network socket Source.
Conclusion:
- /dev/ptmx is just kind of a "mold" to clone masters (file descriptor actually).
- A pseudoterminal is a pair of virtual devices that provide a bidirectional communication. One end of the channel is a file decriptor (Master) and the other is a /dev/pts/n device (Slave).
- There is no PTM device but only a file descriptor.
- A file descriptor is used to access a file or resource.
Questions :
- Where is located the PTM resource that the file descriptor handle?
- Why do we call PTM master "device"? Since there is no entry in /dev for it.
- Can a modified program like SSHD communicate with PTS directly without the PTM in the middle?