openpty

Name

openpty -- find and open an available pseudo-terminal

Synopsis

#include <pty.h>

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

Description

The openpty() function shall find an available pseudo-terminal and return file descriptors for the master and slave devices in the locations referenced by amaster and aslave respectively. If name is not NULL, the filename of the slave shall be placed in the user supplied buffer referenced by name. If termp is not NULL, it shall point to a termios structure used to initialize the terminal parameters of the slave pseudo-terminal device. If winp is not NULL, it shall point to a winsize structure used to initialize the window size parameters of the slave pseudo-terminal device.

Return Value

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

Errors

ENOENT 

There are no available pseudo-terminals.