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 21:48:06 1993 by Rik Faith (faith@cs.unc.edu)
30 .TH GETNETENT 3 2017-09-15 "GNU" "Linux Programmer's Manual"
32 getnetent, getnetbyname, getnetbyaddr, setnetent, endnetent \-
38 .B struct netent *getnetent(void);
40 .BI "struct netent *getnetbyname(const char *" name );
42 .BI "struct netent *getnetbyaddr(uint32_t " net ", int " type );
44 .BI "void setnetent(int " stayopen );
46 .B void endnetent(void);
51 function reads the next entry from the networks database
55 the broken-out fields from the entry.
56 A connection is opened to the database if necessary.
63 for the entry from the database
64 that matches the network
72 for the entry from the database
73 that matches the network number
79 argument must be in host byte order.
83 function opens a connection to the database,
84 and sets the next entry to the first entry.
88 then the connection to the database
89 will not be closed between calls to one of the
95 function closes the connection to the database.
99 structure is defined in
106 char *n_name; /* official network name */
107 char **n_aliases; /* alias list */
108 int n_addrtype; /* net address type */
109 uint32_t n_net; /* network number */
119 The official name of the network.
122 A NULL-terminated list of alternative names for the network.
125 The type of the network number; always
129 The network number in host byte order.
136 functions return a pointer to a
139 structure, or a null pointer if an
140 error occurs or the end of the file is reached.
144 networks database file
146 For an explanation of the terms used in this section, see
152 Interface Attribute Value
156 MT-Unsafe race:netent
158 race:netentbuf env locale
163 MT-Unsafe race:netbyname
170 MT-Unsafe race:netbyaddr
179 MT-Unsafe race:netent env
189 signifies that if any of the functions
194 are used in parallel in different threads of a program,
195 then data races could occur.
197 POSIX.1-2001, POSIX.1-2008, 4.3BSD.
199 In glibc versions before 2.2, the