login_tty

Name

login_tty -- Prepare a terminal for login

Synopsis

#include <utmp.h>

int login_tty (int fdr);

Description

The login_tty() function shall prepare the terminal device referenced by the file descriptor fdr. This function shall create a new session, make the terminal the controlling terminal for the current process, and set the standard input, output, and error streams of the current process to the terminal. If fdr is not the standard input, output or error stream, then login_tty() shall close fdr.

Return Value

On success, login_tty() shall return zero; otherwise -1 is returned, and errno shall be set appropriately.

Errors

ENOTTY 

fdr does not refer to a terminal device.