1GETTTYENT(3) Linux Programmer's Manual GETTTYENT(3)
2
3
4
6 getttyent, getttynam, setttyent, endttyent - get ttys file entry
7
9 #include <ttyent.h>
10
11 struct ttyent *getttyent(void);
12 struct ttyent *getttynam(const char *name);
13
14 int setttyent(void);
15 int endttyent(void);
16
18 These functions provide an interface to the file _PATH_TTYS (e.g.,
19 /etc/ttys).
20
21 The function setttyent() opens the file or rewinds it if already open.
22
23 The function endttyent() closes the file.
24
25 The function getttynam() searches for a given terminal name in the
26 file. It returns a pointer to a ttyent structure (description below).
27
28 The function getttyent() opens the file _PATH_TTYS (if necessary) and
29 returns the first entry. If the file is already open, the next entry.
30 The ttyent structure has the form:
31
32 struct ttyent {
33 char *ty_name; /* terminal device name */
34 char *ty_getty; /* command to execute, usually getty */
35 char *ty_type; /* terminal type for termcap */
36 int ty_status; /* status flags */
37 char *ty_window; /* command to start up window manager */
38 char *ty_comment; /* comment field */
39 };
40
41 ty_status can be:
42
43 #define TTY_ON 0x01 /* enable logins (start ty_getty program) */
44 #define TTY_SECURE 0x02 /* allow UID 0 to login */
45
47 For an explanation of the terms used in this section, see at‐
48 tributes(7).
49
50 ┌──────────────────────────────┬───────────────┬───────────────────────┐
51 │Interface │ Attribute │ Value │
52 ├──────────────────────────────┼───────────────┼───────────────────────┤
53 │getttyent(), setttyent(), │ Thread safety │ MT-Unsafe race:ttyent │
54 │endttyent(), getttynam() │ │ │
55 └──────────────────────────────┴───────────────┴───────────────────────┘
56
58 Not in POSIX.1. Present on the BSDs, and perhaps other systems.
59
61 Under Linux, the file /etc/ttys, and the functions described above, are
62 not used.
63
65 ttyname(3), ttyslot(3)
66
68 This page is part of release 5.12 of the Linux man-pages project. A
69 description of the project, information about reporting bugs, and the
70 latest version of this page, can be found at
71 https://www.kernel.org/doc/man-pages/.
72
73
74
75GNU 2021-03-22 GETTTYENT(3)