Debian Codegraph @

upstream/debian-unstable/man3/getttyent.3

raw
1 '\" t
2 .\" Copyright 2002, Walter Harms <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: GPL-1.0-or-later
6 .\"
7 .TH getttyent 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 getttyent, getttynam, setttyent, endttyent \- get ttys file entry
10 .SH LIBRARY
11 Standard C library
12 .RI ( libc ,\~ \-lc )
13 .SH SYNOPSIS
14 .nf
15 .B "#include <ttyent.h>"
16 .P
17 .B "struct ttyent *getttyent(void);"
18 .BI "struct ttyent *getttynam(const char *" name );
19 .P
20 .B "int setttyent(void);"
21 .B "int endttyent(void);"
22 .fi
23 .SH DESCRIPTION
24 These functions provide an interface to the file
25 .B _PATH_TTYS
26 (e.g.,
27 .IR /etc/ttys ).
28 .P
29 The function
30 .BR setttyent ()
31 opens the file or rewinds it if already open.
32 .P
33 The function
34 .BR endttyent ()
35 closes the file.
36 .P
37 The function
38 .BR getttynam ()
39 searches for a given terminal name in the file.
40 It returns a pointer to a
41 .I ttyent
42 structure (description below).
43 .P
44 The function
45 .BR getttyent ()
46 opens the file
47 .B _PATH_TTYS
48 (if necessary) and returns the first entry.
49 If the file is already open, the next entry.
50 The
51 .I ttyent
52 structure has the form:
53 .P
54 .in +4n
55 .EX
56 struct ttyent {
57 char *ty_name; /* terminal device name */
58 char *ty_getty; /* command to execute, usually getty */
59 char *ty_type; /* terminal type for termcap */
60 int ty_status; /* status flags */
61 char *ty_window; /* command to start up window manager */
62 char *ty_comment; /* comment field */
63 };
64 .EE
65 .in
66 .P
67 .I ty_status
68 can be:
69 .P
70 .in +4n
71 .EX
72 #define TTY_ON 0x01 /* enable logins (start ty_getty program) */
73 #define TTY_SECURE 0x02 /* allow UID 0 to login */
74 .EE
75 .in
76 .SH ATTRIBUTES
77 For an explanation of the terms used in this section, see
78 .BR attributes (7).
79 .TS
80 allbox;
81 lbx lb lb
82 l l l.
83 Interface Attribute Value
84 T{
85 .na
86 .nh
87 .BR getttyent (),
88 .BR setttyent (),
89 .BR endttyent (),
90 .BR getttynam ()
91 T} Thread safety MT-Unsafe race:ttyent
92 .TE
93 .SH STANDARDS
94 BSD.
95 .SH NOTES
96 Under Linux, the file
97 .IR /etc/ttys ,
98 and the functions described above, are not used.
99 .SH SEE ALSO
100 .BR ttyname (3),
101 .BR ttyslot (3)