Node:Pseudo-Terminal Pairs, Previous:Allocation, Up:Pseudo-Terminals
These functions, derived from BSD, are available in the separate
libutil
library, and declared in pty.h
.
int openpty (int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp) | Function |
This function allocates and opens a pseudo-terminal pair, returning the
file descriptor for the master in *amaster, and the file
descriptor for the slave in *aslave. If the argument name
is not a null pointer, the file name of the slave pseudo-terminal
device is stored in *name . If termp is not a null pointer,
the terminal attributes of the slave are set to the ones specified in
the structure that termp points to (see Terminal Modes).
Likewise, if the winp is not a null pointer, the screen size of
the slave is set to the values specified in the structure that
winp points to.
The normal return value from
Warning: Using the |
int forkpty (int *amaster, char *name, struct termios *termp, struct winsize *winp) | Function |
This function is similar to the openpty function, but in
addition, forks a new process (see Creating a Process) and makes the
newly opened slave pseudo-terminal device the controlling terminal
(see Controlling Terminal) for the child process.
If the operation is successful, there are then both parent and child
processes and both see If the allocation of a pseudo-terminal pair or the process creation
failed, Warning: The |