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