1GETNETENT_R(3)             Linux Programmer's Manual            GETNETENT_R(3)
2
3
4

NAME

6       getnetent_r,  getnetbyname_r, getnetbyaddr_r - get network entry (reen‐
7       trant)
8

SYNOPSIS

10       #include <netdb.h>
11
12       int getnetent_r(struct netent *result_buf, char *buf,
13                       size_t buflen, struct netent **result,
14                       int *h_errnop);
15
16       int getnetbyname_r(const char *name,
17                       struct netent *result_buf, char *buf,
18                       size_t buflen, struct netent **result,
19                       int *h_errnop);
20
21       int getnetbyaddr_r(uint32_t net, int type,
22                       struct netent *result_buf, char *buf,
23                       size_t buflen, struct netent **result,
24                       int *h_errnop);
25
26   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
27
28       getnetent_r(), getnetbyname_r(), getnetbyaddr_r(): _BSD_SOURCE ||
29       _SVID_SOURCE
30

DESCRIPTION

32       The getnetent_r(), getnetbyname_r(), and getnetbyaddr_r() functions are
33       the reentrant equivalents  of,  respectively,  getnetent(3),  getnetby‐
34       name(3), and getnetbynumber(3).  They differ in the way that the netent
35       structure is returned, and in the function calling signature and return
36       value.   This  manual page describes just the differences from the non-
37       reentrant functions.
38
39       Instead of returning a pointer to a statically allocated netent  struc‐
40       ture  as  the  function result, these functions copy the structure into
41       the location pointed to by result_buf.
42
43       The buf array is used to store the string  fields  pointed  to  by  the
44       returned netent structure.  (The non-reentrant functions allocate these
45       strings in static storage.)  The size of this  array  is  specified  in
46       buflen.  If buf is too small, the call fails with the error ERANGE, and
47       the caller must try again with a larger buffer.  (A  buffer  of  length
48       1024 bytes should be sufficient for most applications.)
49
50       If  the  function  call  successfully  obtains  a  network record, then
51       *result is set pointing to result_buf; otherwise,  *result  is  set  to
52       NULL.
53
54       The  buffer  pointed  to  by  h_errnop is used to return the value that
55       would be stored in the global variable  h_errno  by  the  non-reentrant
56       versions of these functions.
57

RETURN VALUE

59       On  success, these functions return 0.  On error, a positive error num‐
60       ber is returned.
61
62       On error, record not found (getnetbyname_r(), getnetbyaddr_r()), or end
63       of input (getnetent_r()) result is set to NULL.
64

ERRORS

66       ENOENT (getnetent_r()) No more records in database.
67
68       ERANGE buf is too small.  Try again with a larger buffer (and increased
69              buflen).
70

CONFORMING TO

72       These functions are GNU extensions.  Functions with similar names exist
73       on  some  other systems, though typically with different calling signa‐
74       tures.
75

SEE ALSO

77       getnetent(3), networks(5)
78

COLOPHON

80       This page is part of release 3.22 of the Linux  man-pages  project.   A
81       description  of  the project, and information about reporting bugs, can
82       be found at http://www.kernel.org/doc/man-pages/.
83
84
85
86GNU                               2009-02-21                    GETNETENT_R(3)
Impressum