]>
Commit | Line | Data |
---|---|---|
65382639 MK |
1 | .\" Copyright 2008, Linux Foundation, written by Michael Kerrisk |
2 | .\" <mtk.manpages@gmail.com> | |
3 | .\" | |
93015253 | 4 | .\" %%%LICENSE_START(VERBATIM) |
65382639 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 |
65382639 | 25 | .\" |
4b8c67d9 | 26 | .TH GETRPCENT_R 3 2017-09-15 "GNU" "Linux Programmer's Manual" |
65382639 MK |
27 | .SH NAME |
28 | getrpcent_r, getrpcbyname_r, getrpcbynumber_r \- get | |
29 | RPC entry (reentrant) | |
30 | .SH SYNOPSIS | |
31 | .nf | |
32 | .B #include <netdb.h> | |
68e4db0a | 33 | .PP |
65382639 MK |
34 | .BI "int getrpcent_r(struct rpcent *" result_buf ", char *" buf , |
35 | .BI " size_t " buflen ", struct rpcent **" result ); | |
68e4db0a | 36 | .PP |
65382639 MK |
37 | .BI "int getrpcbyname_r(const char *" name , |
38 | .BI " struct rpcent *" result_buf ", char *" buf , | |
39 | .BI " size_t " buflen ", struct rpcent **" result ); | |
68e4db0a | 40 | .PP |
65382639 MK |
41 | .BI "int getrpcbynumber_r(int " number , |
42 | .BI " struct rpcent *" result_buf ", char *" buf , | |
43 | .BI " size_t " buflen ", struct rpcent **" result ); | |
68e4db0a | 44 | .PP |
65382639 MK |
45 | .fi |
46 | .in -4n | |
47 | Feature Test Macro Requirements for glibc (see | |
48 | .BR feature_test_macros (7)): | |
49 | .ad l | |
50 | .in | |
68e4db0a | 51 | .PP |
65382639 MK |
52 | .BR getrpcent_r (), |
53 | .BR getrpcbyname_r (), | |
54 | .BR getrpcbynumber_r (): | |
51c612fb MK |
55 | Since glibc 2.19: |
56 | _DEFAULT_SOURCE | |
57 | Glibc 2.19 and earlier: | |
58 | _BSD_SOURCE || _SVID_SOURCE | |
65382639 MK |
59 | .ad b |
60 | .SH DESCRIPTION | |
61 | The | |
62 | .BR getrpcent_r (), | |
63 | .BR getrpcbyname_r (), | |
64 | and | |
65 | .BR getrpcbynumber_r () | |
66 | functions are the reentrant equivalents of, respectively, | |
67 | .BR getrpcent (3), | |
68 | .BR getrpcbyname (3), | |
69 | and | |
70 | .BR getrpcbynumber (3). | |
71 | They differ in the way that the | |
72 | .I rpcent | |
73 | structure is returned, | |
74 | and in the function calling signature and return value. | |
75 | This manual page describes just the differences from | |
54d75d6c | 76 | the nonreentrant functions. |
847e0d88 | 77 | .PP |
65382639 MK |
78 | Instead of returning a pointer to a statically allocated |
79 | .I rpcent | |
80 | structure as the function result, | |
81 | these functions copy the structure into the location pointed to by | |
82 | .IR result_buf . | |
847e0d88 | 83 | .PP |
65382639 MK |
84 | The |
85 | .I buf | |
86 | array is used to store the string fields pointed to by the returned | |
87 | .I rpcent | |
88 | structure. | |
54d75d6c | 89 | (The nonreentrant functions allocate these strings in static storage.) |
65382639 MK |
90 | The size of this array is specified in |
91 | .IR buflen . | |
92 | If | |
93 | .I buf | |
94 | is too small, the call fails with the error | |
95 | .BR ERANGE , | |
96 | and the caller must try again with a larger buffer. | |
97 | (A buffer of length 1024 bytes should be sufficient for most applications.) | |
98 | .\" I can find no information on the required/recommended buffer size; | |
54d75d6c | 99 | .\" the nonreentrant functions use a 1024 byte buffer -- mtk. |
847e0d88 | 100 | .PP |
65382639 MK |
101 | If the function call successfully obtains an RPC record, then |
102 | .I *result | |
103 | is set pointing to | |
104 | .IR result_buf ; | |
105 | otherwise, | |
106 | .I *result | |
107 | is set to NULL. | |
47297adb | 108 | .SH RETURN VALUE |
65382639 | 109 | On success, these functions return 0. |
535f0df5 | 110 | On error, they return one of the positive error numbers listed in ERRORS. |
847e0d88 | 111 | .PP |
65382639 MK |
112 | On error, record not found |
113 | .RB ( getrpcbyname_r (), | |
114 | .BR getrpcbynumber_r ()), | |
115 | or end of input | |
116 | .RB ( getrpcent_r ()) | |
117 | .I result | |
118 | is set to NULL. | |
119 | .SH ERRORS | |
120 | .TP | |
121 | .B ENOENT | |
122 | .RB ( getrpcent_r ()) | |
123 | No more records in database. | |
124 | .TP | |
125 | .B ERANGE | |
126 | .I buf | |
127 | is too small. | |
128 | Try again with a larger buffer | |
129 | (and increased | |
130 | .IR buflen ). | |
0a167f31 ZL |
131 | .SH ATTRIBUTES |
132 | For an explanation of the terms used in this section, see | |
133 | .BR attributes (7). | |
74714ea8 | 134 | .ad l |
0a167f31 ZL |
135 | .TS |
136 | allbox; | |
137 | lbw19 lb lb | |
138 | l l l. | |
139 | Interface Attribute Value | |
140 | T{ | |
141 | .BR getrpcent_r (), | |
142 | .BR getrpcbyname_r (), | |
143 | .BR getrpcbynumber_r () | |
144 | T} Thread safety MT-Safe locale | |
145 | .TE | |
74714ea8 | 146 | .ad |
47297adb | 147 | .SH CONFORMING TO |
65382639 MK |
148 | These functions are GNU extensions. |
149 | Functions with similar names exist on some other systems, | |
150 | though typically with different calling signatures. | |
47297adb | 151 | .SH SEE ALSO |
65382639 | 152 | .BR getrpcent (3), |
65382639 | 153 | .BR rpc (5) |