login_tty

Name

login_tty -- find and open an available pseudo-tty

Synopsis

int login_tty(int fdr);

Description

login_tty() sets up for a login on the tty referenced by the file descriptor fdr. This function creates a new session, makes the tty for the current process the controlling terminal, sets the standard input, output, and error streams of the current process, and closes fdr.

Return Value

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