]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/getnetent.3
err.3: EXAMPLES: use EXIT_FAILURE rather than 1 as exit status
[thirdparty/man-pages.git] / man3 / getnetent.3
index 32f852097b6e3385af680126976c34bb748dd0b9..ad4ea679e328764bedc310017b0fb7c76803722b 100644 (file)
 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
 .\"     386BSD man pages
 .\" Modified Sat Jul 24 21:48:06 1993 by Rik Faith (faith@cs.unc.edu)
-.TH GETNETENT 3  2008-08-19 "GNU" "Linux Programmer's Manual"
+.TH GETNETENT 3  2017-09-15 "GNU" "Linux Programmer's Manual"
 .SH NAME
 getnetent, getnetbyname, getnetbyaddr, setnetent, endnetent \-
 get network entry
 .SH SYNOPSIS
 .nf
 .B #include <netdb.h>
-.sp
+.PP
 .B struct netent *getnetent(void);
-.sp
+.PP
 .BI "struct netent *getnetbyname(const char *" name );
-.sp
+.PP
 .BI "struct netent *getnetbyaddr(uint32_t " net ", int " type );
-.sp
+.PP
 .BI "void setnetent(int " stayopen );
-.sp
+.PP
 .B void endnetent(void);
 .fi
 .SH DESCRIPTION
 The
 .BR getnetent ()
 function reads the next entry from the networks database
-and returns a \fInetent\fP structure containing
+and returns a
+.I netent
+structure containing
 the broken-out fields from the entry.
 A connection is opened to the database if necessary.
 .PP
 The
 .BR getnetbyname ()
-function returns a \fInetent\fP structure
+function returns a
+.I netent
+structure
 for the entry from the database
-that matches the network \fIname\fP.
+that matches the network
+.IR name .
 .PP
 The
 .BR getnetbyaddr ()
-function returns a \fInetent\fP structure
+function returns a
+.I netent
+structure
 for the entry from the database
-that matches the network number \fInet\fP of type
-\fItype\fP.
+that matches the network number
+.I net
+of type
+.IR type .
 The
 .I net
 argument must be in host byte order.
@@ -73,7 +82,9 @@ The
 .BR setnetent ()
 function opens a connection to the database,
 and sets the next entry to the first entry.
-If \fIstayopen\fP is nonzero,
+If
+.I stayopen
+is nonzero,
 then the connection to the database
 will not be closed between calls to one of the
 .BR getnet* ()
@@ -83,20 +94,26 @@ The
 .BR endnetent ()
 function closes the connection to the database.
 .PP
-The \fInetent\fP structure is defined in \fI<netdb.h>\fP as follows:
-.sp
+The
+.I netent
+structure is defined in
+.I <netdb.h>
+as follows:
+.PP
 .in +4n
-.nf
+.EX
 struct netent {
     char      *n_name;     /* official network name */
     char     **n_aliases;  /* alias list */
     int        n_addrtype; /* net address type */
     uint32_t   n_net;      /* network number */
 }
-.fi
+.EE
 .in
 .PP
-The members of the \fInetent\fP structure are:
+The members of the
+.I netent
+structure are:
 .TP
 .I n_name
 The official name of the network.
@@ -117,14 +134,67 @@ The
 and
 .BR getnetbyaddr ()
 functions return a pointer to a
-statically allocated \fInetent\fP structure, or a NULL pointer if an
+statically allocated
+.I netent
+structure, or a null pointer if an
 error occurs or the end of the file is reached.
 .SH FILES
 .TP
 .I /etc/networks
 networks database file
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lbw14 lb lbw25
+l l l.
+Interface      Attribute       Value
+T{
+.BR getnetent ()
+T}     Thread safety   T{
+MT-Unsafe race:netent
+.br
+race:netentbuf env locale
+T}
+T{
+.BR getnetbyname ()
+T}     Thread safety   T{
+MT-Unsafe race:netbyname
+.br
+env locale
+T}
+T{
+.BR getnetbyaddr ()
+T}     Thread safety   T{
+MT-Unsafe race:netbyaddr
+.br
+locale
+T}
+T{
+.BR setnetent (),
+.br
+.BR endnetent ()
+T}     Thread safety   T{
+MT-Unsafe race:netent env
+.br
+locale
+T}
+.TE
+.sp 1
+In the above table,
+.I netent
+in
+.I race:netent
+signifies that if any of the functions
+.BR setnetent (),
+.BR getnetent (),
+or
+.BR endnetent ()
+are used in parallel in different threads of a program,
+then data races could occur.
 .SH CONFORMING TO
-4.3BSD, POSIX.1-2001.
+POSIX.1-2001, POSIX.1-2008, 4.3BSD.
 .SH NOTES
 In glibc versions before 2.2, the
 .I net