Debian Codegraph @

upstream/debian-unstable/man3/getrpcent_r.3

raw
1 '\" t
2 .\" Copyright, the authors of the Linux man-pages project
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .TH getrpcent_r 3 2025-06-28 "Linux man-pages 6.18"
7 .SH NAME
8 getrpcent_r, getrpcbyname_r, getrpcbynumber_r \- get
9 RPC entry (reentrant)
10 .SH LIBRARY
11 Standard C library
12 .RI ( libc ,\~ \-lc )
13 .SH SYNOPSIS
14 .nf
15 .B #include <netdb.h>
16 .P
17 .BR "int getrpcent_r(" "size_t size;"
18 .BI " struct rpcent *" result_buf ", char " buf [ size ],
19 .BI " size_t " size ", struct rpcent **" result );
20 .BR "int getrpcbyname_r(" "size_t size;"
21 .BI " const char *" name ,
22 .BI " struct rpcent *" result_buf ", char " buf [ size ],
23 .BI " size_t " size ", struct rpcent **" result );
24 .BR "int getrpcbynumber_r(" "size_t size;"
25 .BI " int " number ,
26 .BI " struct rpcent *" result_buf ", char " buf [ size ],
27 .BI " size_t " size ", struct rpcent **" result );
28 .P
29 .fi
30 .RS -4
31 Feature Test Macro Requirements for glibc (see
32 .BR feature_test_macros (7)):
33 .RE
34 .P
35 .BR getrpcent_r (),
36 .BR getrpcbyname_r (),
37 .BR getrpcbynumber_r ():
38 .nf
39 Since glibc 2.19:
40 _DEFAULT_SOURCE
41 glibc 2.19 and earlier:
42 _BSD_SOURCE || _SVID_SOURCE
43 .fi
44 .SH DESCRIPTION
45 The
46 .BR getrpcent_r (),
47 .BR getrpcbyname_r (),
48 and
49 .BR getrpcbynumber_r ()
50 functions are the reentrant equivalents of, respectively,
51 .BR getrpcent (3),
52 .BR getrpcbyname (3),
53 and
54 .BR getrpcbynumber (3).
55 They differ in the way that the
56 .I rpcent
57 structure is returned,
58 and in the function calling signature and return value.
59 This manual page describes just the differences from
60 the nonreentrant functions.
61 .P
62 Instead of returning a pointer to a statically allocated
63 .I rpcent
64 structure as the function result,
65 these functions copy the structure into the location pointed to by
66 .IR result_buf .
67 .P
68 The
69 .I buf
70 array is used to store the string fields pointed to by the returned
71 .I rpcent
72 structure.
73 (The nonreentrant functions allocate these strings in static storage.)
74 The size of this array is specified in
75 .IR size .
76 If
77 .I buf
78 is too small, the call fails with the error
79 .BR ERANGE ,
80 and the caller must try again with a larger buffer.
81 (A buffer of size 1024 bytes should be sufficient for most applications.)
82 .\" I can find no information on the required/recommended buffer size;
83 .\" the nonreentrant functions use a 1024 byte buffer -- mtk.
84 .P
85 If the function call successfully obtains an RPC record, then
86 .I *result
87 is set pointing to
88 .IR result_buf ;
89 otherwise,
90 .I *result
91 is set to NULL.
92 .SH RETURN VALUE
93 On success, these functions return 0.
94 On error, they return one of the positive error numbers listed in ERRORS.
95 .P
96 On error, record not found
97 .RB ( getrpcbyname_r (),
98 .BR getrpcbynumber_r ()),
99 or end of input
100 .RB ( getrpcent_r ())
101 .I *result
102 is set to NULL.
103 .SH ERRORS
104 .TP
105 .B ENOENT
106 .RB ( getrpcent_r ())
107 No more records in database.
108 .TP
109 .B ERANGE
110 .I buf
111 is too small.
112 Try again with a larger buffer
113 (and increased
114 .IR size ).
115 .SH ATTRIBUTES
116 For an explanation of the terms used in this section, see
117 .BR attributes (7).
118 .TS
119 allbox;
120 lbx lb lb
121 l l l.
122 Interface Attribute Value
123 T{
124 .na
125 .nh
126 .BR getrpcent_r (),
127 .BR getrpcbyname_r (),
128 .BR getrpcbynumber_r ()
129 T} Thread safety MT-Safe locale
130 .TE
131 .SH VERSIONS
132 Functions with similar names exist on some other systems,
133 though typically with different calling signatures.
134 .SH STANDARDS
135 GNU.
136 .SH SEE ALSO
137 .BR getrpcent (3),
138 .BR rpc (5)