[Previous] [Contents] [Next]

openpty()

Find an available pseudo-tty

Synopsis:

#include <unix.h>

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

Library:

libc

Description:

The openpty() function finds an available pseudo-tty and returns file descriptors for the master and slave in amaster and aslave. If name is non-NULL, the filename of the slave is returned in it. If termp is non-NULL, the terminal parameters of the slave is set to the values in termp. If winp is non-NULL, the window size of the slave is set to the values in it.

Returns:

0
Success.
-1
An error occurred; errno is set.

Errors:

ENOENT
There are no ttys available.

Classification:

Unix

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

See also:

fork(), forkpty(), login_tty()


[Previous] [Contents] [Next]