This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
reentr.h: Add way to see if reentrant used
[perl5.git] / reentr.h
CommitLineData
37442d52
RGS
1/* -*- buffer-read-only: t -*-
2 *
10bc17b6
JH
3 * reentr.h
4 *
922adc66 5 * Copyright (C) 2002, 2003, 2005, 2006, 2007 by Larry Wall and others
10bc17b6
JH
6 *
7 * You may distribute under the terms of either the GNU General Public
8 * License or the Artistic License, as specified in the README file.
9 *
78102347
NC
10 * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
11 * This file is built by regen/reentr.pl from data in regen/reentr.pl.
12 * Any changes made here will be lost!
10bc17b6
JH
13 */
14
6a5bc5ac
KW
15#ifndef PERL_REENTR_H_
16#define PERL_REENTR_H_
10bc17b6 17
a3dd3f83
MB
18/* If compiling for a threaded perl, we will macro-wrap the system/library
19 * interfaces (e.g. getpwent()) which have threaded versions
20 * (e.g. getpwent_r()), which will handle things correctly for
6f16cbe7
KW
21 * the Perl interpreter. This is done automatically for the perl core and
22 * extensions, but not generally for XS modules unless they
23 * #define PERL_REENTRANT
24 * See L<perlxs/Thread-aware system interfaces>.
7dc0f1bb
KW
25 *
26 * For a function 'foo', use the compile-time directive
27 * #ifdef PERL_REENTR_USING_FOO_R
28 * to test if the function actually did get replaced by the reentrant version.
29 * (If it isn't getting replaced, it might mean it uses a different prototype
30 * on the given platform than any we are expecting. To fix that, add the
31 * prototype to the __DATA__ section of regen/reentr.pl.)
a3dd3f83
MB
32 */
33
34#ifndef PERL_REENTR_API
7c1815b7
KW
35# if defined(PERL_CORE) || defined(PERL_EXT) || defined(PERL_REENTRANT)
36# define PERL_REENTR_API 1
37# else
38# define PERL_REENTR_API 0
39# endif
a3dd3f83
MB
40#endif
41
10bc17b6 42#ifdef USE_REENTRANT_API
7c1815b7 43
10bc17b6
JH
44/* Deprecations: some platforms have the said reentrant interfaces
45 * but they are declared obsolete and are not to be used. Often this
46 * means that the platform has threadsafed the interfaces (hopefully).
47 * All this is OS version dependent, so we are of course fooling ourselves.
a3dd3f83
MB
48 * If you know of more deprecations on some platforms, please add your own
49 * (by editing reentr.pl, mind!) */
10bc17b6 50
7c1815b7
KW
51# ifdef __hpux
52# undef HAS_CRYPT_R
53# undef HAS_ENDGRENT_R
54# undef HAS_ENDPWENT_R
55# undef HAS_GETGRENT_R
56# undef HAS_GETPWENT_R
57# undef HAS_SETLOCALE_R
58# undef HAS_STRERROR_R
59# define NETDB_R_OBSOLETE
60# endif
10bc17b6 61
7c1815b7
KW
62# if defined(__osf__) && defined(__alpha) /* Tru64 aka Digital UNIX */
63# undef HAS_CRYPT_R
64# undef HAS_STRERROR_R
65# define NETDB_R_OBSOLETE
66# endif
10bc17b6 67
7c1815b7
KW
68# if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 24))
69# undef HAS_READDIR_R
70# undef HAS_READDIR64_R
71# endif
c6709bf9 72
d4b8ffd7
RGS
73/*
74 * As of OpenBSD 3.7, reentrant functions are now working, they just are
75 * incompatible with everyone else. To make OpenBSD happy, we have to
76 * memzero out certain structures before calling the functions.
77 */
7c1815b7 78# if defined(__OpenBSD__)
3fb2f3ac 79# define REENTR_MEMZERO(a,b) memzero(a,b)
7c1815b7 80# else
3fb2f3ac 81# define REENTR_MEMZERO(a,b) 0
7c1815b7 82# endif
10bc17b6 83
7c1815b7
KW
84# ifdef NETDB_R_OBSOLETE
85# undef HAS_ENDHOSTENT_R
86# undef HAS_ENDNETENT_R
87# undef HAS_ENDPROTOENT_R
88# undef HAS_ENDSERVENT_R
89# undef HAS_GETHOSTBYADDR_R
90# undef HAS_GETHOSTBYNAME_R
91# undef HAS_GETHOSTENT_R
92# undef HAS_GETNETBYADDR_R
93# undef HAS_GETNETBYNAME_R
94# undef HAS_GETNETENT_R
95# undef HAS_GETPROTOBYNAME_R
96# undef HAS_GETPROTOBYNUMBER_R
97# undef HAS_GETPROTOENT_R
98# undef HAS_GETSERVBYNAME_R
99# undef HAS_GETSERVBYPORT_R
100# undef HAS_GETSERVENT_R
101# undef HAS_SETHOSTENT_R
102# undef HAS_SETNETENT_R
103# undef HAS_SETPROTOENT_R
104# undef HAS_SETSERVENT_R
105# endif
106
107# ifdef I_PWD
108# include <pwd.h>
109# endif
110# ifdef I_GRP
111# include <grp.h>
112# endif
113# ifdef I_NETDB
114# include <netdb.h>
115# endif
116# ifdef I_CRYPT
117# ifdef I_CRYPT
118# include <crypt.h>
119# endif
120# endif
121# ifdef HAS_GETSPNAM_R
122# ifdef I_SHADOW
123# include <shadow.h>
124# endif
125# endif
10bc17b6 126
7c1815b7
KW
127# define REENTRANT_PROTO_B_B 1
128# define REENTRANT_PROTO_B_BI 2
129# define REENTRANT_PROTO_B_BW 3
130# define REENTRANT_PROTO_B_CCD 4
131# define REENTRANT_PROTO_B_CCS 5
132# define REENTRANT_PROTO_B_IBI 6
133# define REENTRANT_PROTO_B_IBW 7
134# define REENTRANT_PROTO_B_SB 8
135# define REENTRANT_PROTO_B_SBI 9
136# define REENTRANT_PROTO_I_BI 10
137# define REENTRANT_PROTO_I_BW 11
138# define REENTRANT_PROTO_I_CCSBWR 12
139# define REENTRANT_PROTO_I_CCSD 13
140# define REENTRANT_PROTO_I_CII 14
141# define REENTRANT_PROTO_I_CIISD 15
142# define REENTRANT_PROTO_I_CSBI 16
143# define REENTRANT_PROTO_I_CSBIR 17
144# define REENTRANT_PROTO_I_CSBWR 18
145# define REENTRANT_PROTO_I_CSBWRE 19
146# define REENTRANT_PROTO_I_CSD 20
147# define REENTRANT_PROTO_I_CWISBWRE 21
148# define REENTRANT_PROTO_I_CWISD 22
149# define REENTRANT_PROTO_I_D 23
150# define REENTRANT_PROTO_I_H 24
151# define REENTRANT_PROTO_I_IBI 25
152# define REENTRANT_PROTO_I_IBW 26
153# define REENTRANT_PROTO_I_ICBI 27
154# define REENTRANT_PROTO_I_ICSBWR 28
155# define REENTRANT_PROTO_I_ICSD 29
156# define REENTRANT_PROTO_I_ID 30
157# define REENTRANT_PROTO_I_IISD 31
158# define REENTRANT_PROTO_I_ISBWR 32
159# define REENTRANT_PROTO_I_ISD 33
160# define REENTRANT_PROTO_I_LISBI 34
161# define REENTRANT_PROTO_I_LISD 35
162# define REENTRANT_PROTO_I_SB 36
163# define REENTRANT_PROTO_I_SBI 37
164# define REENTRANT_PROTO_I_SBIE 38
165# define REENTRANT_PROTO_I_SBIH 39
166# define REENTRANT_PROTO_I_SBIR 40
167# define REENTRANT_PROTO_I_SBWR 41
168# define REENTRANT_PROTO_I_SBWRE 42
169# define REENTRANT_PROTO_I_SD 43
170# define REENTRANT_PROTO_I_TISD 44
171# define REENTRANT_PROTO_I_TS 45
172# define REENTRANT_PROTO_I_TSBI 46
173# define REENTRANT_PROTO_I_TSBIR 47
174# define REENTRANT_PROTO_I_TSBWR 48
175# define REENTRANT_PROTO_I_TSR 49
176# define REENTRANT_PROTO_I_TsISBWRE 50
177# define REENTRANT_PROTO_I_UISBWRE 51
178# define REENTRANT_PROTO_I_uISBWRE 52
179# define REENTRANT_PROTO_S_CBI 53
180# define REENTRANT_PROTO_S_CCSBI 54
181# define REENTRANT_PROTO_S_CIISBIE 55
182# define REENTRANT_PROTO_S_CSBI 56
183# define REENTRANT_PROTO_S_CSBIE 57
184# define REENTRANT_PROTO_S_CWISBIE 58
185# define REENTRANT_PROTO_S_CWISBWIE 59
186# define REENTRANT_PROTO_S_ICSBI 60
187# define REENTRANT_PROTO_S_ISBI 61
188# define REENTRANT_PROTO_S_LISBI 62
189# define REENTRANT_PROTO_S_SBI 63
190# define REENTRANT_PROTO_S_SBIE 64
191# define REENTRANT_PROTO_S_SBW 65
192# define REENTRANT_PROTO_S_TISBI 66
193# define REENTRANT_PROTO_S_TSBI 67
194# define REENTRANT_PROTO_S_TSBIE 68
195# define REENTRANT_PROTO_S_TWISBIE 69
196# define REENTRANT_PROTO_V_D 70
197# define REENTRANT_PROTO_V_H 71
198# define REENTRANT_PROTO_V_ID 72
10bc17b6
JH
199
200/* Defines for indicating which special features are supported. */
201
edd309b7
JH
202/* The getgrent getgrgid getgrnam using buffer? */
203
7c1815b7
KW
204# if defined(HAS_GETGRENT_R) && (GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBWR || GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBIR || GETGRENT_R_PROTO == REENTRANT_PROTO_S_SBW || GETGRENT_R_PROTO == REENTRANT_PROTO_S_SBI || GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBI || GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBIH)
205# define GETGRENT_R_HAS_BUFFER
206# else
207# undef GETGRENT_R_HAS_BUFFER
208# endif
209# if defined(HAS_GETGRGID_R) && (GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBWR || GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBIR || GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBI || GETGRGID_R_PROTO == REENTRANT_PROTO_S_TSBI)
210# define GETGRGID_R_HAS_BUFFER
211# else
212# undef GETGRGID_R_HAS_BUFFER
213# endif
214# if defined(HAS_GETGRNAM_R) && (GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR || GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBIR || GETGRNAM_R_PROTO == REENTRANT_PROTO_S_CBI || GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBI || GETGRNAM_R_PROTO == REENTRANT_PROTO_S_CSBI)
215# define GETGRNAM_R_HAS_BUFFER
216# else
217# undef GETGRNAM_R_HAS_BUFFER
218# endif
edd309b7
JH
219
220/* Any of the getgrent getgrgid getgrnam using buffer? */
221
7c1815b7
KW
222# if (defined(GETGRENT_R_HAS_BUFFER) || defined(GETGRGID_R_HAS_BUFFER) || defined(GETGRNAM_R_HAS_BUFFER))
223# define USE_GRENT_BUFFER
224# else
225# undef USE_GRENT_BUFFER
226# endif
edd309b7 227
10bc17b6
JH
228/* The getgrent getgrgid getgrnam using ptr? */
229
7c1815b7
KW
230# if defined(HAS_GETGRENT_R) && (GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBWR || GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBIR)
231# define GETGRENT_R_HAS_PTR
232# else
233# undef GETGRENT_R_HAS_PTR
234# endif
235# if defined(HAS_GETGRGID_R) && (GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBWR || GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBIR)
236# define GETGRGID_R_HAS_PTR
237# else
238# undef GETGRGID_R_HAS_PTR
239# endif
240# if defined(HAS_GETGRNAM_R) && (GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR || GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBIR)
241# define GETGRNAM_R_HAS_PTR
242# else
243# undef GETGRNAM_R_HAS_PTR
244# endif
10bc17b6
JH
245
246/* Any of the getgrent getgrgid getgrnam using ptr? */
247
7c1815b7
KW
248# if (defined(GETGRENT_R_HAS_PTR) || defined(GETGRGID_R_HAS_PTR) || defined(GETGRNAM_R_HAS_PTR))
249# define USE_GRENT_PTR
250# else
251# undef USE_GRENT_PTR
252# endif
10bc17b6
JH
253
254/* The getpwent getpwnam getpwuid using ptr? */
255
7c1815b7
KW
256# if defined(HAS_GETPWENT_R) && (GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBWR || GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBIR)
257# define GETPWENT_R_HAS_PTR
258# else
259# undef GETPWENT_R_HAS_PTR
260# endif
261# if defined(HAS_GETPWNAM_R) && (GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR || GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBIR)
262# define GETPWNAM_R_HAS_PTR
263# else
264# undef GETPWNAM_R_HAS_PTR
265# endif
266# if defined(HAS_GETPWUID_R) && (GETPWUID_R_PROTO == REENTRANT_PROTO_I_TSBWR || GETPWUID_R_PROTO == REENTRANT_PROTO_I_TSBIR)
267# define GETPWUID_R_HAS_PTR
268# else
269# undef GETPWUID_R_HAS_PTR
270# endif
10bc17b6
JH
271
272/* Any of the getpwent getpwnam getpwuid using ptr? */
273
7c1815b7
KW
274# if (defined(GETPWENT_R_HAS_PTR) || defined(GETPWNAM_R_HAS_PTR) || defined(GETPWUID_R_HAS_PTR))
275# define USE_PWENT_PTR
276# else
277# undef USE_PWENT_PTR
278# endif
10bc17b6
JH
279
280/* The getspent getspnam using ptr? */
281
7c1815b7
KW
282# if defined(HAS_GETSPNAM_R) && (GETSPNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR)
283# define GETSPNAM_R_HAS_PTR
284# else
285# undef GETSPNAM_R_HAS_PTR
286# endif
10bc17b6
JH
287
288/* Any of the getspent getspnam using ptr? */
289
7c1815b7
KW
290# if (defined(GETSPENT_R_HAS_PTR) || defined(GETSPNAM_R_HAS_PTR))
291# define USE_SPENT_PTR
292# else
293# undef USE_SPENT_PTR
294# endif
10bc17b6 295
f7937171 296/* The getgrent getgrgid getgrnam setgrent endgrent using fptr? */
10bc17b6 297
7c1815b7
KW
298# if defined(HAS_GETGRENT_R) && (GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBIH)
299# define GETGRENT_R_HAS_FPTR
300# else
301# undef GETGRENT_R_HAS_FPTR
302# endif
303# if defined(HAS_SETGRENT_R) && (SETGRENT_R_PROTO == REENTRANT_PROTO_I_H || SETGRENT_R_PROTO == REENTRANT_PROTO_V_H)
304# define SETGRENT_R_HAS_FPTR
305# else
306# undef SETGRENT_R_HAS_FPTR
307# endif
308# if defined(HAS_ENDGRENT_R) && (ENDGRENT_R_PROTO == REENTRANT_PROTO_I_H || ENDGRENT_R_PROTO == REENTRANT_PROTO_V_H)
309# define ENDGRENT_R_HAS_FPTR
310# else
311# undef ENDGRENT_R_HAS_FPTR
312# endif
10bc17b6 313
f7937171 314/* Any of the getgrent getgrgid getgrnam setgrent endgrent using fptr? */
10bc17b6 315
7c1815b7
KW
316# if (defined(GETGRENT_R_HAS_FPTR) || defined(GETGRGID_R_HAS_FPTR) || defined(GETGRNAM_R_HAS_FPTR) || defined(SETGRENT_R_HAS_FPTR) || defined(ENDGRENT_R_HAS_FPTR))
317# define USE_GRENT_FPTR
318# else
319# undef USE_GRENT_FPTR
320# endif
10bc17b6 321
f7937171 322/* The getpwent getpwnam getpwuid setpwent endpwent using fptr? */
10bc17b6 323
7c1815b7
KW
324# if defined(HAS_GETPWENT_R) && (GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBIH)
325# define GETPWENT_R_HAS_FPTR
326# else
327# undef GETPWENT_R_HAS_FPTR
328# endif
329# if defined(HAS_SETPWENT_R) && (SETPWENT_R_PROTO == REENTRANT_PROTO_I_H || SETPWENT_R_PROTO == REENTRANT_PROTO_V_H)
330# define SETPWENT_R_HAS_FPTR
331# else
332# undef SETPWENT_R_HAS_FPTR
333# endif
334# if defined(HAS_ENDPWENT_R) && (ENDPWENT_R_PROTO == REENTRANT_PROTO_I_H || ENDPWENT_R_PROTO == REENTRANT_PROTO_V_H)
335# define ENDPWENT_R_HAS_FPTR
336# else
337# undef ENDPWENT_R_HAS_FPTR
338# endif
10bc17b6 339
f7937171 340/* Any of the getpwent getpwnam getpwuid setpwent endpwent using fptr? */
10bc17b6 341
7c1815b7
KW
342# if (defined(GETPWENT_R_HAS_FPTR) || defined(GETPWNAM_R_HAS_FPTR) || defined(GETPWUID_R_HAS_FPTR) || defined(SETPWENT_R_HAS_FPTR) || defined(ENDPWENT_R_HAS_FPTR))
343# define USE_PWENT_FPTR
344# else
345# undef USE_PWENT_FPTR
346# endif
10bc17b6 347
edd309b7
JH
348/* The getpwent getpwgid getpwnam using buffer? */
349
7c1815b7
KW
350# if defined(HAS_GETPWENT_R) && (GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBWR || GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBIR || GETPWENT_R_PROTO == REENTRANT_PROTO_S_SBW || GETPWENT_R_PROTO == REENTRANT_PROTO_S_SBI || GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBI || GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBIH)
351# define GETPWENT_R_HAS_BUFFER
352# else
353# undef GETPWENT_R_HAS_BUFFER
354# endif
355# if defined(HAS_GETPWNAM_R) && (GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR || GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBIR || GETPWNAM_R_PROTO == REENTRANT_PROTO_S_CSBI || GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBI)
356# define GETPWNAM_R_HAS_BUFFER
357# else
358# undef GETPWNAM_R_HAS_BUFFER
359# endif
edd309b7
JH
360
361/* Any of the getpwent getpwgid getpwnam using buffer? */
362
7c1815b7
KW
363# if (defined(GETPWENT_R_HAS_BUFFER) || defined(GETPWGID_R_HAS_BUFFER) || defined(GETPWNAM_R_HAS_BUFFER))
364# define USE_PWENT_BUFFER
365# else
366# undef USE_PWENT_BUFFER
367# endif
edd309b7 368
5baa389e
KW
369/* The getspent getspnam using buffer? */
370
371# if defined(HAS_GETSPNAM_R) && (GETSPNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR || GETSPNAM_R_PROTO == REENTRANT_PROTO_S_CSBI)
372# define GETSPNAM_R_HAS_BUFFER
373# else
374# undef GETSPNAM_R_HAS_BUFFER
375# endif
376
377/* Any of the getspent getspnam using buffer? */
378
379# if (defined(GETSPENT_R_HAS_BUFFER) || defined(GETSPNAM_R_HAS_BUFFER))
380# define USE_SPENT_BUFFER
381# else
382# undef USE_SPENT_BUFFER
383# endif
384
10bc17b6
JH
385/* The gethostent gethostbyaddr gethostbyname using ptr? */
386
7c1815b7
KW
387# if defined(HAS_GETHOSTENT_R) && (GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBWRE)
388# define GETHOSTENT_R_HAS_PTR
389# else
390# undef GETHOSTENT_R_HAS_PTR
391# endif
392# if defined(HAS_GETHOSTBYADDR_R) && (GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_CWISBWRE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_TsISBWRE)
393# define GETHOSTBYADDR_R_HAS_PTR
394# else
395# undef GETHOSTBYADDR_R_HAS_PTR
396# endif
397# if defined(HAS_GETHOSTBYNAME_R) && (GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE)
398# define GETHOSTBYNAME_R_HAS_PTR
399# else
400# undef GETHOSTBYNAME_R_HAS_PTR
401# endif
10bc17b6
JH
402
403/* Any of the gethostent gethostbyaddr gethostbyname using ptr? */
404
7c1815b7
KW
405# if (defined(GETHOSTENT_R_HAS_PTR) || defined(GETHOSTBYADDR_R_HAS_PTR) || defined(GETHOSTBYNAME_R_HAS_PTR))
406# define USE_HOSTENT_PTR
407# else
408# undef USE_HOSTENT_PTR
409# endif
10bc17b6
JH
410
411/* The getnetent getnetbyaddr getnetbyname using ptr? */
412
7c1815b7
KW
413# if defined(HAS_GETNETENT_R) && (GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBWRE)
414# define GETNETENT_R_HAS_PTR
415# else
416# undef GETNETENT_R_HAS_PTR
417# endif
418# if defined(HAS_GETNETBYADDR_R) && (GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_UISBWRE || GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_uISBWRE)
419# define GETNETBYADDR_R_HAS_PTR
420# else
421# undef GETNETBYADDR_R_HAS_PTR
422# endif
423# if defined(HAS_GETNETBYNAME_R) && (GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE)
424# define GETNETBYNAME_R_HAS_PTR
425# else
426# undef GETNETBYNAME_R_HAS_PTR
427# endif
10bc17b6
JH
428
429/* Any of the getnetent getnetbyaddr getnetbyname using ptr? */
430
7c1815b7
KW
431# if (defined(GETNETENT_R_HAS_PTR) || defined(GETNETBYADDR_R_HAS_PTR) || defined(GETNETBYNAME_R_HAS_PTR))
432# define USE_NETENT_PTR
433# else
434# undef USE_NETENT_PTR
435# endif
10bc17b6
JH
436
437/* The getprotoent getprotobyname getprotobynumber using ptr? */
438
7c1815b7
KW
439# if defined(HAS_GETPROTOENT_R) && (GETPROTOENT_R_PROTO == REENTRANT_PROTO_I_SBWR)
440# define GETPROTOENT_R_HAS_PTR
441# else
442# undef GETPROTOENT_R_HAS_PTR
443# endif
444# if defined(HAS_GETPROTOBYNAME_R) && (GETPROTOBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWR)
445# define GETPROTOBYNAME_R_HAS_PTR
446# else
447# undef GETPROTOBYNAME_R_HAS_PTR
448# endif
449# if defined(HAS_GETPROTOBYNUMBER_R) && (GETPROTOBYNUMBER_R_PROTO == REENTRANT_PROTO_I_ISBWR)
450# define GETPROTOBYNUMBER_R_HAS_PTR
451# else
452# undef GETPROTOBYNUMBER_R_HAS_PTR
453# endif
10bc17b6
JH
454
455/* Any of the getprotoent getprotobyname getprotobynumber using ptr? */
456
7c1815b7
KW
457# if (defined(GETPROTOENT_R_HAS_PTR) || defined(GETPROTOBYNAME_R_HAS_PTR) || defined(GETPROTOBYNUMBER_R_HAS_PTR))
458# define USE_PROTOENT_PTR
459# else
460# undef USE_PROTOENT_PTR
461# endif
10bc17b6
JH
462
463/* The getservent getservbyname getservbyport using ptr? */
464
7c1815b7
KW
465# if defined(HAS_GETSERVENT_R) && (GETSERVENT_R_PROTO == REENTRANT_PROTO_I_SBWR)
466# define GETSERVENT_R_HAS_PTR
467# else
468# undef GETSERVENT_R_HAS_PTR
469# endif
470# if defined(HAS_GETSERVBYNAME_R) && (GETSERVBYNAME_R_PROTO == REENTRANT_PROTO_I_CCSBWR)
471# define GETSERVBYNAME_R_HAS_PTR
472# else
473# undef GETSERVBYNAME_R_HAS_PTR
474# endif
475# if defined(HAS_GETSERVBYPORT_R) && (GETSERVBYPORT_R_PROTO == REENTRANT_PROTO_I_ICSBWR)
476# define GETSERVBYPORT_R_HAS_PTR
477# else
478# undef GETSERVBYPORT_R_HAS_PTR
479# endif
10bc17b6
JH
480
481/* Any of the getservent getservbyname getservbyport using ptr? */
482
7c1815b7
KW
483# if (defined(GETSERVENT_R_HAS_PTR) || defined(GETSERVBYNAME_R_HAS_PTR) || defined(GETSERVBYPORT_R_HAS_PTR))
484# define USE_SERVENT_PTR
485# else
486# undef USE_SERVENT_PTR
487# endif
10bc17b6 488
edd309b7
JH
489/* The gethostent gethostbyaddr gethostbyname using buffer? */
490
7c1815b7
KW
491# if defined(HAS_GETHOSTENT_R) && (GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBWRE || GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBIE || GETHOSTENT_R_PROTO == REENTRANT_PROTO_S_SBIE || GETHOSTENT_R_PROTO == REENTRANT_PROTO_S_SBI || GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBI)
492# define GETHOSTENT_R_HAS_BUFFER
493# else
494# undef GETHOSTENT_R_HAS_BUFFER
495# endif
496# if defined(HAS_GETHOSTBYADDR_R) && (GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_CWISBWRE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CWISBWIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CWISBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_TWISBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CIISBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CSBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_TSBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_TsISBWRE)
497# define GETHOSTBYADDR_R_HAS_BUFFER
498# else
499# undef GETHOSTBYADDR_R_HAS_BUFFER
500# endif
501# if defined(HAS_GETHOSTBYNAME_R) && (GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE || GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_S_CSBIE)
502# define GETHOSTBYNAME_R_HAS_BUFFER
503# else
504# undef GETHOSTBYNAME_R_HAS_BUFFER
505# endif
edd309b7
JH
506
507/* Any of the gethostent gethostbyaddr gethostbyname using buffer? */
508
7c1815b7
KW
509# if (defined(GETHOSTENT_R_HAS_BUFFER) || defined(GETHOSTBYADDR_R_HAS_BUFFER) || defined(GETHOSTBYNAME_R_HAS_BUFFER))
510# define USE_HOSTENT_BUFFER
511# else
512# undef USE_HOSTENT_BUFFER
513# endif
edd309b7
JH
514
515/* The getnetent getnetbyaddr getnetbyname using buffer? */
516
7c1815b7
KW
517# if defined(HAS_GETNETENT_R) && (GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBWRE || GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBIE || GETNETENT_R_PROTO == REENTRANT_PROTO_S_SBIE || GETNETENT_R_PROTO == REENTRANT_PROTO_S_SBI || GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBI)
518# define GETNETENT_R_HAS_BUFFER
519# else
520# undef GETNETENT_R_HAS_BUFFER
521# endif
522# if defined(HAS_GETNETBYADDR_R) && (GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_UISBWRE || GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_LISBI || GETNETBYADDR_R_PROTO == REENTRANT_PROTO_S_TISBI || GETNETBYADDR_R_PROTO == REENTRANT_PROTO_S_LISBI || GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_uISBWRE)
523# define GETNETBYADDR_R_HAS_BUFFER
524# else
525# undef GETNETBYADDR_R_HAS_BUFFER
526# endif
527# if defined(HAS_GETNETBYNAME_R) && (GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE || GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBI || GETNETBYNAME_R_PROTO == REENTRANT_PROTO_S_CSBI)
528# define GETNETBYNAME_R_HAS_BUFFER
529# else
530# undef GETNETBYNAME_R_HAS_BUFFER
531# endif
edd309b7
JH
532
533/* Any of the getnetent getnetbyaddr getnetbyname using buffer? */
534
7c1815b7
KW
535# if (defined(GETNETENT_R_HAS_BUFFER) || defined(GETNETBYADDR_R_HAS_BUFFER) || defined(GETNETBYNAME_R_HAS_BUFFER))
536# define USE_NETENT_BUFFER
537# else
538# undef USE_NETENT_BUFFER
539# endif
edd309b7
JH
540
541/* The getprotoent getprotobyname getprotobynumber using buffer? */
542
7c1815b7
KW
543# if defined(HAS_GETPROTOENT_R) && (GETPROTOENT_R_PROTO == REENTRANT_PROTO_I_SBWR || GETPROTOENT_R_PROTO == REENTRANT_PROTO_I_SBI || GETPROTOENT_R_PROTO == REENTRANT_PROTO_S_SBI)
544# define GETPROTOENT_R_HAS_BUFFER
545# else
546# undef GETPROTOENT_R_HAS_BUFFER
547# endif
548# if defined(HAS_GETPROTOBYNAME_R) && (GETPROTOBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWR || GETPROTOBYNAME_R_PROTO == REENTRANT_PROTO_S_CSBI)
549# define GETPROTOBYNAME_R_HAS_BUFFER
550# else
551# undef GETPROTOBYNAME_R_HAS_BUFFER
552# endif
553# if defined(HAS_GETPROTOBYNUMBER_R) && (GETPROTOBYNUMBER_R_PROTO == REENTRANT_PROTO_I_ISBWR || GETPROTOBYNUMBER_R_PROTO == REENTRANT_PROTO_S_ISBI)
554# define GETPROTOBYNUMBER_R_HAS_BUFFER
555# else
556# undef GETPROTOBYNUMBER_R_HAS_BUFFER
557# endif
edd309b7
JH
558
559/* Any of the getprotoent getprotobyname getprotobynumber using buffer? */
560
7c1815b7
KW
561# if (defined(GETPROTOENT_R_HAS_BUFFER) || defined(GETPROTOBYNAME_R_HAS_BUFFER) || defined(GETPROTOBYNUMBER_R_HAS_BUFFER))
562# define USE_PROTOENT_BUFFER
563# else
564# undef USE_PROTOENT_BUFFER
565# endif
edd309b7
JH
566
567/* The getservent getservbyname getservbyport using buffer? */
568
7c1815b7
KW
569# if defined(HAS_GETSERVENT_R) && (GETSERVENT_R_PROTO == REENTRANT_PROTO_I_SBWR || GETSERVENT_R_PROTO == REENTRANT_PROTO_I_SBI || GETSERVENT_R_PROTO == REENTRANT_PROTO_S_SBI)
570# define GETSERVENT_R_HAS_BUFFER
571# else
572# undef GETSERVENT_R_HAS_BUFFER
573# endif
574# if defined(HAS_GETSERVBYNAME_R) && (GETSERVBYNAME_R_PROTO == REENTRANT_PROTO_I_CCSBWR || GETSERVBYNAME_R_PROTO == REENTRANT_PROTO_S_CCSBI)
575# define GETSERVBYNAME_R_HAS_BUFFER
576# else
577# undef GETSERVBYNAME_R_HAS_BUFFER
578# endif
579# if defined(HAS_GETSERVBYPORT_R) && (GETSERVBYPORT_R_PROTO == REENTRANT_PROTO_I_ICSBWR || GETSERVBYPORT_R_PROTO == REENTRANT_PROTO_S_ICSBI)
580# define GETSERVBYPORT_R_HAS_BUFFER
581# else
582# undef GETSERVBYPORT_R_HAS_BUFFER
583# endif
edd309b7
JH
584
585/* Any of the getservent getservbyname getservbyport using buffer? */
586
7c1815b7
KW
587# if (defined(GETSERVENT_R_HAS_BUFFER) || defined(GETSERVBYNAME_R_HAS_BUFFER) || defined(GETSERVBYPORT_R_HAS_BUFFER))
588# define USE_SERVENT_BUFFER
589# else
590# undef USE_SERVENT_BUFFER
591# endif
edd309b7 592
10bc17b6
JH
593/* The gethostent gethostbyaddr gethostbyname using errno? */
594
7c1815b7
KW
595# if defined(HAS_GETHOSTENT_R) && (GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBWRE || GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBIE || GETHOSTENT_R_PROTO == REENTRANT_PROTO_S_SBIE)
596# define GETHOSTENT_R_HAS_ERRNO
597# else
598# undef GETHOSTENT_R_HAS_ERRNO
599# endif
600# if defined(HAS_GETHOSTBYADDR_R) && (GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_CWISBWRE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CWISBWIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CWISBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_TWISBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CIISBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CSBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_TSBIE || GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_TsISBWRE)
601# define GETHOSTBYADDR_R_HAS_ERRNO
602# else
603# undef GETHOSTBYADDR_R_HAS_ERRNO
604# endif
605# if defined(HAS_GETHOSTBYNAME_R) && (GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE || GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_S_CSBIE)
606# define GETHOSTBYNAME_R_HAS_ERRNO
607# else
608# undef GETHOSTBYNAME_R_HAS_ERRNO
609# endif
10bc17b6
JH
610
611/* Any of the gethostent gethostbyaddr gethostbyname using errno? */
612
7c1815b7
KW
613# if (defined(GETHOSTENT_R_HAS_ERRNO) || defined(GETHOSTBYADDR_R_HAS_ERRNO) || defined(GETHOSTBYNAME_R_HAS_ERRNO))
614# define USE_HOSTENT_ERRNO
615# else
616# undef USE_HOSTENT_ERRNO
617# endif
10bc17b6
JH
618
619/* The getnetent getnetbyaddr getnetbyname using errno? */
620
7c1815b7
KW
621# if defined(HAS_GETNETENT_R) && (GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBWRE || GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBIE || GETNETENT_R_PROTO == REENTRANT_PROTO_S_SBIE)
622# define GETNETENT_R_HAS_ERRNO
623# else
624# undef GETNETENT_R_HAS_ERRNO
625# endif
626# if defined(HAS_GETNETBYADDR_R) && (GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_UISBWRE || GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_uISBWRE)
627# define GETNETBYADDR_R_HAS_ERRNO
628# else
629# undef GETNETBYADDR_R_HAS_ERRNO
630# endif
631# if defined(HAS_GETNETBYNAME_R) && (GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE)
632# define GETNETBYNAME_R_HAS_ERRNO
633# else
634# undef GETNETBYNAME_R_HAS_ERRNO
635# endif
10bc17b6
JH
636
637/* Any of the getnetent getnetbyaddr getnetbyname using errno? */
638
7c1815b7
KW
639# if (defined(GETNETENT_R_HAS_ERRNO) || defined(GETNETBYADDR_R_HAS_ERRNO) || defined(GETNETBYNAME_R_HAS_ERRNO))
640# define USE_NETENT_ERRNO
641# else
642# undef USE_NETENT_ERRNO
643# endif
10bc17b6
JH
644
645
646typedef struct {
7c1815b7
KW
647
648# ifdef HAS_ASCTIME_R
10bc17b6
JH
649 char* _asctime_buffer;
650 size_t _asctime_size;
7c1815b7
KW
651# endif /* HAS_ASCTIME_R */
652
653# ifdef HAS_CRYPT_R
654# if CRYPT_R_PROTO == REENTRANT_PROTO_B_CCD
b430fd04 655 CRYPTD* _crypt_data;
7c1815b7 656# else
05404ffe 657 struct crypt_data *_crypt_struct_buffer;
7c1815b7
KW
658# endif
659# endif /* HAS_CRYPT_R */
660
661# ifdef HAS_CTIME_R
10bc17b6
JH
662 char* _ctime_buffer;
663 size_t _ctime_size;
7c1815b7
KW
664# endif /* HAS_CTIME_R */
665
666# ifdef HAS_GETGRNAM_R
f7937171
JH
667 struct group _grent_struct;
668 char* _grent_buffer;
669 size_t _grent_size;
670# ifdef USE_GRENT_PTR
671 struct group* _grent_ptr;
10bc17b6 672# endif
f7937171
JH
673# ifdef USE_GRENT_FPTR
674 FILE* _grent_fptr;
10bc17b6 675# endif
7c1815b7
KW
676# endif /* HAS_GETGRNAM_R */
677
678# ifdef HAS_GETHOSTBYNAME_R
f7937171 679 struct hostent _hostent_struct;
10bc17b6 680# if GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD
f7937171 681 struct hostent_data _hostent_data;
10bc17b6 682# else
f7937171
JH
683 char* _hostent_buffer;
684 size_t _hostent_size;
10bc17b6 685# endif
f7937171
JH
686# ifdef USE_HOSTENT_PTR
687 struct hostent* _hostent_ptr;
10bc17b6 688# endif
f7937171
JH
689# ifdef USE_HOSTENT_ERRNO
690 int _hostent_errno;
7c1815b7
KW
691# endif
692# endif /* HAS_GETHOSTBYNAME_R */
693
694# ifdef HAS_GETLOGIN_R
10bc17b6
JH
695 char* _getlogin_buffer;
696 size_t _getlogin_size;
7c1815b7
KW
697# endif /* HAS_GETLOGIN_R */
698
699# ifdef HAS_GETNETBYNAME_R
f7937171 700 struct netent _netent_struct;
10bc17b6 701# if GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD
f7937171 702 struct netent_data _netent_data;
10bc17b6 703# else
f7937171
JH
704 char* _netent_buffer;
705 size_t _netent_size;
10bc17b6 706# endif
f7937171
JH
707# ifdef USE_NETENT_PTR
708 struct netent* _netent_ptr;
10bc17b6 709# endif
f7937171
JH
710# ifdef USE_NETENT_ERRNO
711 int _netent_errno;
7c1815b7
KW
712# endif
713# endif /* HAS_GETNETBYNAME_R */
714
715# ifdef HAS_GETPROTOBYNAME_R
f7937171 716 struct protoent _protoent_struct;
10bc17b6 717# if GETPROTOBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD
f7937171 718 struct protoent_data _protoent_data;
10bc17b6 719# else
f7937171
JH
720 char* _protoent_buffer;
721 size_t _protoent_size;
10bc17b6 722# endif
f7937171
JH
723# ifdef USE_PROTOENT_PTR
724 struct protoent* _protoent_ptr;
10bc17b6 725# endif
f7937171
JH
726# ifdef USE_PROTOENT_ERRNO
727 int _protoent_errno;
7c1815b7
KW
728# endif
729# endif /* HAS_GETPROTOBYNAME_R */
730
731# ifdef HAS_GETPWNAM_R
f7937171
JH
732 struct passwd _pwent_struct;
733 char* _pwent_buffer;
734 size_t _pwent_size;
735# ifdef USE_PWENT_PTR
736 struct passwd* _pwent_ptr;
10bc17b6 737# endif
f7937171
JH
738# ifdef USE_PWENT_FPTR
739 FILE* _pwent_fptr;
10bc17b6 740# endif
7c1815b7
KW
741# endif /* HAS_GETPWNAM_R */
742
743# ifdef HAS_GETSERVBYNAME_R
f7937171 744 struct servent _servent_struct;
10bc17b6 745# if GETSERVBYNAME_R_PROTO == REENTRANT_PROTO_I_CCSD
f7937171 746 struct servent_data _servent_data;
10bc17b6 747# else
f7937171
JH
748 char* _servent_buffer;
749 size_t _servent_size;
10bc17b6 750# endif
f7937171
JH
751# ifdef USE_SERVENT_PTR
752 struct servent* _servent_ptr;
10bc17b6 753# endif
f7937171
JH
754# ifdef USE_SERVENT_ERRNO
755 int _servent_errno;
7c1815b7
KW
756# endif
757# endif /* HAS_GETSERVBYNAME_R */
758
759# ifdef HAS_GETSPNAM_R
f7937171
JH
760 struct spwd _spent_struct;
761 char* _spent_buffer;
762 size_t _spent_size;
763# ifdef USE_SPENT_PTR
764 struct spwd* _spent_ptr;
765# endif
766# ifdef USE_SPENT_FPTR
767 FILE* _spent_fptr;
10bc17b6 768# endif
7c1815b7
KW
769# endif /* HAS_GETSPNAM_R */
770
771# ifdef HAS_READDIR_R
10bc17b6
JH
772 struct dirent* _readdir_struct;
773 size_t _readdir_size;
774# if READDIR_R_PROTO == REENTRANT_PROTO_I_TSR
775 struct dirent* _readdir_ptr;
776# endif
7c1815b7
KW
777# endif /* HAS_READDIR_R */
778
779# ifdef HAS_READDIR64_R
10bc17b6
JH
780 struct dirent64* _readdir64_struct;
781 size_t _readdir64_size;
782# if READDIR64_R_PROTO == REENTRANT_PROTO_I_TSR
783 struct dirent64* _readdir64_ptr;
784# endif
7c1815b7
KW
785# endif /* HAS_READDIR64_R */
786
787# ifdef HAS_SETLOCALE_R
10bc17b6
JH
788 char* _setlocale_buffer;
789 size_t _setlocale_size;
7c1815b7
KW
790# endif /* HAS_SETLOCALE_R */
791
792# ifdef HAS_STRERROR_R
10bc17b6
JH
793 char* _strerror_buffer;
794 size_t _strerror_size;
7c1815b7
KW
795# endif /* HAS_STRERROR_R */
796
797# ifdef HAS_TTYNAME_R
10bc17b6
JH
798 char* _ttyname_buffer;
799 size_t _ttyname_size;
7c1815b7
KW
800# endif /* HAS_TTYNAME_R */
801
10bc17b6 802
aa418cf1 803 int dummy; /* cannot have empty structs */
10bc17b6
JH
804} REENTR;
805
806/* The wrappers. */
807
7c1815b7 808# ifdef HAS_ASCTIME_R
02af4629
KW
809# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
810# undef asctime
811# if !defined(asctime) && ASCTIME_R_PROTO == REENTRANT_PROTO_B_SB
812# define asctime(a) asctime_r(a, PL_reentrant_buffer->_asctime_buffer)
813# endif
814# if !defined(asctime) && ASCTIME_R_PROTO == REENTRANT_PROTO_B_SBI
815# define asctime(a) asctime_r(a, PL_reentrant_buffer->_asctime_buffer, PL_reentrant_buffer->_asctime_size)
816# endif
817# if !defined(asctime) && ASCTIME_R_PROTO == REENTRANT_PROTO_I_SB
818# define asctime(a) (asctime_r(a, PL_reentrant_buffer->_asctime_buffer) == 0 ? PL_reentrant_buffer->_asctime_buffer : 0)
819# endif
820# if !defined(asctime) && ASCTIME_R_PROTO == REENTRANT_PROTO_I_SBI
821# define asctime(a) (asctime_r(a, PL_reentrant_buffer->_asctime_buffer, PL_reentrant_buffer->_asctime_size) == 0 ? PL_reentrant_buffer->_asctime_buffer : 0)
822# endif
7dc0f1bb
KW
823# if defined(asctime)
824# define PERL_REENTR_USING_ASCTIME_R
825# endif
02af4629 826# endif
7c1815b7
KW
827# endif /* HAS_ASCTIME_R */
828
10bc17b6 829
7c1815b7 830# ifdef HAS_CRYPT_R
02af4629
KW
831# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
832# undef crypt
833# if !defined(crypt) && CRYPT_R_PROTO == REENTRANT_PROTO_B_CCS
834# define crypt(a, b) crypt_r(a, b, PL_reentrant_buffer->_crypt_struct_buffer)
835# endif
836# if !defined(crypt) && CRYPT_R_PROTO == REENTRANT_PROTO_B_CCD
837# define crypt(a, b) crypt_r(a, b, &PL_reentrant_buffer->_crypt_data)
838# endif
7dc0f1bb
KW
839# if defined(crypt)
840# define PERL_REENTR_USING_CRYPT_R
841# endif
02af4629 842# endif
7c1815b7
KW
843# endif /* HAS_CRYPT_R */
844
10bc17b6 845
7c1815b7 846# ifdef HAS_CTERMID_R
02af4629
KW
847# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
848# undef ctermid
849# if !defined(ctermid) && CTERMID_R_PROTO == REENTRANT_PROTO_B_B
850# define ctermid(a) ctermid_r(a)
851# endif
7dc0f1bb
KW
852# if defined(ctermid)
853# define PERL_REENTR_USING_CTERMID_R
854# endif
02af4629 855# endif
7c1815b7 856# endif /* HAS_CTERMID_R */
10bc17b6 857
7c1815b7
KW
858
859# ifdef HAS_CTIME_R
02af4629
KW
860# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
861# undef ctime
862# if !defined(ctime) && CTIME_R_PROTO == REENTRANT_PROTO_B_SB
863# define ctime(a) ctime_r(a, PL_reentrant_buffer->_ctime_buffer)
864# endif
865# if !defined(ctime) && CTIME_R_PROTO == REENTRANT_PROTO_B_SBI
866# define ctime(a) ctime_r(a, PL_reentrant_buffer->_ctime_buffer, PL_reentrant_buffer->_ctime_size)
867# endif
868# if !defined(ctime) && CTIME_R_PROTO == REENTRANT_PROTO_I_SB
869# define ctime(a) (ctime_r(a, PL_reentrant_buffer->_ctime_buffer) == 0 ? PL_reentrant_buffer->_ctime_buffer : 0)
870# endif
871# if !defined(ctime) && CTIME_R_PROTO == REENTRANT_PROTO_I_SBI
872# define ctime(a) (ctime_r(a, PL_reentrant_buffer->_ctime_buffer, PL_reentrant_buffer->_ctime_size) == 0 ? PL_reentrant_buffer->_ctime_buffer : 0)
873# endif
7dc0f1bb
KW
874# if defined(ctime)
875# define PERL_REENTR_USING_CTIME_R
876# endif
02af4629 877# endif
7c1815b7
KW
878# endif /* HAS_CTIME_R */
879
10bc17b6 880
7c1815b7 881# ifdef HAS_ENDGRENT_R
02af4629
KW
882# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
883# undef endgrent
884# if !defined(endgrent) && ENDGRENT_R_PROTO == REENTRANT_PROTO_I_H
885# define endgrent() (endgrent_r(&PL_reentrant_buffer->_grent_fptr) == 0 ? 1 : 0)
886# endif
887# if !defined(endgrent) && ENDGRENT_R_PROTO == REENTRANT_PROTO_V_H
888# define endgrent() endgrent_r(&PL_reentrant_buffer->_grent_fptr)
889# endif
7dc0f1bb
KW
890# if defined(endgrent)
891# define PERL_REENTR_USING_ENDGRENT_R
892# endif
02af4629 893# endif
7c1815b7 894# endif /* HAS_ENDGRENT_R */
10bc17b6 895
7c1815b7
KW
896
897# ifdef HAS_ENDHOSTENT_R
02af4629
KW
898# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
899# undef endhostent
900# if !defined(endhostent) && ENDHOSTENT_R_PROTO == REENTRANT_PROTO_I_D
901# define endhostent() (endhostent_r(&PL_reentrant_buffer->_hostent_data) == 0 ? 1 : 0)
902# endif
903# if !defined(endhostent) && ENDHOSTENT_R_PROTO == REENTRANT_PROTO_V_D
904# define endhostent() endhostent_r(&PL_reentrant_buffer->_hostent_data)
905# endif
7dc0f1bb
KW
906# if defined(endhostent)
907# define PERL_REENTR_USING_ENDHOSTENT_R
908# endif
02af4629 909# endif
7c1815b7
KW
910# endif /* HAS_ENDHOSTENT_R */
911
10bc17b6 912
7c1815b7 913# ifdef HAS_ENDNETENT_R
02af4629
KW
914# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
915# undef endnetent
916# if !defined(endnetent) && ENDNETENT_R_PROTO == REENTRANT_PROTO_I_D
917# define endnetent() (endnetent_r(&PL_reentrant_buffer->_netent_data) == 0 ? 1 : 0)
918# endif
919# if !defined(endnetent) && ENDNETENT_R_PROTO == REENTRANT_PROTO_V_D
920# define endnetent() endnetent_r(&PL_reentrant_buffer->_netent_data)
921# endif
7dc0f1bb
KW
922# if defined(endnetent)
923# define PERL_REENTR_USING_ENDNETENT_R
924# endif
02af4629 925# endif
7c1815b7 926# endif /* HAS_ENDNETENT_R */
10bc17b6 927
7c1815b7
KW
928
929# ifdef HAS_ENDPROTOENT_R
02af4629
KW
930# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
931# undef endprotoent
932# if !defined(endprotoent) && ENDPROTOENT_R_PROTO == REENTRANT_PROTO_I_D
933# define endprotoent() (endprotoent_r(&PL_reentrant_buffer->_protoent_data) == 0 ? 1 : 0)
934# endif
935# if !defined(endprotoent) && ENDPROTOENT_R_PROTO == REENTRANT_PROTO_V_D
936# define endprotoent() endprotoent_r(&PL_reentrant_buffer->_protoent_data)
937# endif
7dc0f1bb
KW
938# if defined(endprotoent)
939# define PERL_REENTR_USING_ENDPROTOENT_R
940# endif
02af4629 941# endif
7c1815b7
KW
942# endif /* HAS_ENDPROTOENT_R */
943
10bc17b6 944
7c1815b7 945# ifdef HAS_ENDPWENT_R
02af4629
KW
946# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
947# undef endpwent
948# if !defined(endpwent) && ENDPWENT_R_PROTO == REENTRANT_PROTO_I_H
949# define endpwent() (endpwent_r(&PL_reentrant_buffer->_pwent_fptr) == 0 ? 1 : 0)
950# endif
951# if !defined(endpwent) && ENDPWENT_R_PROTO == REENTRANT_PROTO_V_H
952# define endpwent() endpwent_r(&PL_reentrant_buffer->_pwent_fptr)
953# endif
7dc0f1bb
KW
954# if defined(endpwent)
955# define PERL_REENTR_USING_ENDPWENT_R
956# endif
02af4629 957# endif
7c1815b7
KW
958# endif /* HAS_ENDPWENT_R */
959
10bc17b6 960
7c1815b7 961# ifdef HAS_ENDSERVENT_R
02af4629
KW
962# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
963# undef endservent
964# if !defined(endservent) && ENDSERVENT_R_PROTO == REENTRANT_PROTO_I_D
965# define endservent() (endservent_r(&PL_reentrant_buffer->_servent_data) == 0 ? 1 : 0)
966# endif
967# if !defined(endservent) && ENDSERVENT_R_PROTO == REENTRANT_PROTO_V_D
968# define endservent() endservent_r(&PL_reentrant_buffer->_servent_data)
969# endif
7dc0f1bb
KW
970# if defined(endservent)
971# define PERL_REENTR_USING_ENDSERVENT_R
972# endif
02af4629 973# endif
7c1815b7 974# endif /* HAS_ENDSERVENT_R */
10bc17b6 975
7c1815b7
KW
976
977# ifdef HAS_GETGRENT_R
02af4629
KW
978# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
979# undef getgrent
980# if !defined(getgrent) && GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBWR
981# define getgrent() ((PL_reentrant_retint = getgrent_r(&PL_reentrant_buffer->_grent_struct, PL_reentrant_buffer->_grent_buffer, PL_reentrant_buffer->_grent_size, &PL_reentrant_buffer->_grent_ptr)) == 0 ? PL_reentrant_buffer->_grent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct group *) Perl_reentrant_retry("getgrent") : 0))
982# endif
983# if !defined(getgrent) && GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBIR
984# define getgrent() ((PL_reentrant_retint = getgrent_r(&PL_reentrant_buffer->_grent_struct, PL_reentrant_buffer->_grent_buffer, PL_reentrant_buffer->_grent_size, &PL_reentrant_buffer->_grent_ptr)) == 0 ? PL_reentrant_buffer->_grent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct group *) Perl_reentrant_retry("getgrent") : 0))
985# endif
986# if !defined(getgrent) && GETGRENT_R_PROTO == REENTRANT_PROTO_S_SBW
987# define getgrent() (getgrent_r(&PL_reentrant_buffer->_grent_struct, PL_reentrant_buffer->_grent_buffer, PL_reentrant_buffer->_grent_size) ? &PL_reentrant_buffer->_grent_struct : ((errno == ERANGE) ? (struct group *) Perl_reentrant_retry("getgrent") : 0))
988# endif
989# if !defined(getgrent) && GETGRENT_R_PROTO == REENTRANT_PROTO_S_SBI
990# define getgrent() (getgrent_r(&PL_reentrant_buffer->_grent_struct, PL_reentrant_buffer->_grent_buffer, PL_reentrant_buffer->_grent_size) ? &PL_reentrant_buffer->_grent_struct : ((errno == ERANGE) ? (struct group *) Perl_reentrant_retry("getgrent") : 0))
991# endif
992# if !defined(getgrent) && GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBI
993# define getgrent() ((PL_reentrant_retint = getgrent_r(&PL_reentrant_buffer->_grent_struct, PL_reentrant_buffer->_grent_buffer, PL_reentrant_buffer->_grent_size)) == 0 ? &PL_reentrant_buffer->_grent_struct : ((PL_reentrant_retint == ERANGE) ? (struct group *) Perl_reentrant_retry("getgrent") : 0))
994# endif
995# if !defined(getgrent) && GETGRENT_R_PROTO == REENTRANT_PROTO_I_SBIH
996# define getgrent() ((PL_reentrant_retint = getgrent_r(&PL_reentrant_buffer->_grent_struct, PL_reentrant_buffer->_grent_buffer, PL_reentrant_buffer->_grent_size, &PL_reentrant_buffer->_grent_fptr)) == 0 ? &PL_reentrant_buffer->_grent_struct : ((PL_reentrant_retint == ERANGE) ? (struct group *) Perl_reentrant_retry("getgrent") : 0))
997# endif
7dc0f1bb
KW
998# if defined(getgrent)
999# define PERL_REENTR_USING_GETGRENT_R
1000# endif
02af4629 1001# endif
7c1815b7
KW
1002# endif /* HAS_GETGRENT_R */
1003
10bc17b6 1004
7c1815b7 1005# ifdef HAS_GETGRGID_R
02af4629
KW
1006# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1007# undef getgrgid
1008# if !defined(getgrgid) && GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBWR
1009# define getgrgid(a) ((PL_reentrant_retint = getgrgid_r(a, &PL_reentrant_buffer->_grent_struct, PL_reentrant_buffer->_grent_buffer, PL_reentrant_buffer->_grent_size, &PL_reentrant_buffer->_grent_ptr)) == 0 ? PL_reentrant_buffer->_grent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct group *) Perl_reentrant_retry("getgrgid", a) : 0))
1010# endif
1011# if !defined(getgrgid) && GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBIR
1012# define getgrgid(a) ((PL_reentrant_retint = getgrgid_r(a, &PL_reentrant_buffer->_grent_struct, PL_reentrant_buffer->_grent_buffer, PL_reentrant_buffer->_grent_size, &PL_reentrant_buffer->_grent_ptr)) == 0 ? PL_reentrant_buffer->_grent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct group *) Perl_reentrant_retry("getgrgid", a) : 0))
1013# endif
1014# if !defined(getgrgid) && GETGRGID_R_PROTO == REENTRANT_PROTO_I_TSBI
1015# define getgrgid(a) ((PL_reentrant_retint = getgrgid_r(a, &PL_reentrant_buffer->_grent_struct, PL_reentrant_buffer->_grent_buffer, PL_reentrant_buffer->_grent_size)) == 0 ? &PL_reentrant_buffer->_grent_struct : ((PL_reentrant_retint == ERANGE) ? (struct group *) Perl_reentrant_retry("getgrgid", a) : 0))
1016# endif
1017# if !defined(getgrgid) && GETGRGID_R_PROTO == REENTRANT_PROTO_S_TSBI
1018# define getgrgid(a) (getgrgid_r(a, &PL_reentrant_buffer->_grent_struct, PL_reentrant_buffer->_grent_buffer, PL_reentrant_buffer->_grent_size) ? &PL_reentrant_buffer->_grent_struct : ((errno == ERANGE) ? (struct group *) Perl_reentrant_retry("getgrgid", a) : 0))
1019# endif
7dc0f1bb
KW
1020# if defined(getgrgid)
1021# define PERL_REENTR_USING_GETGRGID_R
1022# endif
02af4629 1023# endif
7c1815b7
KW
1024# endif /* HAS_GETGRGID_R */
1025
10bc17b6 1026
7c1815b7 1027# ifdef HAS_GETGRNAM_R
02af4629
KW
1028# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1029# undef getgrnam
1030# if !defined(getgrnam) && GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR
1031# define getgrnam(a) ((PL_reentrant_retint = getgrnam_r(a, &PL_reentrant_buffer->_grent_struct, PL_reentrant_buffer->_grent_buffer, PL_reentrant_buffer->_grent_size, &PL_reentrant_buffer->_grent_ptr)) == 0 ? PL_reentrant_buffer->_grent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct group *) Perl_reentrant_retry("getgrnam", a) : 0))
1032# endif
1033# if !defined(getgrnam) && GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBIR
1034# define getgrnam(a) ((PL_reentrant_retint = getgrnam_r(a, &PL_reentrant_buffer->_grent_struct, PL_reentrant_buffer->_grent_buffer, PL_reentrant_buffer->_grent_size, &PL_reentrant_buffer->_grent_ptr)) == 0 ? PL_reentrant_buffer->_grent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct group *) Perl_reentrant_retry("getgrnam", a) : 0))
1035# endif
1036# if !defined(getgrnam) && GETGRNAM_R_PROTO == REENTRANT_PROTO_S_CBI
1037# define getgrnam(a) (getgrnam_r(a, PL_reentrant_buffer->_grent_buffer, PL_reentrant_buffer->_grent_size) ? PL_reentrant_buffer->_grent_buffer : ((errno == ERANGE) ? (struct group *) Perl_reentrant_retry("getgrnam", a) : 0))
1038# endif
1039# if !defined(getgrnam) && GETGRNAM_R_PROTO == REENTRANT_PROTO_I_CSBI
1040# define getgrnam(a) ((PL_reentrant_retint = getgrnam_r(a, &PL_reentrant_buffer->_grent_struct, PL_reentrant_buffer->_grent_buffer, PL_reentrant_buffer->_grent_size)) == 0 ? &PL_reentrant_buffer->_grent_struct : ((PL_reentrant_retint == ERANGE) ? (struct group *) Perl_reentrant_retry("getgrnam", a) : 0))
1041# endif
1042# if !defined(getgrnam) && GETGRNAM_R_PROTO == REENTRANT_PROTO_S_CSBI
1043# define getgrnam(a) (getgrnam_r(a, &PL_reentrant_buffer->_grent_struct, PL_reentrant_buffer->_grent_buffer, PL_reentrant_buffer->_grent_size) ? &PL_reentrant_buffer->_grent_struct : ((errno == ERANGE) ? (struct group *) Perl_reentrant_retry("getgrnam", a) : 0))
1044# endif
7dc0f1bb
KW
1045# if defined(getgrnam)
1046# define PERL_REENTR_USING_GETGRNAM_R
1047# endif
02af4629 1048# endif
7c1815b7 1049# endif /* HAS_GETGRNAM_R */
10bc17b6 1050
7c1815b7
KW
1051
1052# ifdef HAS_GETHOSTBYADDR_R
02af4629
KW
1053# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1054# undef gethostbyaddr
1055# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_CWISBWRE
1056# define gethostbyaddr(a, b, c) ((PL_reentrant_retint = gethostbyaddr_r(a, b, c, &PL_reentrant_buffer->_hostent_struct, PL_reentrant_buffer->_hostent_buffer, PL_reentrant_buffer->_hostent_size, &PL_reentrant_buffer->_hostent_ptr, &PL_reentrant_buffer->_hostent_errno)) == 0 ? PL_reentrant_buffer->_hostent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostbyaddr", a, b, c) : 0))
1057# endif
1058# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CWISBWIE
1059# define gethostbyaddr(a, b, c) (gethostbyaddr_r(a, b, c, &PL_reentrant_buffer->_hostent_struct, PL_reentrant_buffer->_hostent_buffer, PL_reentrant_buffer->_hostent_size, PL_reentrant_buffer->_hostent_size, &PL_reentrant_buffer->_hostent_errno) ? &PL_reentrant_buffer->_hostent_struct : ((errno == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostbyaddr", a, b, c) : 0))
1060# endif
1061# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CWISBIE
1062# define gethostbyaddr(a, b, c) (gethostbyaddr_r(a, b, c, &PL_reentrant_buffer->_hostent_struct, PL_reentrant_buffer->_hostent_buffer, PL_reentrant_buffer->_hostent_size, &PL_reentrant_buffer->_hostent_errno) ? &PL_reentrant_buffer->_hostent_struct : ((errno == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostbyaddr", a, b, c) : 0))
1063# endif
1064# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_TWISBIE
1065# define gethostbyaddr(a, b, c) (gethostbyaddr_r(a, b, c, &PL_reentrant_buffer->_hostent_struct, PL_reentrant_buffer->_hostent_buffer, PL_reentrant_buffer->_hostent_size, &PL_reentrant_buffer->_hostent_errno) ? &PL_reentrant_buffer->_hostent_struct : ((errno == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostbyaddr", a, b, c) : 0))
1066# endif
1067# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CIISBIE
1068# define gethostbyaddr(a, b, c) (gethostbyaddr_r(a, b, c, &PL_reentrant_buffer->_hostent_struct, PL_reentrant_buffer->_hostent_buffer, PL_reentrant_buffer->_hostent_size, &PL_reentrant_buffer->_hostent_errno) ? &PL_reentrant_buffer->_hostent_struct : ((errno == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostbyaddr", a, b, c) : 0))
1069# endif
1070# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_CSBIE
1071# define gethostbyaddr(a, b, c) (gethostbyaddr_r(a, b, c, PL_reentrant_buffer->_hostent_size, &PL_reentrant_buffer->_hostent_errno) ? 1 : ((errno == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostbyaddr", a, b, c) : 0))
1072# endif
1073# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_S_TSBIE
1074# define gethostbyaddr(a, b, c) (gethostbyaddr_r(a, b, c, PL_reentrant_buffer->_hostent_size, &PL_reentrant_buffer->_hostent_errno) ? 1 : ((errno == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostbyaddr", a, b, c) : 0))
1075# endif
1076# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_CWISD
1077# define gethostbyaddr(a, b, c) ((PL_reentrant_retint = gethostbyaddr_r(a, b, c, &PL_reentrant_buffer->_hostent_struct, &PL_reentrant_buffer->_hostent_data)) == 0 ? &PL_reentrant_buffer->_hostent_struct : ((PL_reentrant_retint == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostbyaddr", a, b, c) : 0))
1078# endif
1079# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_CIISD
1080# define gethostbyaddr(a, b, c) ((PL_reentrant_retint = gethostbyaddr_r(a, b, c, &PL_reentrant_buffer->_hostent_struct, &PL_reentrant_buffer->_hostent_data)) == 0 ? &PL_reentrant_buffer->_hostent_struct : ((PL_reentrant_retint == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostbyaddr", a, b, c) : 0))
1081# endif
1082# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_CII
1083# define gethostbyaddr(a, b, c) ((PL_reentrant_retint = gethostbyaddr_r(a, b, c)) == 0 ? 1 : ((PL_reentrant_retint == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostbyaddr", a, b, c) : 0))
1084# endif
1085# if !defined(gethostbyaddr) && GETHOSTBYADDR_R_PROTO == REENTRANT_PROTO_I_TsISBWRE
1086# define gethostbyaddr(a, b, c) ((PL_reentrant_retint = gethostbyaddr_r(a, b, c, &PL_reentrant_buffer->_hostent_struct, PL_reentrant_buffer->_hostent_buffer, PL_reentrant_buffer->_hostent_size, &PL_reentrant_buffer->_hostent_ptr, &PL_reentrant_buffer->_hostent_errno)) == 0 ? PL_reentrant_buffer->_hostent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostbyaddr", a, b, c) : 0))
1087# endif
7dc0f1bb
KW
1088# if defined(gethostbyaddr)
1089# define PERL_REENTR_USING_GETHOSTBYADDR_R
1090# endif
02af4629 1091# endif
7c1815b7
KW
1092# endif /* HAS_GETHOSTBYADDR_R */
1093
10bc17b6 1094
7c1815b7 1095# ifdef HAS_GETHOSTBYNAME_R
02af4629
KW
1096# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1097# undef gethostbyname
1098# if !defined(gethostbyname) && GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE
1099# define gethostbyname(a) ((PL_reentrant_retint = gethostbyname_r(a, &PL_reentrant_buffer->_hostent_struct, PL_reentrant_buffer->_hostent_buffer, PL_reentrant_buffer->_hostent_size, &PL_reentrant_buffer->_hostent_ptr, &PL_reentrant_buffer->_hostent_errno)) == 0 ? PL_reentrant_buffer->_hostent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostbyname", a) : 0))
1100# endif
1101# if !defined(gethostbyname) && GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_S_CSBIE
1102# define gethostbyname(a) (gethostbyname_r(a, &PL_reentrant_buffer->_hostent_struct, PL_reentrant_buffer->_hostent_buffer, PL_reentrant_buffer->_hostent_size, &PL_reentrant_buffer->_hostent_errno) ? &PL_reentrant_buffer->_hostent_struct : ((errno == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostbyname", a) : 0))
1103# endif
1104# if !defined(gethostbyname) && GETHOSTBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD
1105# define gethostbyname(a) ((PL_reentrant_retint = gethostbyname_r(a, &PL_reentrant_buffer->_hostent_struct, &PL_reentrant_buffer->_hostent_data)) == 0 ? &PL_reentrant_buffer->_hostent_struct : ((PL_reentrant_retint == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostbyname", a) : 0))
1106# endif
7dc0f1bb
KW
1107# if defined(gethostbyname)
1108# define PERL_REENTR_USING_GETHOSTBYNAME_R
1109# endif
02af4629 1110# endif
7c1815b7
KW
1111# endif /* HAS_GETHOSTBYNAME_R */
1112
10bc17b6 1113
7c1815b7 1114# ifdef HAS_GETHOSTENT_R
02af4629
KW
1115# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1116# undef gethostent
1117# if !defined(gethostent) && GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBWRE
1118# define gethostent() ((PL_reentrant_retint = gethostent_r(&PL_reentrant_buffer->_hostent_struct, PL_reentrant_buffer->_hostent_buffer, PL_reentrant_buffer->_hostent_size, &PL_reentrant_buffer->_hostent_ptr, &PL_reentrant_buffer->_hostent_errno)) == 0 ? PL_reentrant_buffer->_hostent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostent") : 0))
1119# endif
1120# if !defined(gethostent) && GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBIE
1121# define gethostent() ((PL_reentrant_retint = gethostent_r(&PL_reentrant_buffer->_hostent_struct, PL_reentrant_buffer->_hostent_buffer, PL_reentrant_buffer->_hostent_size, &PL_reentrant_buffer->_hostent_errno)) == 0 ? &PL_reentrant_buffer->_hostent_struct : ((PL_reentrant_retint == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostent") : 0))
1122# endif
1123# if !defined(gethostent) && GETHOSTENT_R_PROTO == REENTRANT_PROTO_S_SBIE
1124# define gethostent() (gethostent_r(&PL_reentrant_buffer->_hostent_struct, PL_reentrant_buffer->_hostent_buffer, PL_reentrant_buffer->_hostent_size, &PL_reentrant_buffer->_hostent_errno) ? &PL_reentrant_buffer->_hostent_struct : ((errno == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostent") : 0))
1125# endif
1126# if !defined(gethostent) && GETHOSTENT_R_PROTO == REENTRANT_PROTO_S_SBI
1127# define gethostent() (gethostent_r(&PL_reentrant_buffer->_hostent_struct, PL_reentrant_buffer->_hostent_buffer, PL_reentrant_buffer->_hostent_size) ? &PL_reentrant_buffer->_hostent_struct : ((errno == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostent") : 0))
1128# endif
1129# if !defined(gethostent) && GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SBI
1130# define gethostent() ((PL_reentrant_retint = gethostent_r(&PL_reentrant_buffer->_hostent_struct, PL_reentrant_buffer->_hostent_buffer, PL_reentrant_buffer->_hostent_size)) == 0 ? &PL_reentrant_buffer->_hostent_struct : ((PL_reentrant_retint == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostent") : 0))
1131# endif
1132# if !defined(gethostent) && GETHOSTENT_R_PROTO == REENTRANT_PROTO_I_SD
1133# define gethostent() ((PL_reentrant_retint = gethostent_r(&PL_reentrant_buffer->_hostent_struct, &PL_reentrant_buffer->_hostent_data)) == 0 ? &PL_reentrant_buffer->_hostent_struct : ((PL_reentrant_retint == ERANGE) ? (struct hostent *) Perl_reentrant_retry("gethostent") : 0))
1134# endif
7dc0f1bb
KW
1135# if defined(gethostent)
1136# define PERL_REENTR_USING_GETHOSTENT_R
1137# endif
02af4629 1138# endif
7c1815b7 1139# endif /* HAS_GETHOSTENT_R */
10bc17b6 1140
7c1815b7
KW
1141
1142# ifdef HAS_GETLOGIN_R
02af4629
KW
1143# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1144# undef getlogin
1145# if !defined(getlogin) && GETLOGIN_R_PROTO == REENTRANT_PROTO_I_BW
1146# define getlogin() ((PL_reentrant_retint = getlogin_r(PL_reentrant_buffer->_getlogin_buffer, PL_reentrant_buffer->_getlogin_size)) == 0 ? PL_reentrant_buffer->_getlogin_buffer : ((PL_reentrant_retint == ERANGE) ? (char *) Perl_reentrant_retry("getlogin") : 0))
1147# endif
1148# if !defined(getlogin) && GETLOGIN_R_PROTO == REENTRANT_PROTO_I_BI
1149# define getlogin() ((PL_reentrant_retint = getlogin_r(PL_reentrant_buffer->_getlogin_buffer, PL_reentrant_buffer->_getlogin_size)) == 0 ? PL_reentrant_buffer->_getlogin_buffer : ((PL_reentrant_retint == ERANGE) ? (char *) Perl_reentrant_retry("getlogin") : 0))
1150# endif
1151# if !defined(getlogin) && GETLOGIN_R_PROTO == REENTRANT_PROTO_B_BW
1152# define getlogin() getlogin_r(PL_reentrant_buffer->_getlogin_buffer, PL_reentrant_buffer->_getlogin_size)
1153# endif
1154# if !defined(getlogin) && GETLOGIN_R_PROTO == REENTRANT_PROTO_B_BI
1155# define getlogin() getlogin_r(PL_reentrant_buffer->_getlogin_buffer, PL_reentrant_buffer->_getlogin_size)
1156# endif
7dc0f1bb
KW
1157# if defined(getlogin)
1158# define PERL_REENTR_USING_GETLOGIN_R
1159# endif
02af4629 1160# endif
7c1815b7
KW
1161# endif /* HAS_GETLOGIN_R */
1162
10bc17b6 1163
7c1815b7 1164# ifdef HAS_GETNETBYADDR_R
02af4629
KW
1165# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1166# undef getnetbyaddr
1167# if !defined(getnetbyaddr) && GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_UISBWRE
1168# define getnetbyaddr(a, b) ((PL_reentrant_retint = getnetbyaddr_r(a, b, &PL_reentrant_buffer->_netent_struct, PL_reentrant_buffer->_netent_buffer, PL_reentrant_buffer->_netent_size, &PL_reentrant_buffer->_netent_ptr, &PL_reentrant_buffer->_netent_errno)) == 0 ? PL_reentrant_buffer->_netent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetbyaddr", a, b) : 0))
1169# endif
1170# if !defined(getnetbyaddr) && GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_LISBI
1171# define getnetbyaddr(a, b) ((PL_reentrant_retint = getnetbyaddr_r(a, b, &PL_reentrant_buffer->_netent_struct, PL_reentrant_buffer->_netent_buffer, PL_reentrant_buffer->_netent_size)) == 0 ? &PL_reentrant_buffer->_netent_struct : ((PL_reentrant_retint == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetbyaddr", a, b) : 0))
1172# endif
1173# if !defined(getnetbyaddr) && GETNETBYADDR_R_PROTO == REENTRANT_PROTO_S_TISBI
1174# define getnetbyaddr(a, b) (getnetbyaddr_r(a, b, &PL_reentrant_buffer->_netent_struct, PL_reentrant_buffer->_netent_buffer, PL_reentrant_buffer->_netent_size) ? &PL_reentrant_buffer->_netent_struct : ((errno == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetbyaddr", a, b) : 0))
1175# endif
1176# if !defined(getnetbyaddr) && GETNETBYADDR_R_PROTO == REENTRANT_PROTO_S_LISBI
1177# define getnetbyaddr(a, b) (getnetbyaddr_r(a, b, &PL_reentrant_buffer->_netent_struct, PL_reentrant_buffer->_netent_buffer, PL_reentrant_buffer->_netent_size) ? &PL_reentrant_buffer->_netent_struct : ((errno == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetbyaddr", a, b) : 0))
1178# endif
1179# if !defined(getnetbyaddr) && GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_TISD
1180# define getnetbyaddr(a, b) ((PL_reentrant_retint = getnetbyaddr_r(a, b, &PL_reentrant_buffer->_netent_struct, &PL_reentrant_buffer->_netent_data)) == 0 ? &PL_reentrant_buffer->_netent_struct : ((PL_reentrant_retint == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetbyaddr", a, b) : 0))
1181# endif
1182# if !defined(getnetbyaddr) && GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_LISD
1183# define getnetbyaddr(a, b) ((PL_reentrant_retint = getnetbyaddr_r(a, b, &PL_reentrant_buffer->_netent_struct, &PL_reentrant_buffer->_netent_data)) == 0 ? &PL_reentrant_buffer->_netent_struct : ((PL_reentrant_retint == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetbyaddr", a, b) : 0))
1184# endif
1185# if !defined(getnetbyaddr) && GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_IISD
1186# define getnetbyaddr(a, b) ((PL_reentrant_retint = getnetbyaddr_r(a, b, &PL_reentrant_buffer->_netent_struct, &PL_reentrant_buffer->_netent_data)) == 0 ? &PL_reentrant_buffer->_netent_struct : ((PL_reentrant_retint == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetbyaddr", a, b) : 0))
1187# endif
1188# if !defined(getnetbyaddr) && GETNETBYADDR_R_PROTO == REENTRANT_PROTO_I_uISBWRE
1189# define getnetbyaddr(a, b) ((PL_reentrant_retint = getnetbyaddr_r(a, b, &PL_reentrant_buffer->_netent_struct, PL_reentrant_buffer->_netent_buffer, PL_reentrant_buffer->_netent_size, &PL_reentrant_buffer->_netent_ptr, &PL_reentrant_buffer->_netent_errno)) == 0 ? PL_reentrant_buffer->_netent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetbyaddr", a, b) : 0))
1190# endif
7dc0f1bb
KW
1191# if defined(getnetbyaddr)
1192# define PERL_REENTR_USING_GETNETBYADDR_R
1193# endif
02af4629 1194# endif
7c1815b7 1195# endif /* HAS_GETNETBYADDR_R */
10bc17b6 1196
7c1815b7
KW
1197
1198# ifdef HAS_GETNETBYNAME_R
02af4629
KW
1199# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1200# undef getnetbyname
1201# if !defined(getnetbyname) && GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWRE
1202# define getnetbyname(a) ((PL_reentrant_retint = getnetbyname_r(a, &PL_reentrant_buffer->_netent_struct, PL_reentrant_buffer->_netent_buffer, PL_reentrant_buffer->_netent_size, &PL_reentrant_buffer->_netent_ptr, &PL_reentrant_buffer->_netent_errno)) == 0 ? PL_reentrant_buffer->_netent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetbyname", a) : 0))
1203# endif
1204# if !defined(getnetbyname) && GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBI
1205# define getnetbyname(a) ((PL_reentrant_retint = getnetbyname_r(a, &PL_reentrant_buffer->_netent_struct, PL_reentrant_buffer->_netent_buffer, PL_reentrant_buffer->_netent_size)) == 0 ? &PL_reentrant_buffer->_netent_struct : ((PL_reentrant_retint == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetbyname", a) : 0))
1206# endif
1207# if !defined(getnetbyname) && GETNETBYNAME_R_PROTO == REENTRANT_PROTO_S_CSBI
1208# define getnetbyname(a) (getnetbyname_r(a, &PL_reentrant_buffer->_netent_struct, PL_reentrant_buffer->_netent_buffer, PL_reentrant_buffer->_netent_size) ? &PL_reentrant_buffer->_netent_struct : ((errno == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetbyname", a) : 0))
1209# endif
1210# if !defined(getnetbyname) && GETNETBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD
1211# define getnetbyname(a) ((PL_reentrant_retint = getnetbyname_r(a, &PL_reentrant_buffer->_netent_struct, &PL_reentrant_buffer->_netent_data)) == 0 ? &PL_reentrant_buffer->_netent_struct : ((PL_reentrant_retint == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetbyname", a) : 0))
1212# endif
7dc0f1bb
KW
1213# if defined(getnetbyname)
1214# define PERL_REENTR_USING_GETNETBYNAME_R
1215# endif
02af4629 1216# endif
7c1815b7
KW
1217# endif /* HAS_GETNETBYNAME_R */
1218
10bc17b6 1219
7c1815b7 1220# ifdef HAS_GETNETENT_R
02af4629
KW
1221# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1222# undef getnetent
1223# if !defined(getnetent) && GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBWRE
1224# define getnetent() ((PL_reentrant_retint = getnetent_r(&PL_reentrant_buffer->_netent_struct, PL_reentrant_buffer->_netent_buffer, PL_reentrant_buffer->_netent_size, &PL_reentrant_buffer->_netent_ptr, &PL_reentrant_buffer->_netent_errno)) == 0 ? PL_reentrant_buffer->_netent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetent") : 0))
1225# endif
1226# if !defined(getnetent) && GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBIE
1227# define getnetent() ((PL_reentrant_retint = getnetent_r(&PL_reentrant_buffer->_netent_struct, PL_reentrant_buffer->_netent_buffer, PL_reentrant_buffer->_netent_size, &PL_reentrant_buffer->_netent_errno)) == 0 ? &PL_reentrant_buffer->_netent_struct : ((PL_reentrant_retint == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetent") : 0))
1228# endif
1229# if !defined(getnetent) && GETNETENT_R_PROTO == REENTRANT_PROTO_S_SBIE
1230# define getnetent() (getnetent_r(&PL_reentrant_buffer->_netent_struct, PL_reentrant_buffer->_netent_buffer, PL_reentrant_buffer->_netent_size, &PL_reentrant_buffer->_netent_errno) ? &PL_reentrant_buffer->_netent_struct : ((errno == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetent") : 0))
1231# endif
1232# if !defined(getnetent) && GETNETENT_R_PROTO == REENTRANT_PROTO_S_SBI
1233# define getnetent() (getnetent_r(&PL_reentrant_buffer->_netent_struct, PL_reentrant_buffer->_netent_buffer, PL_reentrant_buffer->_netent_size) ? &PL_reentrant_buffer->_netent_struct : ((errno == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetent") : 0))
1234# endif
1235# if !defined(getnetent) && GETNETENT_R_PROTO == REENTRANT_PROTO_I_SBI
1236# define getnetent() ((PL_reentrant_retint = getnetent_r(&PL_reentrant_buffer->_netent_struct, PL_reentrant_buffer->_netent_buffer, PL_reentrant_buffer->_netent_size)) == 0 ? &PL_reentrant_buffer->_netent_struct : ((PL_reentrant_retint == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetent") : 0))
1237# endif
1238# if !defined(getnetent) && GETNETENT_R_PROTO == REENTRANT_PROTO_I_SD
1239# define getnetent() ((PL_reentrant_retint = getnetent_r(&PL_reentrant_buffer->_netent_struct, &PL_reentrant_buffer->_netent_data)) == 0 ? &PL_reentrant_buffer->_netent_struct : ((PL_reentrant_retint == ERANGE) ? (struct netent *) Perl_reentrant_retry("getnetent") : 0))
1240# endif
7dc0f1bb
KW
1241# if defined(getnetent)
1242# define PERL_REENTR_USING_GETNETENT_R
1243# endif
02af4629 1244# endif
7c1815b7 1245# endif /* HAS_GETNETENT_R */
10bc17b6 1246
7c1815b7
KW
1247
1248# ifdef HAS_GETPROTOBYNAME_R
02af4629
KW
1249# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1250# undef getprotobyname
1251# if !defined(getprotobyname) && GETPROTOBYNAME_R_PROTO == REENTRANT_PROTO_I_CSBWR
1252# define getprotobyname(a) ((PL_reentrant_retint = getprotobyname_r(a, &PL_reentrant_buffer->_protoent_struct, PL_reentrant_buffer->_protoent_buffer, PL_reentrant_buffer->_protoent_size, &PL_reentrant_buffer->_protoent_ptr)) == 0 ? PL_reentrant_buffer->_protoent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct protoent *) Perl_reentrant_retry("getprotobyname", a) : 0))
1253# endif
1254# if !defined(getprotobyname) && GETPROTOBYNAME_R_PROTO == REENTRANT_PROTO_S_CSBI
1255# define getprotobyname(a) (getprotobyname_r(a, &PL_reentrant_buffer->_protoent_struct, PL_reentrant_buffer->_protoent_buffer, PL_reentrant_buffer->_protoent_size) ? &PL_reentrant_buffer->_protoent_struct : ((errno == ERANGE) ? (struct protoent *) Perl_reentrant_retry("getprotobyname", a) : 0))
1256# endif
1257# if !defined(getprotobyname) && GETPROTOBYNAME_R_PROTO == REENTRANT_PROTO_I_CSD
1258# define getprotobyname(a) (REENTR_MEMZERO(&PL_reentrant_buffer->_protoent_data, sizeof(PL_reentrant_buffer->_protoent_data)),(PL_reentrant_retint = getprotobyname_r(a, &PL_reentrant_buffer->_protoent_struct, &PL_reentrant_buffer->_protoent_data)) == 0 ? &PL_reentrant_buffer->_protoent_struct : ((PL_reentrant_retint == ERANGE) ? (struct protoent *) Perl_reentrant_retry("getprotobyname", a) : 0))
1259# endif
7dc0f1bb
KW
1260# if defined(getprotobyname)
1261# define PERL_REENTR_USING_GETPROTOBYNAME_R
1262# endif
02af4629 1263# endif
7c1815b7
KW
1264# endif /* HAS_GETPROTOBYNAME_R */
1265
10bc17b6 1266
7c1815b7 1267# ifdef HAS_GETPROTOBYNUMBER_R
02af4629
KW
1268# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1269# undef getprotobynumber
1270# if !defined(getprotobynumber) && GETPROTOBYNUMBER_R_PROTO == REENTRANT_PROTO_I_ISBWR
1271# define getprotobynumber(a) ((PL_reentrant_retint = getprotobynumber_r(a, &PL_reentrant_buffer->_protoent_struct, PL_reentrant_buffer->_protoent_buffer, PL_reentrant_buffer->_protoent_size, &PL_reentrant_buffer->_protoent_ptr)) == 0 ? PL_reentrant_buffer->_protoent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct protoent *) Perl_reentrant_retry("getprotobynumber", a) : 0))
1272# endif
1273# if !defined(getprotobynumber) && GETPROTOBYNUMBER_R_PROTO == REENTRANT_PROTO_S_ISBI
1274# define getprotobynumber(a) (getprotobynumber_r(a, &PL_reentrant_buffer->_protoent_struct, PL_reentrant_buffer->_protoent_buffer, PL_reentrant_buffer->_protoent_size) ? &PL_reentrant_buffer->_protoent_struct : ((errno == ERANGE) ? (struct protoent *) Perl_reentrant_retry("getprotobynumber", a) : 0))
1275# endif
1276# if !defined(getprotobynumber) && GETPROTOBYNUMBER_R_PROTO == REENTRANT_PROTO_I_ISD
1277# define getprotobynumber(a) (REENTR_MEMZERO(&PL_reentrant_buffer->_protoent_data, sizeof(PL_reentrant_buffer->_protoent_data)),(PL_reentrant_retint = getprotobynumber_r(a, &PL_reentrant_buffer->_protoent_struct, &PL_reentrant_buffer->_protoent_data)) == 0 ? &PL_reentrant_buffer->_protoent_struct : ((PL_reentrant_retint == ERANGE) ? (struct protoent *) Perl_reentrant_retry("getprotobynumber", a) : 0))
1278# endif
7dc0f1bb
KW
1279# if defined(getprotobynumber)
1280# define PERL_REENTR_USING_GETPROTOBYNUMBER_R
1281# endif
02af4629 1282# endif
7c1815b7
KW
1283# endif /* HAS_GETPROTOBYNUMBER_R */
1284
10bc17b6 1285
7c1815b7 1286# ifdef HAS_GETPROTOENT_R
02af4629
KW
1287# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1288# undef getprotoent
1289# if !defined(getprotoent) && GETPROTOENT_R_PROTO == REENTRANT_PROTO_I_SBWR
1290# define getprotoent() ((PL_reentrant_retint = getprotoent_r(&PL_reentrant_buffer->_protoent_struct, PL_reentrant_buffer->_protoent_buffer, PL_reentrant_buffer->_protoent_size, &PL_reentrant_buffer->_protoent_ptr)) == 0 ? PL_reentrant_buffer->_protoent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct protoent *) Perl_reentrant_retry("getprotoent") : 0))
1291# endif
1292# if !defined(getprotoent) && GETPROTOENT_R_PROTO == REENTRANT_PROTO_I_SBI
1293# define getprotoent() ((PL_reentrant_retint = getprotoent_r(&PL_reentrant_buffer->_protoent_struct, PL_reentrant_buffer->_protoent_buffer, PL_reentrant_buffer->_protoent_size)) == 0 ? &PL_reentrant_buffer->_protoent_struct : ((PL_reentrant_retint == ERANGE) ? (struct protoent *) Perl_reentrant_retry("getprotoent") : 0))
1294# endif
1295# if !defined(getprotoent) && GETPROTOENT_R_PROTO == REENTRANT_PROTO_S_SBI
1296# define getprotoent() (getprotoent_r(&PL_reentrant_buffer->_protoent_struct, PL_reentrant_buffer->_protoent_buffer, PL_reentrant_buffer->_protoent_size) ? &PL_reentrant_buffer->_protoent_struct : ((errno == ERANGE) ? (struct protoent *) Perl_reentrant_retry("getprotoent") : 0))
1297# endif
1298# if !defined(getprotoent) && GETPROTOENT_R_PROTO == REENTRANT_PROTO_I_SD
1299# define getprotoent() (REENTR_MEMZERO(&PL_reentrant_buffer->_protoent_data, sizeof(PL_reentrant_buffer->_protoent_data)),(PL_reentrant_retint = getprotoent_r(&PL_reentrant_buffer->_protoent_struct, &PL_reentrant_buffer->_protoent_data)) == 0 ? &PL_reentrant_buffer->_protoent_struct : ((PL_reentrant_retint == ERANGE) ? (struct protoent *) Perl_reentrant_retry("getprotoent") : 0))
1300# endif
7dc0f1bb
KW
1301# if defined(getprotoent)
1302# define PERL_REENTR_USING_GETPROTOENT_R
1303# endif
02af4629 1304# endif
7c1815b7 1305# endif /* HAS_GETPROTOENT_R */
10bc17b6 1306
7c1815b7
KW
1307
1308# ifdef HAS_GETPWENT_R
02af4629
KW
1309# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1310# undef getpwent
1311# if !defined(getpwent) && GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBWR
1312# define getpwent() ((PL_reentrant_retint = getpwent_r(&PL_reentrant_buffer->_pwent_struct, PL_reentrant_buffer->_pwent_buffer, PL_reentrant_buffer->_pwent_size, &PL_reentrant_buffer->_pwent_ptr)) == 0 ? PL_reentrant_buffer->_pwent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct passwd *) Perl_reentrant_retry("getpwent") : 0))
1313# endif
1314# if !defined(getpwent) && GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBIR
1315# define getpwent() ((PL_reentrant_retint = getpwent_r(&PL_reentrant_buffer->_pwent_struct, PL_reentrant_buffer->_pwent_buffer, PL_reentrant_buffer->_pwent_size, &PL_reentrant_buffer->_pwent_ptr)) == 0 ? PL_reentrant_buffer->_pwent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct passwd *) Perl_reentrant_retry("getpwent") : 0))
1316# endif
1317# if !defined(getpwent) && GETPWENT_R_PROTO == REENTRANT_PROTO_S_SBW
1318# define getpwent() (getpwent_r(&PL_reentrant_buffer->_pwent_struct, PL_reentrant_buffer->_pwent_buffer, PL_reentrant_buffer->_pwent_size) ? &PL_reentrant_buffer->_pwent_struct : ((errno == ERANGE) ? (struct passwd *) Perl_reentrant_retry("getpwent") : 0))
1319# endif
1320# if !defined(getpwent) && GETPWENT_R_PROTO == REENTRANT_PROTO_S_SBI
1321# define getpwent() (getpwent_r(&PL_reentrant_buffer->_pwent_struct, PL_reentrant_buffer->_pwent_buffer, PL_reentrant_buffer->_pwent_size) ? &PL_reentrant_buffer->_pwent_struct : ((errno == ERANGE) ? (struct passwd *) Perl_reentrant_retry("getpwent") : 0))
1322# endif
1323# if !defined(getpwent) && GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBI
1324# define getpwent() ((PL_reentrant_retint = getpwent_r(&PL_reentrant_buffer->_pwent_struct, PL_reentrant_buffer->_pwent_buffer, PL_reentrant_buffer->_pwent_size)) == 0 ? &PL_reentrant_buffer->_pwent_struct : ((PL_reentrant_retint == ERANGE) ? (struct passwd *) Perl_reentrant_retry("getpwent") : 0))
1325# endif
1326# if !defined(getpwent) && GETPWENT_R_PROTO == REENTRANT_PROTO_I_SBIH
1327# define getpwent() ((PL_reentrant_retint = getpwent_r(&PL_reentrant_buffer->_pwent_struct, PL_reentrant_buffer->_pwent_buffer, PL_reentrant_buffer->_pwent_size, &PL_reentrant_buffer->_pwent_fptr)) == 0 ? &PL_reentrant_buffer->_pwent_struct : ((PL_reentrant_retint == ERANGE) ? (struct passwd *) Perl_reentrant_retry("getpwent") : 0))
1328# endif
7dc0f1bb
KW
1329# if defined(getpwent)
1330# define PERL_REENTR_USING_GETPWENT_R
1331# endif
02af4629 1332# endif
7c1815b7
KW
1333# endif /* HAS_GETPWENT_R */
1334
10bc17b6 1335
7c1815b7 1336# ifdef HAS_GETPWNAM_R
02af4629
KW
1337# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1338# undef getpwnam
1339# if !defined(getpwnam) && GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR
1340# define getpwnam(a) ((PL_reentrant_retint = getpwnam_r(a, &PL_reentrant_buffer->_pwent_struct, PL_reentrant_buffer->_pwent_buffer, PL_reentrant_buffer->_pwent_size, &PL_reentrant_buffer->_pwent_ptr)) == 0 ? PL_reentrant_buffer->_pwent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct passwd *) Perl_reentrant_retry("getpwnam", a) : 0))
1341# endif
1342# if !defined(getpwnam) && GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBIR
1343# define getpwnam(a) ((PL_reentrant_retint = getpwnam_r(a, &PL_reentrant_buffer->_pwent_struct, PL_reentrant_buffer->_pwent_buffer, PL_reentrant_buffer->_pwent_size, &PL_reentrant_buffer->_pwent_ptr)) == 0 ? PL_reentrant_buffer->_pwent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct passwd *) Perl_reentrant_retry("getpwnam", a) : 0))
1344# endif
1345# if !defined(getpwnam) && GETPWNAM_R_PROTO == REENTRANT_PROTO_S_CSBI
1346# define getpwnam(a) (getpwnam_r(a, &PL_reentrant_buffer->_pwent_struct, PL_reentrant_buffer->_pwent_buffer, PL_reentrant_buffer->_pwent_size) ? &PL_reentrant_buffer->_pwent_struct : ((errno == ERANGE) ? (struct passwd *) Perl_reentrant_retry("getpwnam", a) : 0))
1347# endif
1348# if !defined(getpwnam) && GETPWNAM_R_PROTO == REENTRANT_PROTO_I_CSBI
1349# define getpwnam(a) ((PL_reentrant_retint = getpwnam_r(a, &PL_reentrant_buffer->_pwent_struct, PL_reentrant_buffer->_pwent_buffer, PL_reentrant_buffer->_pwent_size)) == 0 ? &PL_reentrant_buffer->_pwent_struct : ((PL_reentrant_retint == ERANGE) ? (struct passwd *) Perl_reentrant_retry("getpwnam", a) : 0))
1350# endif
7dc0f1bb
KW
1351# if defined(getpwnam)
1352# define PERL_REENTR_USING_GETPWNAM_R
1353# endif
02af4629 1354# endif
7c1815b7 1355# endif /* HAS_GETPWNAM_R */
10bc17b6 1356
7c1815b7
KW
1357
1358# ifdef HAS_GETPWUID_R
02af4629
KW
1359# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1360# undef getpwuid
1361# if !defined(getpwuid) && GETPWUID_R_PROTO == REENTRANT_PROTO_I_TSBWR
1362# define getpwuid(a) ((PL_reentrant_retint = getpwuid_r(a, &PL_reentrant_buffer->_pwent_struct, PL_reentrant_buffer->_pwent_buffer, PL_reentrant_buffer->_pwent_size, &PL_reentrant_buffer->_pwent_ptr)) == 0 ? PL_reentrant_buffer->_pwent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct passwd *) Perl_reentrant_retry("getpwuid", a) : 0))
1363# endif
1364# if !defined(getpwuid) && GETPWUID_R_PROTO == REENTRANT_PROTO_I_TSBIR
1365# define getpwuid(a) ((PL_reentrant_retint = getpwuid_r(a, &PL_reentrant_buffer->_pwent_struct, PL_reentrant_buffer->_pwent_buffer, PL_reentrant_buffer->_pwent_size, &PL_reentrant_buffer->_pwent_ptr)) == 0 ? PL_reentrant_buffer->_pwent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct passwd *) Perl_reentrant_retry("getpwuid", a) : 0))
1366# endif
1367# if !defined(getpwuid) && GETPWUID_R_PROTO == REENTRANT_PROTO_I_TSBI
1368# define getpwuid(a) ((PL_reentrant_retint = getpwuid_r(a, &PL_reentrant_buffer->_pwent_struct, PL_reentrant_buffer->_pwent_buffer, PL_reentrant_buffer->_pwent_size)) == 0 ? &PL_reentrant_buffer->_pwent_struct : ((PL_reentrant_retint == ERANGE) ? (struct passwd *) Perl_reentrant_retry("getpwuid", a) : 0))
1369# endif
1370# if !defined(getpwuid) && GETPWUID_R_PROTO == REENTRANT_PROTO_S_TSBI
1371# define getpwuid(a) (getpwuid_r(a, &PL_reentrant_buffer->_pwent_struct, PL_reentrant_buffer->_pwent_buffer, PL_reentrant_buffer->_pwent_size) ? &PL_reentrant_buffer->_pwent_struct : ((errno == ERANGE) ? (struct passwd *) Perl_reentrant_retry("getpwuid", a) : 0))
1372# endif
7dc0f1bb
KW
1373# if defined(getpwuid)
1374# define PERL_REENTR_USING_GETPWUID_R
1375# endif
02af4629 1376# endif
7c1815b7
KW
1377# endif /* HAS_GETPWUID_R */
1378
10bc17b6 1379
7c1815b7 1380# ifdef HAS_GETSERVBYNAME_R
02af4629
KW
1381# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1382# undef getservbyname
1383# if !defined(getservbyname) && GETSERVBYNAME_R_PROTO == REENTRANT_PROTO_I_CCSBWR
1384# define getservbyname(a, b) ((PL_reentrant_retint = getservbyname_r(a, b, &PL_reentrant_buffer->_servent_struct, PL_reentrant_buffer->_servent_buffer, PL_reentrant_buffer->_servent_size, &PL_reentrant_buffer->_servent_ptr)) == 0 ? PL_reentrant_buffer->_servent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct servent *) Perl_reentrant_retry("getservbyname", a, b) : 0))
1385# endif
1386# if !defined(getservbyname) && GETSERVBYNAME_R_PROTO == REENTRANT_PROTO_S_CCSBI
1387# define getservbyname(a, b) (getservbyname_r(a, b, &PL_reentrant_buffer->_servent_struct, PL_reentrant_buffer->_servent_buffer, PL_reentrant_buffer->_servent_size) ? &PL_reentrant_buffer->_servent_struct : ((errno == ERANGE) ? (struct servent *) Perl_reentrant_retry("getservbyname", a, b) : 0))
1388# endif
1389# if !defined(getservbyname) && GETSERVBYNAME_R_PROTO == REENTRANT_PROTO_I_CCSD
1390# define getservbyname(a, b) (REENTR_MEMZERO(&PL_reentrant_buffer->_servent_data, sizeof(PL_reentrant_buffer->_servent_data)),(PL_reentrant_retint = getservbyname_r(a, b, &PL_reentrant_buffer->_servent_struct, &PL_reentrant_buffer->_servent_data)) == 0 ? &PL_reentrant_buffer->_servent_struct : ((PL_reentrant_retint == ERANGE) ? (struct servent *) Perl_reentrant_retry("getservbyname", a, b) : 0))
1391# endif
7dc0f1bb
KW
1392# if defined(getservbyname)
1393# define PERL_REENTR_USING_GETSERVBYNAME_R
1394# endif
02af4629 1395# endif
7c1815b7 1396# endif /* HAS_GETSERVBYNAME_R */
10bc17b6 1397
7c1815b7
KW
1398
1399# ifdef HAS_GETSERVBYPORT_R
02af4629
KW
1400# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1401# undef getservbyport
1402# if !defined(getservbyport) && GETSERVBYPORT_R_PROTO == REENTRANT_PROTO_I_ICSBWR
1403# define getservbyport(a, b) ((PL_reentrant_retint = getservbyport_r(a, b, &PL_reentrant_buffer->_servent_struct, PL_reentrant_buffer->_servent_buffer, PL_reentrant_buffer->_servent_size, &PL_reentrant_buffer->_servent_ptr)) == 0 ? PL_reentrant_buffer->_servent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct servent *) Perl_reentrant_retry("getservbyport", a, b) : 0))
1404# endif
1405# if !defined(getservbyport) && GETSERVBYPORT_R_PROTO == REENTRANT_PROTO_S_ICSBI
1406# define getservbyport(a, b) (getservbyport_r(a, b, &PL_reentrant_buffer->_servent_struct, PL_reentrant_buffer->_servent_buffer, PL_reentrant_buffer->_servent_size) ? &PL_reentrant_buffer->_servent_struct : ((errno == ERANGE) ? (struct servent *) Perl_reentrant_retry("getservbyport", a, b) : 0))
1407# endif
1408# if !defined(getservbyport) && GETSERVBYPORT_R_PROTO == REENTRANT_PROTO_I_ICSD
1409# define getservbyport(a, b) (REENTR_MEMZERO(&PL_reentrant_buffer->_servent_data, sizeof(PL_reentrant_buffer->_servent_data)),(PL_reentrant_retint = getservbyport_r(a, b, &PL_reentrant_buffer->_servent_struct, &PL_reentrant_buffer->_servent_data)) == 0 ? &PL_reentrant_buffer->_servent_struct : ((PL_reentrant_retint == ERANGE) ? (struct servent *) Perl_reentrant_retry("getservbyport", a, b) : 0))
1410# endif
7dc0f1bb
KW
1411# if defined(getservbyport)
1412# define PERL_REENTR_USING_GETSERVBYPORT_R
1413# endif
02af4629 1414# endif
7c1815b7
KW
1415# endif /* HAS_GETSERVBYPORT_R */
1416
10bc17b6 1417
7c1815b7 1418# ifdef HAS_GETSERVENT_R
02af4629
KW
1419# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1420# undef getservent
1421# if !defined(getservent) && GETSERVENT_R_PROTO == REENTRANT_PROTO_I_SBWR
1422# define getservent() ((PL_reentrant_retint = getservent_r(&PL_reentrant_buffer->_servent_struct, PL_reentrant_buffer->_servent_buffer, PL_reentrant_buffer->_servent_size, &PL_reentrant_buffer->_servent_ptr)) == 0 ? PL_reentrant_buffer->_servent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct servent *) Perl_reentrant_retry("getservent") : 0))
1423# endif
1424# if !defined(getservent) && GETSERVENT_R_PROTO == REENTRANT_PROTO_I_SBI
1425# define getservent() ((PL_reentrant_retint = getservent_r(&PL_reentrant_buffer->_servent_struct, PL_reentrant_buffer->_servent_buffer, PL_reentrant_buffer->_servent_size)) == 0 ? &PL_reentrant_buffer->_servent_struct : ((PL_reentrant_retint == ERANGE) ? (struct servent *) Perl_reentrant_retry("getservent") : 0))
1426# endif
1427# if !defined(getservent) && GETSERVENT_R_PROTO == REENTRANT_PROTO_S_SBI
1428# define getservent() (getservent_r(&PL_reentrant_buffer->_servent_struct, PL_reentrant_buffer->_servent_buffer, PL_reentrant_buffer->_servent_size) ? &PL_reentrant_buffer->_servent_struct : ((errno == ERANGE) ? (struct servent *) Perl_reentrant_retry("getservent") : 0))
1429# endif
1430# if !defined(getservent) && GETSERVENT_R_PROTO == REENTRANT_PROTO_I_SD
1431# define getservent() (REENTR_MEMZERO(&PL_reentrant_buffer->_servent_data, sizeof(PL_reentrant_buffer->_servent_data)),(PL_reentrant_retint = getservent_r(&PL_reentrant_buffer->_servent_struct, &PL_reentrant_buffer->_servent_data)) == 0 ? &PL_reentrant_buffer->_servent_struct : ((PL_reentrant_retint == ERANGE) ? (struct servent *) Perl_reentrant_retry("getservent") : 0))
1432# endif
7dc0f1bb
KW
1433# if defined(getservent)
1434# define PERL_REENTR_USING_GETSERVENT_R
1435# endif
02af4629 1436# endif
7c1815b7
KW
1437# endif /* HAS_GETSERVENT_R */
1438
10bc17b6 1439
7c1815b7 1440# ifdef HAS_GETSPNAM_R
02af4629
KW
1441# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1442# undef getspnam
1443# if !defined(getspnam) && GETSPNAM_R_PROTO == REENTRANT_PROTO_I_CSBWR
1444# define getspnam(a) ((PL_reentrant_retint = getspnam_r(a, &PL_reentrant_buffer->_spent_struct, PL_reentrant_buffer->_spent_buffer, PL_reentrant_buffer->_spent_size, &PL_reentrant_buffer->_spent_ptr)) == 0 ? PL_reentrant_buffer->_spent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct spwd *) Perl_reentrant_retry("getspnam", a) : 0))
1445# endif
1446# if !defined(getspnam) && GETSPNAM_R_PROTO == REENTRANT_PROTO_S_CSBI
1447# define getspnam(a) (getspnam_r(a, &PL_reentrant_buffer->_spent_struct, PL_reentrant_buffer->_spent_buffer, PL_reentrant_buffer->_spent_size) ? &PL_reentrant_buffer->_spent_struct : ((errno == ERANGE) ? (struct spwd *) Perl_reentrant_retry("getspnam", a) : 0))
1448# endif
7dc0f1bb
KW
1449# if defined(getspnam)
1450# define PERL_REENTR_USING_GETSPNAM_R
1451# endif
02af4629 1452# endif
7c1815b7 1453# endif /* HAS_GETSPNAM_R */
10bc17b6 1454
7c1815b7
KW
1455
1456# ifdef HAS_READDIR_R
02af4629
KW
1457# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1458# undef readdir
1459# if !defined(readdir) && READDIR_R_PROTO == REENTRANT_PROTO_I_TSR
1460# define readdir(a) (readdir_r(a, PL_reentrant_buffer->_readdir_struct, &PL_reentrant_buffer->_readdir_ptr) == 0 ? PL_reentrant_buffer->_readdir_ptr : 0)
1461# endif
1462# if !defined(readdir) && READDIR_R_PROTO == REENTRANT_PROTO_I_TS
1463# define readdir(a) (readdir_r(a, PL_reentrant_buffer->_readdir_struct) == 0 ? PL_reentrant_buffer->_readdir_struct : 0)
1464# endif
7dc0f1bb
KW
1465# if defined(readdir)
1466# define PERL_REENTR_USING_READDIR_R
1467# endif
02af4629 1468# endif
7c1815b7
KW
1469# endif /* HAS_READDIR_R */
1470
10bc17b6 1471
7c1815b7 1472# ifdef HAS_READDIR64_R
02af4629
KW
1473# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1474# undef readdir64
1475# if !defined(readdir64) && READDIR64_R_PROTO == REENTRANT_PROTO_I_TSR
1476# define readdir64(a) (readdir64_r(a, PL_reentrant_buffer->_readdir64_struct, &PL_reentrant_buffer->_readdir64_ptr) == 0 ? PL_reentrant_buffer->_readdir64_ptr : 0)
1477# endif
1478# if !defined(readdir64) && READDIR64_R_PROTO == REENTRANT_PROTO_I_TS
1479# define readdir64(a) (readdir64_r(a, PL_reentrant_buffer->_readdir64_struct) == 0 ? PL_reentrant_buffer->_readdir64_struct : 0)
1480# endif
7dc0f1bb
KW
1481# if defined(readdir64)
1482# define PERL_REENTR_USING_READDIR64_R
1483# endif
02af4629 1484# endif
7c1815b7 1485# endif /* HAS_READDIR64_R */
10bc17b6 1486
7c1815b7
KW
1487
1488# ifdef HAS_SETGRENT_R
02af4629
KW
1489# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1490# undef setgrent
1491# if !defined(setgrent) && SETGRENT_R_PROTO == REENTRANT_PROTO_I_H
1492# define setgrent() (setgrent_r(&PL_reentrant_buffer->_grent_fptr) == 0 ? 1 : 0)
1493# endif
1494# if !defined(setgrent) && SETGRENT_R_PROTO == REENTRANT_PROTO_V_H
1495# define setgrent() setgrent_r(&PL_reentrant_buffer->_grent_fptr)
1496# endif
7dc0f1bb
KW
1497# if defined(setgrent)
1498# define PERL_REENTR_USING_SETGRENT_R
1499# endif
02af4629 1500# endif
7c1815b7
KW
1501# endif /* HAS_SETGRENT_R */
1502
10bc17b6 1503
7c1815b7 1504# ifdef HAS_SETHOSTENT_R
02af4629
KW
1505# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1506# undef sethostent
1507# if !defined(sethostent) && SETHOSTENT_R_PROTO == REENTRANT_PROTO_I_ID
1508# define sethostent(a) (sethostent_r(a, &PL_reentrant_buffer->_hostent_data) == 0 ? 1 : 0)
1509# endif
1510# if !defined(sethostent) && SETHOSTENT_R_PROTO == REENTRANT_PROTO_V_ID
1511# define sethostent(a) sethostent_r(a, &PL_reentrant_buffer->_hostent_data)
1512# endif
7dc0f1bb
KW
1513# if defined(sethostent)
1514# define PERL_REENTR_USING_SETHOSTENT_R
1515# endif
02af4629 1516# endif
7c1815b7 1517# endif /* HAS_SETHOSTENT_R */
10bc17b6 1518
7c1815b7
KW
1519
1520# ifdef HAS_SETLOCALE_R
02af4629
KW
1521# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1522# undef setlocale
1523# if !defined(setlocale) && SETLOCALE_R_PROTO == REENTRANT_PROTO_I_ICBI
1524# define setlocale(a, b) (setlocale_r(a, b, PL_reentrant_buffer->_setlocale_buffer, PL_reentrant_buffer->_setlocale_size) == 0 ? PL_reentrant_buffer->_setlocale_buffer : 0)
1525# endif
7dc0f1bb
KW
1526# if defined(setlocale)
1527# define PERL_REENTR_USING_SETLOCALE_R
1528# endif
02af4629 1529# endif
7c1815b7
KW
1530# endif /* HAS_SETLOCALE_R */
1531
10bc17b6 1532
7c1815b7 1533# ifdef HAS_SETNETENT_R
02af4629
KW
1534# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1535# undef setnetent
1536# if !defined(setnetent) && SETNETENT_R_PROTO == REENTRANT_PROTO_I_ID
1537# define setnetent(a) (setnetent_r(a, &PL_reentrant_buffer->_netent_data) == 0 ? 1 : 0)
1538# endif
1539# if !defined(setnetent) && SETNETENT_R_PROTO == REENTRANT_PROTO_V_ID
1540# define setnetent(a) setnetent_r(a, &PL_reentrant_buffer->_netent_data)
1541# endif
7dc0f1bb
KW
1542# if defined(setnetent)
1543# define PERL_REENTR_USING_SETNETENT_R
1544# endif
02af4629 1545# endif
7c1815b7
KW
1546# endif /* HAS_SETNETENT_R */
1547
10bc17b6 1548
7c1815b7 1549# ifdef HAS_SETPROTOENT_R
02af4629
KW
1550# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1551# undef setprotoent
1552# if !defined(setprotoent) && SETPROTOENT_R_PROTO == REENTRANT_PROTO_I_ID
1553# define setprotoent(a) (setprotoent_r(a, &PL_reentrant_buffer->_protoent_data) == 0 ? 1 : 0)
1554# endif
1555# if !defined(setprotoent) && SETPROTOENT_R_PROTO == REENTRANT_PROTO_V_ID
1556# define setprotoent(a) setprotoent_r(a, &PL_reentrant_buffer->_protoent_data)
1557# endif
7dc0f1bb
KW
1558# if defined(setprotoent)
1559# define PERL_REENTR_USING_SETPROTOENT_R
1560# endif
02af4629 1561# endif
7c1815b7 1562# endif /* HAS_SETPROTOENT_R */
10bc17b6 1563
7c1815b7
KW
1564
1565# ifdef HAS_SETPWENT_R
02af4629
KW
1566# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1567# undef setpwent
1568# if !defined(setpwent) && SETPWENT_R_PROTO == REENTRANT_PROTO_I_H
1569# define setpwent() (setpwent_r(&PL_reentrant_buffer->_pwent_fptr) == 0 ? 1 : 0)
1570# endif
1571# if !defined(setpwent) && SETPWENT_R_PROTO == REENTRANT_PROTO_V_H
1572# define setpwent() setpwent_r(&PL_reentrant_buffer->_pwent_fptr)
1573# endif
7dc0f1bb
KW
1574# if defined(setpwent)
1575# define PERL_REENTR_USING_SETPWENT_R
1576# endif
02af4629 1577# endif
7c1815b7
KW
1578# endif /* HAS_SETPWENT_R */
1579
10bc17b6 1580
7c1815b7 1581# ifdef HAS_SETSERVENT_R
02af4629
KW
1582# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1583# undef setservent
1584# if !defined(setservent) && SETSERVENT_R_PROTO == REENTRANT_PROTO_I_ID
1585# define setservent(a) (setservent_r(a, &PL_reentrant_buffer->_servent_data) == 0 ? 1 : 0)
1586# endif
1587# if !defined(setservent) && SETSERVENT_R_PROTO == REENTRANT_PROTO_V_ID
1588# define setservent(a) setservent_r(a, &PL_reentrant_buffer->_servent_data)
1589# endif
7dc0f1bb
KW
1590# if defined(setservent)
1591# define PERL_REENTR_USING_SETSERVENT_R
1592# endif
02af4629 1593# endif
7c1815b7
KW
1594# endif /* HAS_SETSERVENT_R */
1595
10bc17b6 1596
7c1815b7 1597# ifdef HAS_STRERROR_R
02af4629
KW
1598# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1599# undef strerror
1600# if !defined(strerror) && STRERROR_R_PROTO == REENTRANT_PROTO_I_IBW
1601# define strerror(a) (strerror_r(a, PL_reentrant_buffer->_strerror_buffer, PL_reentrant_buffer->_strerror_size) == 0 ? PL_reentrant_buffer->_strerror_buffer : 0)
1602# endif
1603# if !defined(strerror) && STRERROR_R_PROTO == REENTRANT_PROTO_I_IBI
1604# define strerror(a) (strerror_r(a, PL_reentrant_buffer->_strerror_buffer, PL_reentrant_buffer->_strerror_size) == 0 ? PL_reentrant_buffer->_strerror_buffer : 0)
1605# endif
1606# if !defined(strerror) && STRERROR_R_PROTO == REENTRANT_PROTO_B_IBW
1607# define strerror(a) strerror_r(a, PL_reentrant_buffer->_strerror_buffer, PL_reentrant_buffer->_strerror_size)
1608# endif
7dc0f1bb
KW
1609# if defined(strerror)
1610# define PERL_REENTR_USING_STRERROR_R
1611# endif
02af4629 1612# endif
7c1815b7 1613# endif /* HAS_STRERROR_R */
10bc17b6 1614
7c1815b7
KW
1615
1616# ifdef HAS_TMPNAM_R
02af4629
KW
1617# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1618# undef tmpnam
1619# if !defined(tmpnam) && TMPNAM_R_PROTO == REENTRANT_PROTO_B_B
1620# define tmpnam(a) tmpnam_r(a)
1621# endif
7dc0f1bb
KW
1622# if defined(tmpnam)
1623# define PERL_REENTR_USING_TMPNAM_R
1624# endif
02af4629 1625# endif
7c1815b7
KW
1626# endif /* HAS_TMPNAM_R */
1627
10bc17b6 1628
7c1815b7 1629# ifdef HAS_TTYNAME_R
02af4629
KW
1630# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
1631# undef ttyname
1632# if !defined(ttyname) && TTYNAME_R_PROTO == REENTRANT_PROTO_I_IBW
1633# define ttyname(a) (ttyname_r(a, PL_reentrant_buffer->_ttyname_buffer, PL_reentrant_buffer->_ttyname_size) == 0 ? PL_reentrant_buffer->_ttyname_buffer : 0)
1634# endif
1635# if !defined(ttyname) && TTYNAME_R_PROTO == REENTRANT_PROTO_I_IBI
1636# define ttyname(a) (ttyname_r(a, PL_reentrant_buffer->_ttyname_buffer, PL_reentrant_buffer->_ttyname_size) == 0 ? PL_reentrant_buffer->_ttyname_buffer : 0)
1637# endif
1638# if !defined(ttyname) && TTYNAME_R_PROTO == REENTRANT_PROTO_B_IBI
1639# define ttyname(a) ttyname_r(a, PL_reentrant_buffer->_ttyname_buffer, PL_reentrant_buffer->_ttyname_size)
1640# endif
7dc0f1bb
KW
1641# if defined(ttyname)
1642# define PERL_REENTR_USING_TTYNAME_R
1643# endif
02af4629 1644# endif
7c1815b7 1645# endif /* HAS_TTYNAME_R */
10bc17b6
JH
1646
1647
0891a229 1648
5baa389e
KW
1649
1650/* Special case this; if others came along, could automate it */
1651# ifdef HAS_GETSPNAM_R
1652# define KEY_getspnam -1
1653# endif
1654
10bc17b6 1655#endif /* USE_REENTRANT_API */
7c1815b7 1656
10bc17b6
JH
1657#endif
1658
37442d52 1659/* ex: set ro: */