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