Debian Codegraph @

upstream/debian-trixie/man3/getrpcent_r.3

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