POSIX pseudo-terminal support. The functions
ptsName all correspond directly to POSIX functions,
openPseudoTerminal function provides more convenient
interface to pseudo-terminal functionality.
Note that later versions of the
unix package include pseudo-terminal
support in the System.Posix.Terminal module. You should probably
only use this module if you need backwards compatibility with GHC
versions earlier than 6.8, or if you want direct bindings to the
low-level pseudo-terminal functions.
Opening a pseudo-terminal
Opens a pseudo-terminal master and associates it with a file descriptor.
openPt to open the pseudo-terminal for both reading
and writing. (This flag is usually specified.)
openPt from causing the terminal device to become
the controlling terminal for the process.
Change the ownership of the pseudo-terminal slave corresponding
to the given master so that it belongs to and can be read/written by
the current process's owner.
This should be called before
Unlocks the pseudo-terminal slave corresponding to the given master. This must be called before opening the slave side of the pseudo-terminal.
Obtains the name of a pseudo-terminal slave device from the master's file descriptor.
Creates, grants, and unlocks a read/write pseudo-terminal, returning an open file descriptor for the master device and the file-system path of the slave device.
Performs the following actions:
- opens a pseudo-terminal
- grants and unlocks its slave
- obtains the slave's name
- returns the master's file descriptor and the slave's name
If an exception is thrown, the master file descriptor will be closed. Otherwise, the caller is responsible for closing it.