xref: /freebsd/lib/libutil/login_tty.3 (revision aa12cea2ccc6e686d6d31cf67d6bc69cbc1ba744)
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.\"
267f3dea24SPeter Wemm.\" $FreeBSD$
27483f4c83SJoerg Wunsch.\" "
28483f4c83SJoerg Wunsch.Dd December 29, 1996
29483f4c83SJoerg Wunsch.Dt LOGIN_TTY 3
30*aa12cea2SUlrich Spörlein.Os
31483f4c83SJoerg Wunsch.Sh NAME
32483f4c83SJoerg Wunsch.Nm login_tty
33483f4c83SJoerg Wunsch.Nd prepare a tty for a new login session
343dc329d1SAlexey Zelkin.Sh LIBRARY
353dc329d1SAlexey Zelkin.Lb libutil
36483f4c83SJoerg Wunsch.Sh SYNOPSIS
3732eef9aeSRuslan Ermilov.In libutil.h
38483f4c83SJoerg Wunsch.Ft int
39483f4c83SJoerg Wunsch.Fn login_tty "int fd"
40483f4c83SJoerg Wunsch.Sh DESCRIPTION
41483f4c83SJoerg WunschThe function
42cb222923SMike Pritchard.Fn login_tty
431a0a9345SRuslan Ermilovprepares a terminal for a new login session.
441a0a9345SRuslan ErmilovThe file descriptor
45483f4c83SJoerg Wunsch.Ar fd
46483f4c83SJoerg Wunschpassed to
47cb222923SMike Pritchard.Fn login_tty
481a0a9345SRuslan Ermilovmust be opened for reading and writing on a terminal device.
491a0a9345SRuslan ErmilovIt will be
50483f4c83SJoerg Wunschmade the controlling terminal for the calling process, after allocating
51483f4c83SJoerg Wunscha new session with
52483f4c83SJoerg Wunsch.Xr setsid 2 .
53483f4c83SJoerg WunschThis terminal device will also be made the standard input, standard output,
54483f4c83SJoerg Wunschand standard error output of the calling process.
55483f4c83SJoerg Wunsch.Sh RETURN VALUES
560552350eSPhilippe CharnierThe
570552350eSPhilippe Charnier.Fn login_tty
580552350eSPhilippe Charnierfunction returns -1 if it could not make the device referenced by
59483f4c83SJoerg Wunsch.Ar fd
60483f4c83SJoerg Wunschthe controlling terminal of the calling process, and 0 otherwise.
61483f4c83SJoerg Wunsch.Sh SEE ALSO
62483f4c83SJoerg Wunsch.Xr dup2 2 ,
63483f4c83SJoerg Wunsch.Xr ioctl 2 ,
64483f4c83SJoerg Wunsch.Xr setsid 2 ,
65483f4c83SJoerg Wunsch.Xr tty 4
66