OSDN Git Service

LDP: Update original to LDP v3.68
[linuxjm/LDP_man-pages.git] / original / man3 / getttyent.3
1 .\"  Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
2 .\"
3 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
4 .\" Distributed under GPL
5 .\" %%%LICENSE_END
6 .\"
7 .TH GETTTYENT 3 2013-07-22  "GNU" "Linux Programmer's Manual"
8 .SH NAME
9 getttyent, getttynam, setttyent, endttyent \- get ttys file entry
10 .SH SYNOPSIS
11 .B "#include <ttyent.h>"
12 .sp
13 .B "struct ttyent *getttyent(void);"
14 .sp
15 .BI "struct ttyent *getttynam(const char *" name );
16 .sp
17 .B "int setttyent(void);"
18 .sp
19 .B "int endttyent(void);"
20 .SH DESCRIPTION
21 These functions provide an interface to the file
22 .B _PATH_TTYS
23 (e.g.,
24 .IR /etc/ttys ).
25
26 The function
27 .BR setttyent ()
28 opens the file or rewinds it if already open.
29
30 The function
31 .BR endttyent ()
32 closes the file.
33
34 The function
35 .BR getttynam ()
36 searches for a given terminal name in the file.
37 It returns a pointer to a
38 .I ttyent
39 structure (description below).
40
41 The function
42 .BR getttyent ()
43 opens the file
44 .B _PATH_TTYS
45 (if necessary) and returns the first entry.
46 If the file is already open, the next entry.
47 The
48 .I ttyent
49 structure has the form:
50 .in +4n
51 .nf
52
53 struct ttyent {
54     char *ty_name;     /* terminal device name */
55     char *ty_getty;    /* command to execute, usually getty */
56     char *ty_type;     /* terminal type for termcap */
57     int   ty_status;   /* status flags */
58     char *ty_window;   /* command to start up window manager */
59     char *ty_comment;  /* comment field */
60 };
61 .fi
62 .in
63
64 .I ty_status
65 can be:
66 .br
67 .nf
68
69 #define TTY_ON     0x01  /* enable logins (start ty_getty program) */
70 #define TTY_SECURE 0x02  /* allow UID 0 to login */
71 .fi
72 .SH ATTRIBUTES
73 .SS Multithreading (see pthreads(7))
74 The
75 .BR getttyent ()
76 function returns a pointer to a static variable, so it is not thread-safe.
77 .LP
78 The
79 .BR setttyent ()
80 and
81 .BR endttyent ()
82 functions use a static variable, so they are not thread-safe.
83 .LP
84 The
85 .BR getttynam ()
86 function calls thread-unsafe function
87 .BR getttyent ()
88 so it is not thread-safe.
89 .SH CONFORMING TO
90 Not in POSIX.1-2001.
91 Present on the BSDs, and perhaps other systems.
92 .SH NOTES
93 Under Linux the file
94 .IR /etc/ttys ,
95 and the functions described above, are not used.
96 .SH SEE ALSO
97 .BR ttyname (3),
98 .BR ttyslot (3)
99 .SH COLOPHON
100 This page is part of release 3.68 of the Linux
101 .I man-pages
102 project.
103 A description of the project,
104 information about reporting bugs,
105 and the latest version of this page,
106 can be found at
107 \%http://www.kernel.org/doc/man\-pages/.