]> git.ipfire.org Git - thirdparty/man-pages.git/blame_incremental - man3/getprotoent.3
fanotify_init.2, fanotify.7: Document FAN_REPORT_TID
[thirdparty/man-pages.git] / man3 / getprotoent.3
... / ...
CommitLineData
1.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2.\"
3.\" %%%LICENSE_START(VERBATIM)
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
12.\"
13.\" Since the Linux kernel and libraries are constantly changing, this
14.\" manual page may be incorrect or out-of-date. The author(s) assume no
15.\" responsibility for errors or omissions, or for damages resulting from
16.\" the use of the information contained herein. The author(s) may not
17.\" have taken the same level of care in the production of this manual,
18.\" which is licensed free of charge, as they might when working
19.\" professionally.
20.\"
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
23.\" %%%LICENSE_END
24.\"
25.\" References consulted:
26.\" Linux libc source code
27.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28.\" 386BSD man pages
29.\" Modified Sat Jul 24 19:26:03 1993 by Rik Faith (faith@cs.unc.edu)
30.TH GETPROTOENT 3 2017-09-15 "GNU" "Linux Programmer's Manual"
31.SH NAME
32getprotoent, getprotobyname, getprotobynumber, setprotoent,
33endprotoent \- get protocol entry
34.SH SYNOPSIS
35.nf
36.B #include <netdb.h>
37.PP
38.B struct protoent *getprotoent(void);
39.PP
40.BI "struct protoent *getprotobyname(const char *" name );
41.PP
42.BI "struct protoent *getprotobynumber(int " proto );
43.PP
44.BI "void setprotoent(int " stayopen );
45.PP
46.B void endprotoent(void);
47.fi
48.SH DESCRIPTION
49The
50.BR getprotoent ()
51function reads the next entry from the protocols database (see
52.BR protocols (5))
53and returns a
54.I protoent
55structure
56containing the broken-out fields from the entry.
57A connection is opened to the database if necessary.
58.PP
59The
60.BR getprotobyname ()
61function returns a
62.I protoent
63structure
64for the entry from the database
65that matches the protocol name
66.IR name .
67A connection is opened to the database if necessary.
68.PP
69The
70.BR getprotobynumber ()
71function returns a
72.I protoent
73structure
74for the entry from the database
75that matches the protocol number
76.IR number .
77A connection is opened to the database if necessary.
78.PP
79The
80.BR setprotoent ()
81function opens a connection to the database,
82and sets the next entry to the first entry.
83If
84.I stayopen
85is nonzero,
86then the connection to the database
87will not be closed between calls to one of the
88.BR getproto* ()
89functions.
90.PP
91The
92.BR endprotoent ()
93function closes the connection to the database.
94.PP
95The
96.I protoent
97structure is defined in
98.I <netdb.h>
99as follows:
100.PP
101.in +4n
102.EX
103struct protoent {
104 char *p_name; /* official protocol name */
105 char **p_aliases; /* alias list */
106 int p_proto; /* protocol number */
107}
108.EE
109.in
110.PP
111The members of the
112.I protoent
113structure are:
114.TP
115.I p_name
116The official name of the protocol.
117.TP
118.I p_aliases
119A NULL-terminated list of alternative names for the protocol.
120.TP
121.I p_proto
122The protocol number.
123.SH RETURN VALUE
124The
125.BR getprotoent (),
126.BR getprotobyname ()
127and
128.BR getprotobynumber ()
129functions return a pointer to a
130statically allocated
131.I protoent
132structure, or a null pointer if an
133error occurs or the end of the file is reached.
134.SH FILES
135.PD 0
136.TP
137.I /etc/protocols
138protocol database file
139.PD
140.SH ATTRIBUTES
141For an explanation of the terms used in this section, see
142.BR attributes (7).
143.TS
144allbox;
145lbw18 lb lbw28
146l l l.
147Interface Attribute Value
148T{
149.BR getprotoent ()
150T} Thread safety T{
151MT-Unsafe race:protoent
152.br
153race:protoentbuf locale
154T}
155T{
156.BR getprotobyname ()
157T} Thread safety T{
158MT-Unsafe race:protobyname
159.br
160locale
161T}
162T{
163.BR getprotobynumber ()
164T} Thread safety T{
165MT-Unsafe race:protobynumber
166.br
167locale
168T}
169T{
170.BR setprotoent (),
171.br
172.BR endprotoent ()
173T} Thread safety T{
174MT-Unsafe race:protoent
175.br
176locale
177T}
178.TE
179.sp 1
180In the above table,
181.I protoent
182in
183.I race:protoent
184signifies that if any of the functions
185.BR setprotoent (),
186.BR getprotoent (),
187or
188.BR endprotoent ()
189are used in parallel in different threads of a program,
190then data races could occur.
191.SH CONFORMING TO
192POSIX.1-2001, POSIX.1-2008, 4.3BSD.
193.SH SEE ALSO
194.BR getnetent (3),
195.BR getprotoent_r (3),
196.BR getservent (3),
197.BR protocols (5)