|
Packit |
7cfc04 |
.\" Copyright 2008, Linux Foundation, written by Michael Kerrisk
|
|
Packit |
7cfc04 |
.\" <mtk.manpages@gmail.com>
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" %%%LICENSE_START(VERBATIM)
|
|
Packit |
7cfc04 |
.\" Permission is granted to make and distribute verbatim copies of this
|
|
Packit |
7cfc04 |
.\" manual provided the copyright notice and this permission notice are
|
|
Packit |
7cfc04 |
.\" preserved on all copies.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" Permission is granted to copy and distribute modified versions of this
|
|
Packit |
7cfc04 |
.\" manual under the conditions for verbatim copying, provided that the
|
|
Packit |
7cfc04 |
.\" entire resulting derived work is distributed under the terms of a
|
|
Packit |
7cfc04 |
.\" permission notice identical to this one.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
Packit |
7cfc04 |
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
Packit |
7cfc04 |
.\" responsibility for errors or omissions, or for damages resulting from
|
|
Packit |
7cfc04 |
.\" the use of the information contained herein. The author(s) may not
|
|
Packit |
7cfc04 |
.\" have taken the same level of care in the production of this manual,
|
|
Packit |
7cfc04 |
.\" which is licensed free of charge, as they might when working
|
|
Packit |
7cfc04 |
.\" professionally.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
Packit |
7cfc04 |
.\" the source, must acknowledge the copyright and authors of this work.
|
|
Packit |
7cfc04 |
.\" %%%LICENSE_END
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.TH GETNETENT_R 3 2017-09-15 "GNU" "Linux Programmer's Manual"
|
|
Packit |
7cfc04 |
.SH NAME
|
|
Packit |
7cfc04 |
getnetent_r, getnetbyname_r, getnetbyaddr_r \- get
|
|
Packit |
7cfc04 |
network entry (reentrant)
|
|
Packit |
7cfc04 |
.SH SYNOPSIS
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
.B #include <netdb.h>
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.BI "int getnetent_r(struct netent *" result_buf ", char *" buf ,
|
|
Packit |
7cfc04 |
.BI " size_t " buflen ", struct netent **" result ,
|
|
Packit |
7cfc04 |
.BI " int *" h_errnop );
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.BI "int getnetbyname_r(const char *" name ,
|
|
Packit |
7cfc04 |
.BI " struct netent *" result_buf ", char *" buf ,
|
|
Packit |
7cfc04 |
.BI " size_t " buflen ", struct netent **" result ,
|
|
Packit |
7cfc04 |
.BI " int *" h_errnop );
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.BI "int getnetbyaddr_r(uint32_t " net ", int " type ,
|
|
Packit |
7cfc04 |
.BI " struct netent *" result_buf ", char *" buf ,
|
|
Packit |
7cfc04 |
.BI " size_t " buflen ", struct netent **" result ,
|
|
Packit |
7cfc04 |
.BI " int *" h_errnop );
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.fi
|
|
Packit |
7cfc04 |
.in -4n
|
|
Packit |
7cfc04 |
Feature Test Macro Requirements for glibc (see
|
|
Packit |
7cfc04 |
.BR feature_test_macros (7)):
|
|
Packit |
7cfc04 |
.ad l
|
|
Packit |
7cfc04 |
.in
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.BR getnetent_r (),
|
|
Packit |
7cfc04 |
.BR getnetbyname_r (),
|
|
Packit |
7cfc04 |
.BR getnetbyaddr_r ():
|
|
Packit |
7cfc04 |
Since glibc 2.19:
|
|
Packit |
7cfc04 |
_DEFAULT_SOURCE
|
|
Packit |
7cfc04 |
Glibc 2.19 and earlier:
|
|
Packit |
7cfc04 |
_BSD_SOURCE || _SVID_SOURCE
|
|
Packit |
7cfc04 |
.ad b
|
|
Packit |
7cfc04 |
.SH DESCRIPTION
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.BR getnetent_r (),
|
|
Packit |
7cfc04 |
.BR getnetbyname_r (),
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR getnetbyaddr_r ()
|
|
Packit |
7cfc04 |
functions are the reentrant equivalents of, respectively,
|
|
Packit |
7cfc04 |
.BR getnetent (3),
|
|
Packit |
7cfc04 |
.BR getnetbyname (3),
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR getnetbynumber (3).
|
|
Packit |
7cfc04 |
They differ in the way that the
|
|
Packit |
7cfc04 |
.I netent
|
|
Packit |
7cfc04 |
structure is returned,
|
|
Packit |
7cfc04 |
and in the function calling signature and return value.
|
|
Packit |
7cfc04 |
This manual page describes just the differences from
|
|
Packit |
7cfc04 |
the nonreentrant functions.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
Instead of returning a pointer to a statically allocated
|
|
Packit |
7cfc04 |
.I netent
|
|
Packit |
7cfc04 |
structure as the function result,
|
|
Packit |
7cfc04 |
these functions copy the structure into the location pointed to by
|
|
Packit |
7cfc04 |
.IR result_buf .
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.I buf
|
|
Packit |
7cfc04 |
array is used to store the string fields pointed to by the returned
|
|
Packit |
7cfc04 |
.I netent
|
|
Packit |
7cfc04 |
structure.
|
|
Packit |
7cfc04 |
(The nonreentrant functions allocate these strings in static storage.)
|
|
Packit |
7cfc04 |
The size of this array is specified in
|
|
Packit |
7cfc04 |
.IR buflen .
|
|
Packit |
7cfc04 |
If
|
|
Packit |
7cfc04 |
.I buf
|
|
Packit |
7cfc04 |
is too small, the call fails with the error
|
|
Packit |
7cfc04 |
.BR ERANGE ,
|
|
Packit |
7cfc04 |
and the caller must try again with a larger buffer.
|
|
Packit |
7cfc04 |
(A buffer of length 1024 bytes should be sufficient for most applications.)
|
|
Packit |
7cfc04 |
.\" I can find no information on the required/recommended buffer size;
|
|
Packit |
7cfc04 |
.\" the nonreentrant functions use a 1024 byte buffer -- mtk.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
If the function call successfully obtains a network record, then
|
|
Packit |
7cfc04 |
.I *result
|
|
Packit |
7cfc04 |
is set pointing to
|
|
Packit |
7cfc04 |
.IR result_buf ;
|
|
Packit |
7cfc04 |
otherwise,
|
|
Packit |
7cfc04 |
.I *result
|
|
Packit |
7cfc04 |
is set to NULL.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
The buffer pointed to by
|
|
Packit |
7cfc04 |
.I h_errnop
|
|
Packit |
7cfc04 |
is used to return the value that would be stored in the global variable
|
|
Packit |
7cfc04 |
.I h_errno
|
|
Packit |
7cfc04 |
by the nonreentrant versions of these functions.
|
|
Packit |
7cfc04 |
.\" getnetent.3 doesn't document any use of h_errno, but nevertheless
|
|
Packit |
7cfc04 |
.\" the nonreentrant functions no seem to set h_errno.
|
|
Packit |
7cfc04 |
.SH RETURN VALUE
|
|
Packit |
7cfc04 |
On success, these functions return 0.
|
|
Packit |
7cfc04 |
On error, they return one of the positive error numbers listed in ERRORS.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
On error, record not found
|
|
Packit |
7cfc04 |
.RB ( getnetbyname_r (),
|
|
Packit |
7cfc04 |
.BR getnetbyaddr_r ()),
|
|
Packit |
7cfc04 |
or end of input
|
|
Packit |
7cfc04 |
.RB ( getnetent_r ())
|
|
Packit |
7cfc04 |
.I result
|
|
Packit |
7cfc04 |
is set to NULL.
|
|
Packit |
7cfc04 |
.SH ERRORS
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.B ENOENT
|
|
Packit |
7cfc04 |
.RB ( getnetent_r ())
|
|
Packit |
7cfc04 |
No more records in database.
|
|
Packit |
7cfc04 |
.TP
|
|
Packit |
7cfc04 |
.B ERANGE
|
|
Packit |
7cfc04 |
.I buf
|
|
Packit |
7cfc04 |
is too small.
|
|
Packit |
7cfc04 |
Try again with a larger buffer
|
|
Packit |
7cfc04 |
(and increased
|
|
Packit |
7cfc04 |
.IR buflen ).
|
|
Packit |
7cfc04 |
.SH ATTRIBUTES
|
|
Packit |
7cfc04 |
For an explanation of the terms used in this section, see
|
|
Packit |
7cfc04 |
.BR attributes (7).
|
|
Packit |
7cfc04 |
.ad l
|
|
Packit |
7cfc04 |
.TS
|
|
Packit |
7cfc04 |
allbox;
|
|
Packit |
7cfc04 |
lbw17 lb lb
|
|
Packit |
7cfc04 |
l l l.
|
|
Packit |
7cfc04 |
Interface Attribute Value
|
|
Packit |
7cfc04 |
T{
|
|
Packit |
7cfc04 |
.BR getnetent_r (),
|
|
Packit |
7cfc04 |
.BR getnetbyname_r (),
|
|
Packit |
7cfc04 |
.BR getnetbyaddr_r ()
|
|
Packit |
7cfc04 |
T} Thread safety MT-Safe locale
|
|
Packit |
7cfc04 |
.TE
|
|
Packit |
7cfc04 |
.ad
|
|
Packit |
7cfc04 |
.SH CONFORMING TO
|
|
Packit |
7cfc04 |
These functions are GNU extensions.
|
|
Packit |
7cfc04 |
Functions with similar names exist on some other systems,
|
|
Packit |
7cfc04 |
though typically with different calling signatures.
|
|
Packit |
7cfc04 |
.SH SEE ALSO
|
|
Packit |
7cfc04 |
.BR getnetent (3),
|
|
Packit |
7cfc04 |
.BR networks (5)
|
|
Packit |
7cfc04 |
.SH COLOPHON
|
|
Packit |
7cfc04 |
This page is part of release 4.15 of the Linux
|
|
Packit |
7cfc04 |
.I man-pages
|
|
Packit |
7cfc04 |
project.
|
|
Packit |
7cfc04 |
A description of the project,
|
|
Packit |
7cfc04 |
information about reporting bugs,
|
|
Packit |
7cfc04 |
and the latest version of this page,
|
|
Packit |
7cfc04 |
can be found at
|
|
Packit |
7cfc04 |
\%https://www.kernel.org/doc/man\-pages/.
|