[Previous] [Contents] [Next]

forkpty()

Create a new process operating in a pseudo-tty

Synopsis:

#include <unix.h>

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

Library:

libc

Description:

The forkpty() function combines openpty(), fork(), and login_tty() to create a new process operating in a pseudo-tty. The file descriptor of the master side of the pseudo-tty is returned in amaster, and the filename of the slave in name if it isn't NULL. The termp and winp parameters, if non-NULL, determine the terminal attributes and window size of the slave side of the pseudo-tty.

This function fails if either openpty() or fork() fails.

Returns:

0 to the child process, the child's process ID to the parent, or -1 if an error occurred.

Classification:

Unix

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

fork(), login_tty(), openpty()


[Previous] [Contents] [Next]