]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/getnetent_r.3
All pages: Remove the 5th argument to .TH
[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.\"
5fbde956 4.\" SPDX-License-Identifier: Linux-man-pages-copyleft
77f18fb6 5.\"
45186a5d 6.TH GETNETENT_R 3 2021-03-22 "Linux man-pages (unreleased)"
77f18fb6 7.SH NAME
88850fde 8getnetent_r, getnetbyname_r, getnetbyaddr_r \- get
77f18fb6 9network entry (reentrant)
42009080
AC
10.SH LIBRARY
11Standard C library
12.RI ( libc ", " \-lc )
77f18fb6
MK
13.SH SYNOPSIS
14.nf
15.B #include <netdb.h>
68e4db0a 16.PP
0bbc1dec
AC
17.BI "int getnetent_r(struct netent *restrict " result_buf ,
18.BI " char *restrict " buf ", size_t " buflen ,
19.BI " struct netent **restrict " result ,
20.BI " int *restrict " h_errnop );
21.BI "int getnetbyname_r(const char *restrict " name ,
22.BI " struct netent *restrict " result_buf ,
23.BI " char *restrict " buf ", size_t " buflen ,
24.BI " struct netent **restrict " result ,
25.BI " int *restrict " h_errnop );
77f18fb6 26.BI "int getnetbyaddr_r(uint32_t " net ", int " type ,
0bbc1dec
AC
27.BI " struct netent *restrict " result_buf ,
28.BI " char *restrict " buf ", size_t " buflen ,
29.BI " struct netent **restrict " result ,
30.BI " int *restrict " h_errnop );
68e4db0a 31.PP
77f18fb6 32.fi
d39ad78f 33.RS -4
77f18fb6
MK
34Feature Test Macro Requirements for glibc (see
35.BR feature_test_macros (7)):
d39ad78f 36.RE
68e4db0a 37.PP
77f18fb6
MK
38.BR getnetent_r (),
39.BR getnetbyname_r (),
88850fde 40.BR getnetbyaddr_r ():
9d2adbae 41.nf
51c612fb
MK
42 Since glibc 2.19:
43 _DEFAULT_SOURCE
44 Glibc 2.19 and earlier:
45 _BSD_SOURCE || _SVID_SOURCE
9d2adbae 46.fi
77f18fb6
MK
47.SH DESCRIPTION
48The
49.BR getnetent_r (),
50.BR getnetbyname_r (),
51and
88850fde 52.BR getnetbyaddr_r ()
77f18fb6
MK
53functions are the reentrant equivalents of, respectively,
54.BR getnetent (3),
55.BR getnetbyname (3),
56and
57.BR getnetbynumber (3).
58They differ in the way that the
59.I netent
60structure is returned,
61and in the function calling signature and return value.
62This manual page describes just the differences from
54d75d6c 63the nonreentrant functions.
847e0d88 64.PP
77f18fb6
MK
65Instead of returning a pointer to a statically allocated
66.I netent
67structure as the function result,
68these functions copy the structure into the location pointed to by
69.IR result_buf .
847e0d88 70.PP
77f18fb6
MK
71The
72.I buf
73array is used to store the string fields pointed to by the returned
74.I netent
75structure.
54d75d6c 76(The nonreentrant functions allocate these strings in static storage.)
77f18fb6
MK
77The size of this array is specified in
78.IR buflen .
79If
80.I buf
81is too small, the call fails with the error
82.BR ERANGE ,
83and the caller must try again with a larger buffer.
84(A buffer of length 1024 bytes should be sufficient for most applications.)
85.\" I can find no information on the required/recommended buffer size;
54d75d6c 86.\" the nonreentrant functions use a 1024 byte buffer -- mtk.
847e0d88 87.PP
77f18fb6
MK
88If the function call successfully obtains a network record, then
89.I *result
90is set pointing to
91.IR result_buf ;
92otherwise,
93.I *result
94is set to NULL.
847e0d88 95.PP
77f18fb6
MK
96The buffer pointed to by
97.I h_errnop
98is used to return the value that would be stored in the global variable
99.I h_errno
54d75d6c 100by the nonreentrant versions of these functions.
77f18fb6 101.\" getnetent.3 doesn't document any use of h_errno, but nevertheless
54d75d6c 102.\" the nonreentrant functions no seem to set h_errno.
47297adb 103.SH RETURN VALUE
77f18fb6 104On success, these functions return 0.
535f0df5 105On error, they return one of the positive error numbers listed in ERRORS.
847e0d88 106.PP
77f18fb6
MK
107On error, record not found
108.RB ( getnetbyname_r (),
88850fde 109.BR getnetbyaddr_r ()),
77f18fb6
MK
110or end of input
111.RB ( getnetent_r ())
112.I result
113is set to NULL.
114.SH ERRORS
115.TP
116.B ENOENT
117.RB ( getnetent_r ())
118No more records in database.
119.TP
120.B ERANGE
121.I buf
122is too small.
123Try again with a larger buffer
124(and increased
125.IR buflen ).
8eb0dd50
ZL
126.SH ATTRIBUTES
127For an explanation of the terms used in this section, see
128.BR attributes (7).
74714ea8 129.ad l
c466875e 130.nh
8eb0dd50
ZL
131.TS
132allbox;
c466875e 133lbx lb lb
8eb0dd50
ZL
134l l l.
135Interface Attribute Value
136T{
137.BR getnetent_r (),
138.BR getnetbyname_r (),
139.BR getnetbyaddr_r ()
140T} Thread safety MT-Safe locale
141.TE
c466875e 142.hy
74714ea8 143.ad
c466875e 144.sp 1
3113c7f3 145.SH STANDARDS
77f18fb6
MK
146These functions are GNU extensions.
147Functions with similar names exist on some other systems,
148though typically with different calling signatures.
47297adb 149.SH SEE ALSO
77f18fb6 150.BR getnetent (3),
77f18fb6 151.BR networks (5)