1getttyent(3) Library Functions Manual getttyent(3)
2
3
4
6 getttyent, getttynam, setttyent, endttyent - get ttys file entry
7
9 Standard C library (libc, -lc)
10
12 #include <ttyent.h>
13
14 struct ttyent *getttyent(void);
15 struct ttyent *getttynam(const char *name);
16
17 int setttyent(void);
18 int endttyent(void);
19
21 These functions provide an interface to the file _PATH_TTYS (e.g.,
22 /etc/ttys).
23
24 The function setttyent() opens the file or rewinds it if already open.
25
26 The function endttyent() closes the file.
27
28 The function getttynam() searches for a given terminal name in the
29 file. It returns a pointer to a ttyent structure (description below).
30
31 The function getttyent() opens the file _PATH_TTYS (if necessary) and
32 returns the first entry. If the file is already open, the next entry.
33 The ttyent structure has the form:
34
35 struct ttyent {
36 char *ty_name; /* terminal device name */
37 char *ty_getty; /* command to execute, usually getty */
38 char *ty_type; /* terminal type for termcap */
39 int ty_status; /* status flags */
40 char *ty_window; /* command to start up window manager */
41 char *ty_comment; /* comment field */
42 };
43
44 ty_status can be:
45
46 #define TTY_ON 0x01 /* enable logins (start ty_getty program) */
47 #define TTY_SECURE 0x02 /* allow UID 0 to login */
48
50 For an explanation of the terms used in this section, see at‐
51 tributes(7).
52
53 ┌──────────────────────────────┬───────────────┬───────────────────────┐
54 │Interface │ Attribute │ Value │
55 ├──────────────────────────────┼───────────────┼───────────────────────┤
56 │getttyent(), setttyent(), │ Thread safety │ MT-Unsafe race:ttyent │
57 │endttyent(), getttynam() │ │ │
58 └──────────────────────────────┴───────────────┴───────────────────────┘
59
61 BSD.
62
64 Under Linux, the file /etc/ttys, and the functions described above, are
65 not used.
66
68 ttyname(3), ttyslot(3)
69
70
71
72Linux man-pages 6.04 2023-03-30 getttyent(3)