LOGIN_TTY(3) Introduction to Library Functions LOGIN_TTY(3)

NAME

login_ttyprepare a tty for a new login session

SYNOPSIS

#include <pty.h>

int
login_tty(int fd);

DESCRIPTION

The function login_tty() prepares a terminal for a new login session. The file descriptor fd passed to login_tty() must be opened for reading and writing on a terminal device. It will be made the controlling terminal for the calling process, after allocating a new session with setsid(2). This terminal device will also be made the standard input, standard output, and standard error output of the calling process.

RETURN VALUES

The function returns -1 if setsid() fails or login_tty() could not make the device referenced by fd the controlling terminal of the calling process, and 0 otherwise.

INTERFACE STABILITY

Comitted

MT-LEVEL

Unsafe

SEE ALSO

dup2(3), ioctl(2), setsid(2), tty(1)
October 10, 2015 NexentaStor