1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
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.
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.
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
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" References consulted:
26 .\" Linux libc source code
27 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
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"
32 getprotoent, getprotobyname, getprotobynumber, setprotoent,
33 endprotoent \- get protocol entry
38 .B struct protoent *getprotoent(void);
40 .BI "struct protoent *getprotobyname(const char *" name );
42 .BI "struct protoent *getprotobynumber(int " proto );
44 .BI "void setprotoent(int " stayopen );
46 .B void endprotoent(void);
51 function reads the next entry from the protocols database (see
56 containing the broken-out fields from the entry.
57 A connection is opened to the database if necessary.
64 for the entry from the database
65 that matches the protocol name
67 A connection is opened to the database if necessary.
70 .BR getprotobynumber ()
74 for the entry from the database
75 that matches the protocol number
77 A connection is opened to the database if necessary.
81 function opens a connection to the database,
82 and sets the next entry to the first entry.
86 then the connection to the database
87 will not be closed between calls to one of the
93 function closes the connection to the database.
97 structure is defined in
104 char *p_name; /* official protocol name */
105 char **p_aliases; /* alias list */
106 int p_proto; /* protocol number */
116 The official name of the protocol.
119 A NULL-terminated list of alternative names for the protocol.
126 .BR getprotobyname ()
128 .BR getprotobynumber ()
129 functions return a pointer to a
132 structure, or a null pointer if an
133 error occurs or the end of the file is reached.
138 protocol database file
141 For an explanation of the terms used in this section, see
147 Interface Attribute Value
151 MT-Unsafe race:protoent
153 race:protoentbuf locale
156 .BR getprotobyname ()
158 MT-Unsafe race:protobyname
163 .BR getprotobynumber ()
165 MT-Unsafe race:protobynumber
174 MT-Unsafe race:protoent
184 signifies that if any of the functions
189 are used in parallel in different threads of a program,
190 then data races could occur.
192 POSIX.1-2001, POSIX.1-2008, 4.3BSD.
195 .BR getprotoent_r (3),