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.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 343dc329d1SAlexey Zelkin.Sh LIBRARY 353dc329d1SAlexey Zelkin.Lb libutil 36483f4c83SJoerg Wunsch.Sh SYNOPSIS 37483f4c83SJoerg Wunsch.Fd #include <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 43483f4c83SJoerg Wunschprepares a terminal for a new login session. The file descriptor 44483f4c83SJoerg Wunsch.Ar fd 45483f4c83SJoerg Wunschpassed to 46cb222923SMike Pritchard.Fn login_tty 47483f4c83SJoerg Wunschmust be opened for reading and writing on a terminal device. It 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 54cb222923SMike Pritchard.Fn Login_tty 55483f4c83SJoerg Wunschreturns -1 if it could not make the device referenced by 56483f4c83SJoerg Wunsch.Ar fd 57483f4c83SJoerg Wunschthe controlling terminal of the calling process, and 0 otherwise. 58483f4c83SJoerg Wunsch.Sh SEE ALSO 59483f4c83SJoerg Wunsch.Xr dup2 2 , 60483f4c83SJoerg Wunsch.Xr ioctl 2 , 61483f4c83SJoerg Wunsch.Xr setsid 2 , 62483f4c83SJoerg Wunsch.Xr tty 4 63