xref: /freebsd/lib/libutil/login_tty.3 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1483f4c83SJoerg Wunsch.\"
2483f4c83SJoerg Wunsch.\" Copyright (c) 1996 Joerg Wunsch
3483f4c83SJoerg Wunsch.\"
4483f4c83SJoerg Wunsch.\" All rights reserved.
5483f4c83SJoerg Wunsch.\"
6483f4c83SJoerg Wunsch.\" Redistribution and use in source and binary forms, with or without
7483f4c83SJoerg Wunsch.\" modification, are permitted provided that the following conditions
8483f4c83SJoerg Wunsch.\" are met:
9483f4c83SJoerg Wunsch.\" 1. Redistributions of source code must retain the above copyright
10483f4c83SJoerg Wunsch.\"    notice, this list of conditions and the following disclaimer.
11483f4c83SJoerg Wunsch.\" 2. Redistributions in binary form must reproduce the above copyright
12483f4c83SJoerg Wunsch.\"    notice, this list of conditions and the following disclaimer in the
13483f4c83SJoerg Wunsch.\"    documentation and/or other materials provided with the distribution.
14483f4c83SJoerg Wunsch.\"
15483f4c83SJoerg Wunsch.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
16483f4c83SJoerg Wunsch.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17483f4c83SJoerg Wunsch.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18483f4c83SJoerg Wunsch.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
19483f4c83SJoerg Wunsch.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20483f4c83SJoerg Wunsch.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21483f4c83SJoerg Wunsch.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22483f4c83SJoerg Wunsch.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23483f4c83SJoerg Wunsch.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24483f4c83SJoerg Wunsch.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25483f4c83SJoerg Wunsch.\" "
26*bc89b58dSGordon Bergling.Dd May 10, 2020
27483f4c83SJoerg Wunsch.Dt LOGIN_TTY 3
28aa12cea2SUlrich Spörlein.Os
29483f4c83SJoerg Wunsch.Sh NAME
30483f4c83SJoerg Wunsch.Nm login_tty
31483f4c83SJoerg Wunsch.Nd prepare a tty for a new login session
323dc329d1SAlexey Zelkin.Sh LIBRARY
333dc329d1SAlexey Zelkin.Lb libutil
34483f4c83SJoerg Wunsch.Sh SYNOPSIS
3532eef9aeSRuslan Ermilov.In libutil.h
36483f4c83SJoerg Wunsch.Ft int
37483f4c83SJoerg Wunsch.Fn login_tty "int fd"
38483f4c83SJoerg Wunsch.Sh DESCRIPTION
39483f4c83SJoerg WunschThe function
40cb222923SMike Pritchard.Fn login_tty
411a0a9345SRuslan Ermilovprepares a terminal for a new login session.
421a0a9345SRuslan ErmilovThe file descriptor
43483f4c83SJoerg Wunsch.Ar fd
44483f4c83SJoerg Wunschpassed to
45cb222923SMike Pritchard.Fn login_tty
461a0a9345SRuslan Ermilovmust be opened for reading and writing on a terminal device.
471a0a9345SRuslan ErmilovIt will be
48483f4c83SJoerg Wunschmade the controlling terminal for the calling process, after allocating
49483f4c83SJoerg Wunscha new session with
50483f4c83SJoerg Wunsch.Xr setsid 2 .
51483f4c83SJoerg WunschThis terminal device will also be made the standard input, standard output,
52483f4c83SJoerg Wunschand standard error output of the calling process.
53483f4c83SJoerg Wunsch.Sh RETURN VALUES
540552350eSPhilippe CharnierThe
550552350eSPhilippe Charnier.Fn login_tty
560552350eSPhilippe Charnierfunction returns -1 if it could not make the device referenced by
57483f4c83SJoerg Wunsch.Ar fd
58483f4c83SJoerg Wunschthe controlling terminal of the calling process, and 0 otherwise.
59483f4c83SJoerg Wunsch.Sh SEE ALSO
60483f4c83SJoerg Wunsch.Xr dup2 2 ,
61483f4c83SJoerg Wunsch.Xr ioctl 2 ,
62483f4c83SJoerg Wunsch.Xr setsid 2 ,
63483f4c83SJoerg Wunsch.Xr tty 4
64*bc89b58dSGordon Bergling.Sh HISTORY
65*bc89b58dSGordon BerglingThe function
66*bc89b58dSGordon Bergling.Fn login_tty
67*bc89b58dSGordon Berglingfirst appeared in
68*bc89b58dSGordon Bergling.Bx 4.4 .
69