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