login_tty

Name

login_tty -- find and open an available pseudo-tty

Synopsis

int login_tty(int fdr);

Description

The login_tty() function sets up for a login on the tty referenced by the file descriptor fd: create a new session, make the tty for the current process the controlling terminal, set the standard input, output, and error streams of the current process, and closing fd.

Return Value

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