tail head cat sleep
QR code linking to this page

Manual Pages  — LOGIN_TTY


login_tty – prepare a tty for a new login session



System Utilities Library (libutil, -lutil)


#include <libutil.h>

login_tty(int fd);


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.


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


dup2(2), ioctl(2), setsid(2), tty(4)

LOGIN_TTY (3) December 29, 1996

tail head cat sleep
QR code linking to this page

Please direct any comments about this manual page service to Ben Bullock. Privacy policy.

Ken Thompson has an automobile which he helped design. Unlike most automobiles, it has neither speedometer, nor gas gauge, nor any of the other numerous idiot lights which plague the modern driver. Rather, if the driver makes a mistake, a giant “?” lights up in the center of the dashboard. “The experienced driver,” says Thompson, “will usually know what's wrong.”