forkpty

Name

forkpty -- find and open an available pseudo-tty

Synopsis

int forkpty(int *amaster, 
	char *name,
	struct termios *termp,
	struct winsize *winp);

Description

The forkpty() function joins openpty(), fork(), and login_tty() to create a new process operating on a pseudo-tty. The file descriptor of the master side of the pseudo-tty is returned in amaster, and null or the filename of the slave in name. If non-null, the termp and winp parameters will determine the terminal attributes and window size of the slave side of the pseudo-tty.

Return Value

On success of the child process, zero is returned. When the parent process receives the PID of its child process, pid is returned. On error, -1 is returned, and errno is set appropriately.