Commit | Line | Data |
10bc17b6 |
1 | #!/usr/bin/perl -w |
2 | |
3 | # |
4 | # Generate the reentr.c and reentr.h, |
5 | # and optionally also the relevant metaconfig units (-U option). |
6 | # |
7 | |
8 | use strict; |
9 | use Getopt::Std; |
10 | my %opts; |
11 | getopts('U', \%opts); |
12 | |
13 | my %map = ( |
14 | V => "void", |
15 | A => "char*", # as an input argument |
16 | B => "char*", # as an output argument |
17 | C => "const char*", # as a read-only input argument |
18 | I => "int", |
19 | L => "long", |
20 | W => "size_t", |
21 | H => "FILE**", |
22 | E => "int*", |
23 | ); |
24 | |
25 | # (See the definitions after __DATA__.) |
26 | # In func|inc|type|... a "S" means "type*", and a "R" means "type**". |
27 | # (The "types" are often structs, such as "struct passwd".) |
28 | # |
29 | # After the prototypes one can have |X=...|Y=... to define more types. |
30 | # A commonly used extra type is to define D to be equal to "type_data", |
31 | # for example "struct_hostent_data to" go with "struct hostent". |
32 | # |
33 | # Example #1: I_XSBWR means int func_r(X, type, char*, size_t, type**) |
34 | # Example #2: S_SBIE means type func_r(type, char*, int, int*) |
35 | # Example #3: S_CBI means type func_r(const char*, char*, int) |
36 | |
37 | |
38 | die "reentr.h: $!" unless open(H, ">reentr.h"); |
39 | select H; |
40 | print <<EOF; |
41 | /* |
42 | * reentr.h |
43 | * |
44 | * Copyright (c) 1997-2002, Larry Wall |
45 | * |
46 | * You may distribute under the terms of either the GNU General Public |
47 | * License or the Artistic License, as specified in the README file. |
48 | * |
49 | * !!!!!!! DO NOT EDIT THIS FILE !!!!!!! |
50 | * This file is built by reentrl.pl from data in reentr.pl. |
51 | */ |
52 | |
53 | #ifndef REENTR_H |
54 | #define REENTR_H |
55 | |
56 | #ifdef USE_REENTRANT_API |
57 | |
58 | /* Deprecations: some platforms have the said reentrant interfaces |
59 | * but they are declared obsolete and are not to be used. Often this |
60 | * means that the platform has threadsafed the interfaces (hopefully). |
61 | * All this is OS version dependent, so we are of course fooling ourselves. |
62 | * If you know of more deprecations on some platforms, please add your own. */ |
63 | |
64 | #ifdef __hpux |
65 | # undef HAS_CRYPT_R |
66 | # undef HAS_DRAND48_R |
efa45b01 |
67 | # undef HAS_ENDGRENT_R |
68 | # undef HAS_ENDPWENT_R |
10bc17b6 |
69 | # undef HAS_GETGRENT_R |
70 | # undef HAS_GETPWENT_R |
71 | # undef HAS_SETLOCALE_R |
72 | # undef HAS_SRAND48_R |
73 | # undef HAS_STRERROR_R |
74 | # define NETDB_R_OBSOLETE |
75 | #endif |
76 | |
77 | #if defined(__osf__) && defined(__alpha) /* Tru64 aka Digital UNIX */ |
78 | # undef HAS_CRYPT_R |
79 | # undef HAS_STRERROR_R |
80 | # define NETDB_R_OBSOLETE |
81 | #endif |
82 | |
83 | #ifdef NETDB_R_OBSOLETE |
84 | # undef HAS_ENDHOSTENT_R |
85 | # undef HAS_ENDNETENT_R |
86 | # undef HAS_ENDPROTOENT_R |
87 | # undef HAS_ENDSERVENT_R |
88 | # undef HAS_GETHOSTBYADDR_R |
89 | # undef HAS_GETHOSTBYNAME_R |
90 | # undef HAS_GETHOSTENT_R |
91 | # undef HAS_GETNETBYADDR_R |
92 | # undef HAS_GETNETBYNAME_R |
93 | # undef HAS_GETNETENT_R |
94 | # undef HAS_GETPROTOBYNAME_R |
95 | # undef HAS_GETPROTOBYNUMBER_R |
96 | # undef HAS_GETPROTOENT_R |
97 | # undef HAS_GETSERVBYNAME_R |
98 | # undef HAS_GETSERVBYPORT_R |
99 | # undef HAS_GETSERVENT_R |
100 | # undef HAS_SETHOSTENT_R |
101 | # undef HAS_SETNETENT_R |
102 | # undef HAS_SETPROTOENT_R |
103 | # undef HAS_SETSERVENT_R |
104 | #endif |
105 | |
106 | #ifdef I_PWD |
107 | # include <pwd.h> |
108 | #endif |
109 | #ifdef I_GRP |
110 | # include <grp.h> |
111 | #endif |
112 | #ifdef I_NETDB |
113 | # include <netdb.h> |
114 | #endif |
115 | #ifdef I_STDLIB |
116 | # include <stdlib.h> /* drand48_data */ |
117 | #endif |
118 | #ifdef I_CRYPT |
119 | # ifdef I_CRYPT |
120 | # include <crypt.h> |
121 | # endif |
122 | #endif |
123 | #ifdef HAS_GETSPNAM_R |
124 | # ifdef I_SHADOW |
125 | # include <shadow.h> |
126 | # endif |
127 | #endif |
128 | |
129 | EOF |
130 | |
131 | my %seenh; |
132 | my %seena; |
133 | my @seenf; |
134 | my %seenp; |
135 | my %seent; |
136 | my %seens; |
137 | my %seend; |
138 | my %seenu; |
139 | |
140 | while (<DATA>) { |
141 | next if /^\s+$/; |
142 | chomp; |
143 | my ($f, $h, $t, @p) = split(/\s*\|\s*/, $_, -1); |
144 | my $u; |
145 | ($f, $u) = split(' ', $f); |
146 | $seenu{$f} = defined $u ? length $u : 0; |
147 | my $F = uc $f; |
148 | push @seenf, $f; |
149 | my %m = %map; |
150 | if ($t) { |
151 | $m{S} = "$t*"; |
152 | $m{R} = "$t**"; |
153 | } |
154 | if (@p) { |
155 | while ($p[-1] =~ /=/) { |
156 | my ($k, $v) = ($p[-1] =~ /^([A-Za-z])\s*=\s*(.*)/); |
157 | $m{$k} = $v; |
158 | pop @p; |
159 | } |
160 | } |
161 | if ($opts{U} && open(U, ">d_${f}_r.U")) { |
162 | select U; |
163 | } |
164 | my $prereqh = $h eq 'stdio' ? '' : "i_$h"; # There's no i_stdio. |
165 | print <<EOF if $opts{U}; |
166 | ?RCS: \$Id: d_${f}_r.U,v $ |
167 | ?RCS: |
168 | ?RCS: Copyright (c) 2002 Jarkko Hietaniemi |
169 | ?RCS: |
170 | ?RCS: You may distribute under the terms of either the GNU General Public |
171 | ?RCS: License or the Artistic License, as specified in the README file. |
172 | ?RCS: |
173 | ?RCS: Generated by the reentr.pl from the Perl 5.8 distribution. |
174 | ?RCS: |
175 | ?MAKE:d_${f}_r ${f}_r_proto: Inlibc Protochk i_systypes $prereqh |
176 | ?MAKE: -pick add \$@ %< |
177 | ?S:d_${f}_r: |
178 | ?S: This variable conditionally defines the HAS_${F}_R symbol, |
179 | ?S: which indicates to the C program that the ${f}_r() |
180 | ?S: routine is available. |
181 | ?S:. |
182 | ?S:${f}_r_proto: |
183 | ?S: This variable encodes the prototype of ${f}_r. |
184 | ?S:. |
185 | ?C:HAS_${F}_R: |
186 | ?C: This symbol, if defined, indicates that the ${f}_r routine |
187 | ?C: is available to ${f} re-entrantly. |
188 | ?C:. |
189 | ?C:${F}_R_PROTO: |
190 | ?C: This symbol encodes the prototype of ${f}_r. |
191 | ?C:. |
192 | ?H:#\$d_${f}_r HAS_${F}_R /**/ |
193 | ?H:#define ${F}_R_PROTO \$${f}_r_proto /**/ |
194 | ?H:. |
195 | ?T:try hdrs |
196 | ?LINT:set d_${f}_r |
197 | ?LINT:set ${f}_r_proto |
198 | : see if ${f}_r exists |
199 | set ${f}_r d_${f}_r |
200 | eval \$inlibc |
201 | case "\$d_${f}_r" in |
202 | "\$define") |
203 | hdrs="\$i_systypes sys/types.h define stdio.h \$i_${h} $h.h" |
204 | EOF |
205 | for my $p (@p) { |
206 | my ($r, $a) = ($p =~ /^(.)_(.+)/); |
207 | my $v = join(", ", map { $m{$_} } split '', $a); |
208 | if ($opts{U}) { |
209 | print <<EOF ; |
210 | case "\$${f}_r_proto" in |
211 | ''|0) try='$m{$r} ${f}_r($v);' |
212 | ./protochk "extern \$try" \$hdrs && ${f}_r_proto=$p ;; |
213 | esac |
214 | EOF |
215 | } |
216 | $seenh{$f}->{$p}++; |
217 | push @{$seena{$f}}, $p; |
218 | $seenp{$p}++; |
219 | $seent{$f} = $t; |
220 | $seens{$f} = $m{S}; |
221 | $seend{$f} = $m{D}; |
222 | } |
223 | if ($opts{U}) { |
224 | print <<EOF; |
225 | case "\$${f}_r_proto" in |
226 | '') d_${f}_r=undef |
227 | ${f}_r_proto=0 |
228 | echo "Disabling ${f}_r, cannot determine prototype." ;; |
229 | * ) case "\$${f}_r_proto" in |
230 | REENTRANT_PROTO*) ;; |
231 | *) ${f}_r_proto="REENTRANT_PROTO_\$${f}_r_proto" ;; |
232 | esac |
233 | echo "Prototype: \$try" ;; |
234 | esac |
235 | ;; |
236 | *) ${f}_r_proto=0 |
237 | ;; |
238 | esac |
239 | |
240 | EOF |
241 | close(U); |
242 | } |
243 | } |
244 | |
245 | close DATA; |
246 | |
247 | select H; |
248 | |
249 | { |
250 | my $i = 1; |
251 | for my $p (sort keys %seenp) { |
252 | print "#define REENTRANT_PROTO_${p} ${i}\n"; |
253 | $i++; |
254 | } |
255 | } |
256 | |
257 | sub ifprotomatch { |
258 | my $F = shift; |
259 | join " || ", map { "${F}_R_PROTO == REENTRANT_PROTO_$_" } @_; |
260 | } |
261 | |
262 | my @struct; |
263 | my @size; |
264 | my @init; |
265 | my @free; |
266 | my @wrap; |
267 | my @define; |
268 | |
269 | sub pushssif { |
270 | push @struct, @_; |
271 | push @size, @_; |
272 | push @init, @_; |
273 | push @free, @_; |
274 | } |
275 | |
276 | sub pushinitfree { |
277 | my $f = shift; |
278 | push @init, <<EOF; |
279 | New(31338, PL_reentrant_buffer->_${f}_buffer, PL_reentrant_buffer->_${f}_size, char); |
280 | EOF |
281 | push @free, <<EOF; |
282 | Safefree(PL_reentrant_buffer->_${f}_buffer); |
283 | EOF |
284 | } |
285 | |
286 | sub define { |
287 | my ($n, $p, @F) = @_; |
288 | my @H; |
289 | my $H = uc $F[0]; |
290 | push @define, <<EOF; |
291 | /* The @F using \L$n? */ |
292 | |
293 | EOF |
294 | for my $f (@F) { |
295 | my $F = uc $f; |
296 | my $h = "${F}_R_HAS_$n"; |
297 | push @H, $h; |
298 | my @h = grep { /$p/ } @{$seena{$f}}; |
299 | if (@h) { |
09310450 |
300 | push @define, "#if defined(HAS_${F}_R) && (" . join(" || ", map { "${F}_R_PROTO == REENTRANT_PROTO_$_" } @h) . ")\n"; |
10bc17b6 |
301 | |
302 | push @define, <<EOF; |
303 | # define $h |
304 | #else |
305 | # undef $h |
306 | #endif |
307 | EOF |
308 | } |
309 | } |
310 | push @define, <<EOF; |
311 | |
312 | /* Any of the @F using \L$n? */ |
313 | |
314 | EOF |
315 | push @define, "#if (" . join(" || ", map { "defined($_)" } @H) . ")\n"; |
316 | push @define, <<EOF; |
317 | # define USE_${H}_$n |
318 | #else |
319 | # undef USE_${H}_$n |
320 | #endif |
321 | |
322 | EOF |
323 | } |
324 | |
325 | define('PTR', 'R', |
326 | qw(getgrent getgrgid getgrnam)); |
327 | define('PTR', 'R', |
328 | qw(getpwent getpwnam getpwuid)); |
329 | define('PTR', 'R', |
330 | qw(getspent getspnam)); |
331 | |
332 | define('FPTR', 'H', |
333 | qw(getgrent getgrgid getgrnam)); |
334 | define('FPTR', 'H', |
335 | qw(getpwent getpwnam getpwuid)); |
336 | |
337 | define('PTR', 'R', |
338 | qw(gethostent gethostbyaddr gethostbyname)); |
339 | define('PTR', 'R', |
340 | qw(getnetent getnetbyaddr getnetbyname)); |
341 | define('PTR', 'R', |
342 | qw(getprotoent getprotobyname getprotobynumber)); |
343 | define('PTR', 'R', |
344 | qw(getservent getservbyname getservbyport)); |
345 | |
346 | define('ERRNO', 'E', |
347 | qw(gethostent gethostbyaddr gethostbyname)); |
348 | define('ERRNO', 'E', |
349 | qw(getnetent getnetbyaddr getnetbyname)); |
350 | |
351 | for my $f (@seenf) { |
352 | my $F = uc $f; |
353 | my $ifdef = "#ifdef HAS_${F}_R\n"; |
354 | my $endif = "#endif /* HAS_${F}_R */\n"; |
355 | if (exists $seena{$f}) { |
356 | my @p = @{$seena{$f}}; |
357 | if ($f =~ /^(asctime|ctime|getlogin|setlocale|strerror|ttyname)$/) { |
358 | pushssif $ifdef; |
359 | push @struct, <<EOF; |
360 | char* _${f}_buffer; |
361 | size_t _${f}_size; |
362 | EOF |
363 | push @size, <<EOF; |
364 | PL_reentrant_buffer->_${f}_size = 256; /* Make something up. */ |
365 | EOF |
366 | pushinitfree $f; |
367 | pushssif $endif; |
368 | } |
369 | elsif ($f =~ /^(crypt|drand48|gmtime|localtime|random)$/) { |
370 | pushssif $ifdef; |
371 | push @struct, <<EOF; |
372 | $seent{$f} _${f}_struct; |
373 | EOF |
374 | if ($f eq 'crypt') { |
375 | push @init, <<EOF; |
376 | #ifdef __GLIBC__ |
377 | PL_reentrant_buffer->_${f}_struct.initialized = 0; |
378 | #endif |
379 | EOF |
380 | } |
381 | if ($1 eq 'drand48') { |
382 | push @struct, <<EOF; |
383 | double _${f}_double; |
384 | EOF |
385 | } |
386 | pushssif $endif; |
387 | } |
388 | elsif ($f =~ /^(getgrnam|getpwnam|getspnam)$/) { |
389 | pushssif $ifdef; |
390 | my $g = $f; |
391 | $g =~ s/nam/ent/g; |
392 | my $G = uc $g; |
393 | push @struct, <<EOF; |
394 | $seent{$f} _${g}_struct; |
395 | char* _${g}_buffer; |
396 | size_t _${g}_size; |
397 | EOF |
398 | push @struct, <<EOF; |
399 | # ifdef USE_${G}_PTR |
400 | $seent{$f}* _${g}_ptr; |
401 | # endif |
402 | EOF |
403 | if ($g eq 'getspent') { |
404 | push @size, <<EOF; |
405 | PL_reentrant_buffer->_${g}_size = 1024; |
406 | EOF |
407 | } else { |
408 | push @struct, <<EOF; |
409 | # ifdef USE_${G}_FPTR |
410 | FILE* _${g}_fptr; |
411 | # endif |
412 | EOF |
413 | push @init, <<EOF; |
414 | # ifdef USE_${G}_FPTR |
415 | PL_reentrant_buffer->_${g}_fptr = NULL; |
416 | # endif |
417 | EOF |
418 | my $sc = $g eq 'getgrent' ? |
419 | '_SC_GETGR_R_SIZE_MAX' : '_SC_GETPW_R_SIZE_MAX'; |
420 | push @size, <<EOF; |
421 | # if defined(HAS_SYSCONF) && defined($sc) && !defined(__GLIBC__) |
422 | PL_reentrant_buffer->_${g}_size = sysconf($sc); |
423 | # else |
424 | # if defined(__osf__) && defined(__alpha) && defined(SIABUFSIZ) |
425 | PL_reentrant_buffer->_${g}_size = SIABUFSIZ; |
426 | # else |
427 | # ifdef __sgi |
428 | PL_reentrant_buffer->_${g}_size = BUFSIZ; |
429 | # else |
430 | PL_reentrant_buffer->_${g}_size = 2048; |
431 | # endif |
432 | # endif |
433 | # endif |
434 | EOF |
435 | } |
436 | pushinitfree $g; |
437 | pushssif $endif; |
438 | } |
439 | elsif ($f =~ /^(gethostbyname|getnetbyname|getservbyname|getprotobyname)$/) { |
440 | pushssif $ifdef; |
441 | my $g = $f; |
442 | $g =~ s/byname/ent/; |
443 | my $G = uc $g; |
444 | my $D = ifprotomatch($F, grep {/D/} @p); |
445 | my $d = $seend{$f}; |
446 | push @struct, <<EOF; |
447 | $seent{$f} _${g}_struct; |
448 | # if $D |
449 | $d _${g}_data; |
450 | # else |
451 | char* _${g}_buffer; |
452 | size_t _${g}_size; |
453 | # endif |
454 | # ifdef USE_${G}_PTR |
455 | $seent{$f}* _${g}_ptr; |
456 | # endif |
457 | EOF |
458 | push @struct, <<EOF; |
459 | # ifdef USE_${G}_ERRNO |
460 | int _${g}_errno; |
461 | # endif |
462 | EOF |
463 | push @size, <<EOF; |
464 | #if !($D) |
465 | PL_reentrant_buffer->_${g}_size = 2048; /* Any better ideas? */ |
466 | #endif |
467 | EOF |
468 | push @init, <<EOF; |
469 | #if !($D) |
470 | New(31338, PL_reentrant_buffer->_${g}_buffer, PL_reentrant_buffer->_${g}_size, char); |
471 | #endif |
472 | EOF |
473 | push @free, <<EOF; |
474 | #if !($D) |
475 | Safefree(PL_reentrant_buffer->_${g}_buffer); |
476 | #endif |
477 | EOF |
478 | pushssif $endif; |
479 | } |
480 | elsif ($f =~ /^(readdir|readdir64)$/) { |
481 | pushssif $ifdef; |
482 | my $R = ifprotomatch($F, grep {/R/} @p); |
483 | push @struct, <<EOF; |
484 | $seent{$f}* _${f}_struct; |
485 | size_t _${f}_size; |
486 | # if $R |
487 | $seent{$f}* _${f}_ptr; |
488 | # endif |
489 | EOF |
490 | push @size, <<EOF; |
491 | /* This is the size Solaris recommends. |
492 | * (though we go static, should use pathconf() instead) */ |
493 | PL_reentrant_buffer->_${f}_size = sizeof($seent{$f}) + MAXPATHLEN + 1; |
494 | EOF |
495 | push @init, <<EOF; |
496 | PL_reentrant_buffer->_${f}_struct = ($seent{$f}*)safemalloc(PL_reentrant_buffer->_${f}_size); |
497 | EOF |
498 | push @free, <<EOF; |
499 | Safefree(PL_reentrant_buffer->_${f}_struct); |
500 | EOF |
501 | pushssif $endif; |
502 | } |
503 | |
504 | push @wrap, $ifdef; |
505 | |
506 | # Doesn't implement the buffer growth loop for glibc gethostby*(). |
507 | push @wrap, <<EOF; |
508 | # undef $f |
509 | EOF |
510 | my @v = 'a'..'z'; |
511 | my $v = join(", ", @v[0..$seenu{$f}-1]); |
512 | for my $p (@p) { |
513 | my ($r, $a) = split '_', $p; |
514 | my $test = $r eq 'I' ? ' == 0' : ''; |
515 | my $true = 1; |
516 | my $false = 0; |
517 | my $g = $f; |
518 | if ($g =~ /^(?:get|set|end)(pw|gr|host|net|proto|serv|sp)/) { |
519 | $g = "get$1ent"; |
520 | } elsif ($g eq 'srand48') { |
521 | $g = "drand48"; |
522 | } |
523 | my $b = $a; |
524 | my $w = ''; |
525 | substr($b, 0, $seenu{$f}) = ''; |
526 | if ($b =~ /R/) { |
527 | $true = "PL_reentrant_buffer->_${g}_ptr"; |
528 | } elsif ($b =~ /T/ && $f eq 'drand48') { |
529 | $true = "PL_reentrant_buffer->_${g}_double"; |
530 | } elsif ($b =~ /S/) { |
531 | if ($f =~ /^readdir/) { |
532 | $true = "PL_reentrant_buffer->_${g}_struct"; |
533 | } else { |
534 | $true = "&PL_reentrant_buffer->_${g}_struct"; |
535 | } |
536 | } elsif ($b =~ /B/) { |
537 | $true = "PL_reentrant_buffer->_${g}_buffer"; |
538 | } |
539 | if (length $b) { |
540 | $w = join ", ", |
541 | map { |
542 | $_ eq 'R' ? |
543 | "&PL_reentrant_buffer->_${g}_ptr" : |
544 | $_ eq 'E' ? |
545 | "&PL_reentrant_buffer->_${g}_errno" : |
546 | $_ eq 'B' ? |
547 | "PL_reentrant_buffer->_${g}_buffer" : |
548 | $_ =~ /^[WI]$/ ? |
549 | "PL_reentrant_buffer->_${g}_size" : |
550 | $_ eq 'H' ? |
551 | "&PL_reentrant_buffer->_${g}_fptr" : |
552 | $_ eq 'D' ? |
553 | "&PL_reentrant_buffer->_${g}_data" : |
554 | $_ eq 'S' ? |
555 | ($f =~ /^readdir/ ? |
556 | "PL_reentrant_buffer->_${g}_struct" : |
557 | "&PL_reentrant_buffer->_${g}_struct" ) : |
558 | $_ eq 'T' && $f eq 'drand48' ? |
559 | "&PL_reentrant_buffer->_${g}_double" : |
560 | $_ |
561 | } split '', $b; |
562 | $w = ", $w" if length $v; |
563 | } |
564 | my $call = "${f}_r($v$w)"; |
565 | $call = "((errno = $call))" if $r eq 'I'; |
566 | push @wrap, <<EOF; |
567 | # if !defined($f) && ${F}_R_PROTO == REENTRANT_PROTO_$p |
568 | EOF |
569 | if ($r eq 'V' || $r eq 'B') { |
570 | push @wrap, <<EOF; |
571 | # define $f($v) $call |
572 | EOF |
573 | } else { |
574 | push @wrap, <<EOF; |
575 | # define $f($v) ($call$test ? $true : $false) |
576 | EOF |
577 | } |
578 | push @wrap, <<EOF; |
579 | # endif |
580 | EOF |
581 | } |
582 | |
583 | push @wrap, $endif, "\n"; |
584 | } |
585 | } |
586 | |
587 | local $" = ''; |
588 | |
589 | print <<EOF; |
590 | |
591 | /* Defines for indicating which special features are supported. */ |
592 | |
593 | @define |
594 | typedef struct { |
595 | @struct |
596 | } REENTR; |
597 | |
598 | /* The wrappers. */ |
599 | |
600 | @wrap |
601 | #endif /* USE_REENTRANT_API */ |
602 | |
603 | #endif |
604 | |
605 | EOF |
606 | |
607 | close(H); |
608 | |
609 | die "reentr.c: $!" unless open(C, ">reentr.c"); |
610 | select C; |
611 | print <<EOF; |
612 | /* |
613 | * reentr.c |
614 | * |
615 | * Copyright (c) 1997-2002, Larry Wall |
616 | * |
617 | * You may distribute under the terms of either the GNU General Public |
618 | * License or the Artistic License, as specified in the README file. |
619 | * |
620 | * !!!!!!! DO NOT EDIT THIS FILE !!!!!!! |
621 | * This file is built by reentrl.pl from data in reentr.pl. |
622 | * |
623 | * "Saruman," I said, standing away from him, "only one hand at a time can |
624 | * wield the One, and you know that well, so do not trouble to say we!" |
625 | * |
626 | */ |
627 | |
628 | #include "EXTERN.h" |
629 | #define PERL_IN_REENTR_C |
630 | #include "perl.h" |
631 | #include "reentr.h" |
632 | |
633 | void |
634 | Perl_reentrant_size(pTHX) { |
635 | #ifdef USE_REENTRANT_API |
636 | @size |
637 | #endif /* USE_REENTRANT_API */ |
638 | } |
639 | |
640 | void |
641 | Perl_reentrant_init(pTHX) { |
642 | #ifdef USE_REENTRANT_API |
643 | New(31337, PL_reentrant_buffer, 1, REENTR); |
644 | Perl_reentrant_size(aTHX); |
645 | @init |
646 | #endif /* USE_REENTRANT_API */ |
647 | } |
648 | |
649 | void |
650 | Perl_reentrant_free(pTHX) { |
651 | #ifdef USE_REENTRANT_API |
652 | @free |
653 | Safefree(PL_reentrant_buffer); |
654 | #endif /* USE_REENTRANT_API */ |
655 | } |
656 | |
657 | EOF |
658 | |
659 | __DATA__ |
660 | asctime S |time |const struct tm|B_SB|B_SBI|I_SB|I_SBI |
661 | crypt CC |crypt |struct crypt_data|B_CCS |
662 | ctermid B |stdio | |B_B |
663 | ctime S |time |const time_t |B_SB|B_SBI|I_SB|I_SBI |
664 | drand48 |stdlib |struct drand48_data |I_ST|T=double* |
665 | endgrent |grp | |I_H|V_H |
666 | endhostent |netdb |struct hostent_data |I_S|V_S |
667 | endnetent |netdb |struct netent_data |I_S|V_S |
668 | endprotoent |netdb |struct protoent_data |I_S|V_S |
669 | endpwent |pwd | |I_H|V_H |
670 | endservent |netdb |struct servent_data |I_S|V_S |
671 | getgrent |grp |struct group |I_SBWR|I_SBIR|S_SBW|S_SBI|I_SBI|I_SBIH |
672 | getgrgid T |grp |struct group |I_TSBWR|I_TSBIR|I_TSBI|S_TSBI|T=gid_t |
673 | getgrnam C |grp |struct group |I_CSBWR|I_CSBIR|S_CBI|I_CSBI|S_CSBI |
674 | gethostbyaddr CWI |netdb |struct hostent |I_CWISBWRE|S_CWISBWIE|S_CWISBIE|S_TWISBIE|S_CIISBIE|S_CSBIE|S_TSBIE|I_CWISD|I_CIISD|I_CII|D=struct hostent_data*|T=const void* |
675 | gethostbyname C |netdb |struct hostent |I_CSBWRE|S_CSBIE|I_CSD|D=struct hostent_data* |
676 | gethostent |netdb |struct hostent |I_SBWRE|I_SBIE|S_SBIE|S_SBI|I_SBI|I_SD|D=struct hostent_data* |
677 | getlogin |unistd | |I_BW|I_BI|B_BW|B_BI |
678 | getnetbyaddr LI |netdb |struct netent |I_UISBWRE|I_LISBI|S_TISBI|S_LISBI|I_TISD|I_LISD|I_IISD|D=struct netent_data*|T=in_addr_t|U=unsigned long |
679 | getnetbyname C |netdb |struct netent |I_CSBWRE|I_CSBI|S_CSBI|I_CSD|D=struct netent_data* |
680 | getnetent |netdb |struct netent |I_SBWRE|I_SBIE|S_SBIE|S_SBI|I_SBI|I_SD|D=struct netent_data* |
681 | getprotobyname C|netdb |struct protoent|I_CSBWR|S_CSBI|I_CSD|D=struct protoent_data* |
682 | getprotobynumber I |netdb |struct protoent|I_ISBWR|S_ISBI|I_ISD|D=struct protoent_data* |
683 | getprotoent |netdb |struct protoent|I_SBWR|I_SBI|S_SBI|I_SD|D=struct protoent_data* |
684 | getpwent |pwd |struct passwd |I_SBWR|I_SBIR|S_SBW|S_SBI|I_SBI|I_SBIH |
685 | getpwnam C |pwd |struct passwd |I_CSBWR|I_CSBIR|S_CSBI|I_CSBI |
686 | getpwuid T |pwd |struct passwd |I_TSBWR|I_TSBIR|I_TSBI|S_TSBI|T=uid_t |
687 | getservbyname CC|netdb |struct servent |I_CCSBWR|S_CCSBI|I_CCSD|D=struct servent_data* |
688 | getservbyport IC|netdb |struct servent |I_ICSBWR|S_ICSBI|I_ICSD|D=struct servent_data* |
689 | getservent |netdb |struct servent |I_SBWR|I_SBI|S_SBI|I_SD|D=struct servent_data* |
690 | getspnam C |shadow |struct spwd |I_CSBWR|S_CSBI |
691 | gmtime T |time |struct tm |S_TS|I_TS|T=const time_t* |
692 | localtime T |time |struct tm |S_TS|I_TS|T=const time_t* |
693 | random |stdlib |struct random_data|I_TS|T=int* |
694 | readdir T |dirent |struct dirent |I_TSR|I_TS|T=DIR* |
695 | readdir64 T |dirent |struct dirent64|I_TSR|I_TS|T=DIR* |
696 | setgrent |grp | |I_H|V_H |
697 | sethostent I |netdb | |I_ID|V_ID|D=struct hostent_data* |
698 | setlocale IC |locale | |I_ICBI |
699 | setnetent I |netdb | |I_ID|V_ID|D=struct netent_data* |
700 | setprotoent I |netdb | |I_ID|V_ID|D=struct protoent_data* |
701 | setpwent |pwd | |I_H|V_H |
702 | setservent I |netdb | |I_ID|V_ID|D=struct servent_data* |
703 | srand48 L |stdlib |struct drand48_data |I_LS |
704 | srandom T |stdlib |struct random_data|I_TS|T=unsigned int |
705 | strerror I |string | |I_IBW|I_IBI|B_IBW |
706 | tmpnam B |stdio | |B_B |
707 | ttyname I |unistd | |I_IBW|I_IBI|B_IBI |