PTY(3) | Introduction to Library Functions | PTY(3) |
int
openpty(int *amaster, int *aslave, char *name, const struct termios *termp, const struct winsize *winp);
int
forkpty(int *amaster, char *name, const struct termios *termp, const struct winsize *winp);
If the argument name is not NULL, the filename of the slave is returned in name.
If the arguments termp or winp are not NULL, openpty() initializes the termios and window size settings from the structures these arguments point to, respectively.
Upon return, the open file descriptors for the master and slave side of the pty are returned in the locations pointed to by amaster and aslave, respectively.
The forkpty() function first calls openpty() to obtain the next available pseudo-terminal from the system. Upon success, it forks off a new process. In the child process, it closes the descriptor for the master side of the pty, and calls login_tty(3) for the slave pty. In the parent process, it closes the descriptor for the slave side of the pty. The arguments amaster, name, termp, and winp have the same meaning as described for openpty().
In addition to this, forkpty() may set it to any value as described for fork(2).
October 10, 2015 | NexentaStor |