login_tty
![]() |
![]() |
![]() |
![]() |
login_tty()
Prepare for a login in a tty
Synopsis:
#include <unix.h> int login_tty( int fd );
Arguments:
- fd
- A file descriptor that you want to use as the controlling terminal for the current process.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
![]() |
This function is in libc.a, but not in libc.so (in order to save space). |
Description:
The login_tty() function prepares for a login on the tty fd (which may be a real tty device, or the slave of a pseudo-tty as returned by openpty()) by creating a new session, making fd the controlling terminal for the current process, setting fd to be the standard input, output, and error streams of the current process, and closing fd.
This function fails if ioctl() fails to set fd to the controlling terminal of the current process.
Returns:
- 0
- Success.
- -1
- An error occurred; errno is set.
Classification:
| Safety: | |
|---|---|
| Cancellation point | Yes |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |
See also:
![]() |
![]() |
![]() |
![]() |

![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)

