xref: /freebsd/lib/libutil/login_tty.3 (revision cb22292338b4b60e55fbc147ac0f51aa199197bf)
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.\"
26cb222923SMike Pritchard.\" $Id: login_tty.3,v 1.1 1996/12/29 18:30:39 joerg Exp $
27483f4c83SJoerg Wunsch.\" "
28483f4c83SJoerg Wunsch.Dd December 29, 1996
29483f4c83SJoerg Wunsch.Os
30483f4c83SJoerg Wunsch.Dt LOGIN_TTY 3
31483f4c83SJoerg Wunsch.Sh NAME
32483f4c83SJoerg Wunsch.Nm login_tty
33483f4c83SJoerg Wunsch.Nd prepare a tty for a new login session
34483f4c83SJoerg Wunsch.Sh SYNOPSIS
35483f4c83SJoerg Wunsch.Fd #include <libutil.h>
36483f4c83SJoerg Wunsch.Ft int
37483f4c83SJoerg Wunsch.Fn login_tty "int fd"
38483f4c83SJoerg Wunsch.Pp
39483f4c83SJoerg WunschLink with
40483f4c83SJoerg Wunsch.Va -lutil
41483f4c83SJoerg Wunschon the
42483f4c83SJoerg Wunsch.Xr cc 1
43483f4c83SJoerg Wunschcommand line.
44483f4c83SJoerg Wunsch.Sh DESCRIPTION
45483f4c83SJoerg WunschThe function
46cb222923SMike Pritchard.Fn login_tty
47483f4c83SJoerg Wunschprepares a terminal for a new login session.  The file descriptor
48483f4c83SJoerg Wunsch.Ar fd
49483f4c83SJoerg Wunschpassed to
50cb222923SMike Pritchard.Fn login_tty
51483f4c83SJoerg Wunschmust be opened for reading and writing on a terminal device.  It will be
52483f4c83SJoerg Wunschmade the controlling terminal for the calling process, after allocating
53483f4c83SJoerg Wunscha new session with
54483f4c83SJoerg Wunsch.Xr setsid 2 .
55483f4c83SJoerg WunschThis terminal device will also be made the standard input, standard output,
56483f4c83SJoerg Wunschand standard error output of the calling process.
57483f4c83SJoerg Wunsch.Sh RETURN VALUES
58cb222923SMike Pritchard.Fn Login_tty
59483f4c83SJoerg Wunschreturns -1 if it could not make the device referenced by
60483f4c83SJoerg Wunsch.Ar fd
61483f4c83SJoerg Wunschthe controlling terminal of the calling process, and 0 otherwise.
62483f4c83SJoerg Wunsch.Sh SEE ALSO
63483f4c83SJoerg Wunsch.Xr dup2 2 ,
64483f4c83SJoerg Wunsch.Xr ioctl 2 ,
65483f4c83SJoerg Wunsch.Xr setsid 2 ,
66483f4c83SJoerg Wunsch.Xr tty 4
67