]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/getnetent_r.3
trunc.3: Make the description a little clearer
[thirdparty/man-pages.git] / man3 / getnetent_r.3
CommitLineData
77f18fb6
MK
1.\" Copyright 2008, Linux Foundation, written by Michael Kerrisk
2.\" <mtk.manpages@gmail.com>
3.\"
93015253 4.\" %%%LICENSE_START(VERBATIM)
77f18fb6
MK
5.\" Permission is granted to make and distribute verbatim copies of this
6.\" manual provided the copyright notice and this permission notice are
7.\" preserved on all copies.
8.\"
9.\" Permission is granted to copy and distribute modified versions of this
10.\" manual under the conditions for verbatim copying, provided that the
11.\" entire resulting derived work is distributed under the terms of a
12.\" permission notice identical to this one.
13.\"
14.\" Since the Linux kernel and libraries are constantly changing, this
15.\" manual page may be incorrect or out-of-date. The author(s) assume no
16.\" responsibility for errors or omissions, or for damages resulting from
17.\" the use of the information contained herein. The author(s) may not
18.\" have taken the same level of care in the production of this manual,
19.\" which is licensed free of charge, as they might when working
20.\" professionally.
21.\"
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 24.\" %%%LICENSE_END
77f18fb6 25.\"
4b8c67d9 26.TH GETNETENT_R 3 2017-09-15 "GNU" "Linux Programmer's Manual"
77f18fb6 27.SH NAME
88850fde 28getnetent_r, getnetbyname_r, getnetbyaddr_r \- get
77f18fb6
MK
29network entry (reentrant)
30.SH SYNOPSIS
31.nf
32.B #include <netdb.h>
68e4db0a 33.PP
77f18fb6
MK
34.BI "int getnetent_r(struct netent *" result_buf ", char *" buf ,
35.BI " size_t " buflen ", struct netent **" result ,
36.BI " int *" h_errnop );
68e4db0a 37.PP
77f18fb6
MK
38.BI "int getnetbyname_r(const char *" name ,
39.BI " struct netent *" result_buf ", char *" buf ,
40.BI " size_t " buflen ", struct netent **" result ,
41.BI " int *" h_errnop );
68e4db0a 42.PP
77f18fb6
MK
43.BI "int getnetbyaddr_r(uint32_t " net ", int " type ,
44.BI " struct netent *" result_buf ", char *" buf ,
45.BI " size_t " buflen ", struct netent **" result ,
46.BI " int *" h_errnop );
68e4db0a 47.PP
77f18fb6
MK
48.fi
49.in -4n
50Feature Test Macro Requirements for glibc (see
51.BR feature_test_macros (7)):
52.ad l
53.in
68e4db0a 54.PP
77f18fb6
MK
55.BR getnetent_r (),
56.BR getnetbyname_r (),
88850fde 57.BR getnetbyaddr_r ():
51c612fb
MK
58 Since glibc 2.19:
59 _DEFAULT_SOURCE
60 Glibc 2.19 and earlier:
61 _BSD_SOURCE || _SVID_SOURCE
77f18fb6
MK
62.ad b
63.SH DESCRIPTION
64The
65.BR getnetent_r (),
66.BR getnetbyname_r (),
67and
88850fde 68.BR getnetbyaddr_r ()
77f18fb6
MK
69functions are the reentrant equivalents of, respectively,
70.BR getnetent (3),
71.BR getnetbyname (3),
72and
73.BR getnetbynumber (3).
74They differ in the way that the
75.I netent
76structure is returned,
77and in the function calling signature and return value.
78This manual page describes just the differences from
54d75d6c 79the nonreentrant functions.
847e0d88 80.PP
77f18fb6
MK
81Instead of returning a pointer to a statically allocated
82.I netent
83structure as the function result,
84these functions copy the structure into the location pointed to by
85.IR result_buf .
847e0d88 86.PP
77f18fb6
MK
87The
88.I buf
89array is used to store the string fields pointed to by the returned
90.I netent
91structure.
54d75d6c 92(The nonreentrant functions allocate these strings in static storage.)
77f18fb6
MK
93The size of this array is specified in
94.IR buflen .
95If
96.I buf
97is too small, the call fails with the error
98.BR ERANGE ,
99and the caller must try again with a larger buffer.
100(A buffer of length 1024 bytes should be sufficient for most applications.)
101.\" I can find no information on the required/recommended buffer size;
54d75d6c 102.\" the nonreentrant functions use a 1024 byte buffer -- mtk.
847e0d88 103.PP
77f18fb6
MK
104If the function call successfully obtains a network record, then
105.I *result
106is set pointing to
107.IR result_buf ;
108otherwise,
109.I *result
110is set to NULL.
847e0d88 111.PP
77f18fb6
MK
112The buffer pointed to by
113.I h_errnop
114is used to return the value that would be stored in the global variable
115.I h_errno
54d75d6c 116by the nonreentrant versions of these functions.
77f18fb6 117.\" getnetent.3 doesn't document any use of h_errno, but nevertheless
54d75d6c 118.\" the nonreentrant functions no seem to set h_errno.
47297adb 119.SH RETURN VALUE
77f18fb6 120On success, these functions return 0.
535f0df5 121On error, they return one of the positive error numbers listed in ERRORS.
847e0d88 122.PP
77f18fb6
MK
123On error, record not found
124.RB ( getnetbyname_r (),
88850fde 125.BR getnetbyaddr_r ()),
77f18fb6
MK
126or end of input
127.RB ( getnetent_r ())
128.I result
129is set to NULL.
130.SH ERRORS
131.TP
132.B ENOENT
133.RB ( getnetent_r ())
134No more records in database.
135.TP
136.B ERANGE
137.I buf
138is too small.
139Try again with a larger buffer
140(and increased
141.IR buflen ).
8eb0dd50
ZL
142.SH ATTRIBUTES
143For an explanation of the terms used in this section, see
144.BR attributes (7).
74714ea8 145.ad l
8eb0dd50
ZL
146.TS
147allbox;
148lbw17 lb lb
149l l l.
150Interface Attribute Value
151T{
152.BR getnetent_r (),
153.BR getnetbyname_r (),
154.BR getnetbyaddr_r ()
155T} Thread safety MT-Safe locale
156.TE
74714ea8 157.ad
47297adb 158.SH CONFORMING TO
77f18fb6
MK
159These functions are GNU extensions.
160Functions with similar names exist on some other systems,
161though typically with different calling signatures.
47297adb 162.SH SEE ALSO
77f18fb6 163.BR getnetent (3),
77f18fb6 164.BR networks (5)