4 # Generate the reentr.c and reentr.h,
5 # and optionally also the relevant metaconfig units (-U option).
9 # Get function prototypes
10 require 'regen_lib.pl';
20 A => "char*", # as an input argument
21 B => "char*", # as an output argument
22 C => "const char*", # as a read-only input argument
30 # (See the definitions after __DATA__.)
31 # In func|inc|type|... a "S" means "type*", and a "R" means "type**".
32 # (The "types" are often structs, such as "struct passwd".)
34 # After the prototypes one can have |X=...|Y=... to define more types.
35 # A commonly used extra type is to define D to be equal to "type_data",
36 # for example "struct_hostent_data to" go with "struct hostent".
38 # Example #1: I_XSBWR means int func_r(X, type, char*, size_t, type**)
39 # Example #2: S_SBIE means type func_r(type, char*, int, int*)
40 # Example #3: S_CBI means type func_r(const char*, char*, int)
43 safer_unlink 'reentr.h';
44 die "reentr.h: $!" unless open(H, ">reentr.h");
51 * Copyright (C) 2002, 2003, 2005 by Larry Wall and others
53 * You may distribute under the terms of either the GNU General Public
54 * License or the Artistic License, as specified in the README file.
56 * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
57 * This file is built by reentr.pl from data in reentr.pl.
63 #ifdef USE_REENTRANT_API
66 # define PL_REENTRANT_RETINT PL_reentrant_retint
69 /* Deprecations: some platforms have the said reentrant interfaces
70 * but they are declared obsolete and are not to be used. Often this
71 * means that the platform has threadsafed the interfaces (hopefully).
72 * All this is OS version dependent, so we are of course fooling ourselves.
73 * If you know of more deprecations on some platforms, please add your own. */
78 # undef HAS_ENDGRENT_R
79 # undef HAS_ENDPWENT_R
80 # undef HAS_GETGRENT_R
81 # undef HAS_GETPWENT_R
82 # undef HAS_SETLOCALE_R
84 # undef HAS_STRERROR_R
85 # define NETDB_R_OBSOLETE
88 #if defined(__osf__) && defined(__alpha) /* Tru64 aka Digital UNIX */
90 # undef HAS_STRERROR_R
91 # define NETDB_R_OBSOLETE
94 #ifdef NETDB_R_OBSOLETE
95 # undef HAS_ENDHOSTENT_R
96 # undef HAS_ENDNETENT_R
97 # undef HAS_ENDPROTOENT_R
98 # undef HAS_ENDSERVENT_R
99 # undef HAS_GETHOSTBYADDR_R
100 # undef HAS_GETHOSTBYNAME_R
101 # undef HAS_GETHOSTENT_R
102 # undef HAS_GETNETBYADDR_R
103 # undef HAS_GETNETBYNAME_R
104 # undef HAS_GETNETENT_R
105 # undef HAS_GETPROTOBYNAME_R
106 # undef HAS_GETPROTOBYNUMBER_R
107 # undef HAS_GETPROTOENT_R
108 # undef HAS_GETSERVBYNAME_R
109 # undef HAS_GETSERVBYPORT_R
110 # undef HAS_GETSERVENT_R
111 # undef HAS_SETHOSTENT_R
112 # undef HAS_SETNETENT_R
113 # undef HAS_SETPROTOENT_R
114 # undef HAS_SETSERVENT_R
127 # include <stdlib.h> /* drand48_data */
134 #ifdef HAS_GETSPNAM_R
142 my %seenh; # the different prototypes signatures for this function
143 my %seena; # the different prototypes signatures for this function in order
144 my @seenf; # all the seen functions
145 my %seenp; # the different prototype signatures for all functions
146 my %seent; # the return type of this function
147 my %seens; # the type of this function's "S"
148 my %seend; # the type of this function's "D"
149 my %seenm; # all the types
150 my %seenu; # the length of the argument list of this function
151 my %seenr; # the return type of this function
153 while (<DATA>) { # Read in the protypes.
156 my ($func, $hdr, $type, @p) = split(/\s*\|\s*/, $_, -1);
158 # Split off the real function name and the argument list.
159 ($func, $u) = split(' ', $func);
160 $u = "V_V" unless $u;
161 ($r, $u) = ($u =~ /^(.)_(.+)/);
162 $seenu{$func} = $u eq 'V' ? 0 : length $u;
164 my $FUNC = uc $func; # for output.
172 # Set any special mapping variables (like X=x_t)
174 while ($p[-1] =~ /=/) {
175 my ($k, $v) = ($p[-1] =~ /^([A-Za-z])\s*=\s*(.*)/);
181 # If given the -U option open up the metaconfig unit for this function.
182 if ($opts{U} && open(U, ">d_${func}_r.U")) {
188 # The metaconfig units needs prerequisite dependencies.
192 if ($hdr ne 'stdio') { # There's no i_stdio.
195 $prereqsh = "\$$prereqs $prereqh";
197 my @prereq = qw(Inlibc Protochk Hasproto i_systypes usethreads);
198 push @prereq, $prereqs;
199 my $hdrs = "\$i_systypes sys/types.h define stdio.h $prereqsh";
200 if ($hdr eq 'time') {
201 $hdrs .= " \$i_systime sys/time.h";
202 push @prereq, 'i_systime';
204 # Output the metaconfig unit header.
206 ?RCS: \$Id: d_${func}_r.U,v $
208 ?RCS: Copyright (c) 2002,2003 Jarkko Hietaniemi
210 ?RCS: You may distribute under the terms of either the GNU General Public
211 ?RCS: License or the Artistic License, as specified in the README file.
213 ?RCS: Generated by the reentr.pl from the Perl 5.8 distribution.
215 ?MAKE:d_${func}_r ${func}_r_proto: @prereq
216 ?MAKE: -pick add \$@ %<
218 ?S: This variable conditionally defines the HAS_${FUNC}_R symbol,
219 ?S: which indicates to the C program that the ${func}_r()
220 ?S: routine is available.
223 ?S: This variable encodes the prototype of ${func}_r.
224 ?S: It is zero if d_${func}_r is undef, and one of the
225 ?S: REENTRANT_PROTO_T_ABC macros of reentr.h if d_${func}_r
229 ?C: This symbol, if defined, indicates that the ${func}_r routine
230 ?C: is available to ${func} re-entrantly.
233 ?C: This symbol encodes the prototype of ${func}_r.
234 ?C: It is zero if d_${func}_r is undef, and one of the
235 ?C: REENTRANT_PROTO_T_ABC macros of reentr.h if d_${func}_r
238 ?H:#\$d_${func}_r HAS_${FUNC}_R /**/
239 ?H:#define ${FUNC}_R_PROTO \$${func}_r_proto /**/
241 ?T:try hdrs d_${func}_r_proto
242 ?LINT:set d_${func}_r
243 ?LINT:set ${func}_r_proto
244 : see if ${func}_r exists
245 set ${func}_r d_${func}_r
247 case "\$d_${func}_r" in
252 case "\$d_${func}_r_proto:\$usethreads" in
253 ":define") d_${func}_r_proto=define
254 set d_${func}_r_proto ${func}_r \$hdrs
258 case "\$d_${func}_r_proto" in
263 my ($r, $a) = ($p =~ /^(.)_(.+)/);
264 my $v = join(", ", map { $m{$_} } split '', $a);
267 case "\$${func}_r_proto" in
268 ''|0) try='$m{$r} ${func}_r($v);'
269 ./protochk "extern \$try" \$hdrs && ${func}_r_proto=$p ;;
273 $seenh{$func}->{$p}++;
274 push @{$seena{$func}}, $p;
276 $seent{$func} = $type;
277 $seens{$func} = $m{S};
278 $seend{$func} = $m{D};
283 case "\$${func}_r_proto" in
284 ''|0) d_${func}_r=undef
286 echo "Disabling ${func}_r, cannot determine prototype." >&4 ;;
287 * ) case "\$${func}_r_proto" in
289 *) ${func}_r_proto="REENTRANT_PROTO_\$${func}_r_proto" ;;
291 echo "Prototype: \$try" ;;
294 *) case "\$usethreads" in
295 define) echo "${func}_r has no prototype, not using it." >&4 ;;
313 # Prepare to continue writing the reentr.h.
318 # Write out all the known prototype signatures.
320 for my $p (sort keys %seenp) {
321 print "#define REENTRANT_PROTO_${p} ${i}\n";
326 my @struct; # REENTR struct members
327 my @size; # struct member buffer size initialization code
328 my @init; # struct member buffer initialization (malloc) code
329 my @free; # struct member buffer release (free) code
330 my @wrap; # the wrapper (foo(a) -> foo_r(a,...)) cpp code
331 my @define; # defines for optional features
335 join " || ", map { "${FUNC}_R_PROTO == REENTRANT_PROTO_$_" } @_;
348 New(31338, PL_reentrant_buffer->_${func}_buffer, PL_reentrant_buffer->_${func}_size, char);
351 Safefree(PL_reentrant_buffer->_${func}_buffer);
356 my ($n, $p, @F) = @_;
360 /* The @F using \L$n? */
366 my $HAS = "${FUNC}_R_HAS_$n";
368 my @h = grep { /$p/ } @{$seena{$func}};
369 unless (defined $GENFUNC) {
371 $GENFUNC =~ s/^GET//;
374 push @define, "#if defined(HAS_${FUNC}_R) && (" . join(" || ", map { "${FUNC}_R_PROTO == REENTRANT_PROTO_$_" } @h) . ")\n";
387 /* Any of the @F using \L$n? */
390 push @define, "#if (" . join(" || ", map { "defined($_)" } @H) . ")\n";
392 # define USE_${GENFUNC}_$n
394 # undef USE_${GENFUNC}_$n
400 define('BUFFER', 'B',
401 qw(getgrent getgrgid getgrnam));
404 qw(getgrent getgrgid getgrnam));
406 qw(getpwent getpwnam getpwuid));
408 qw(getspent getspnam));
411 qw(getgrent getgrgid getgrnam setgrent endgrent));
413 qw(getpwent getpwnam getpwuid setpwent endpwent));
415 define('BUFFER', 'B',
416 qw(getpwent getpwgid getpwnam));
419 qw(gethostent gethostbyaddr gethostbyname));
421 qw(getnetent getnetbyaddr getnetbyname));
423 qw(getprotoent getprotobyname getprotobynumber));
425 qw(getservent getservbyname getservbyport));
427 define('BUFFER', 'B',
428 qw(gethostent gethostbyaddr gethostbyname));
429 define('BUFFER', 'B',
430 qw(getnetent getnetbyaddr getnetbyname));
431 define('BUFFER', 'B',
432 qw(getprotoent getprotobyname getprotobynumber));
433 define('BUFFER', 'B',
434 qw(getservent getservbyname getservbyport));
437 qw(gethostent gethostbyaddr gethostbyname));
439 qw(getnetent getnetbyaddr getnetbyname));
441 # The following loop accumulates the "ssif" (struct, size, init, free)
442 # sections that declare the struct members (in reentr.h), and the buffer
443 # size initialization, buffer initialization (malloc), and buffer
444 # release (free) code (in reentr.c).
446 # The loop also contains a lot of intrinsic logic about groups of
447 # functions (since functions of certain kind operate the same way).
449 for my $func (@seenf) {
451 my $ifdef = "#ifdef HAS_${FUNC}_R\n";
452 my $endif = "#endif /* HAS_${FUNC}_R */\n";
453 if (exists $seena{$func}) {
454 my @p = @{$seena{$func}};
455 if ($func =~ /^(asctime|ctime|getlogin|setlocale|strerror|ttyname)$/) {
458 char* _${func}_buffer;
459 size_t _${func}_size;
462 PL_reentrant_buffer->_${func}_size = REENTRANTSMALLSIZE;
467 elsif ($func =~ /^(crypt)$/) {
470 #if CRYPT_R_PROTO == REENTRANT_PROTO_B_CCD
471 $seend{$func} _${func}_data;
473 $seent{$func} _${func}_struct;
477 #if CRYPT_R_PROTO != REENTRANT_PROTO_B_CCD
478 PL_reentrant_buffer->_${func}_struct_buffer = 0;
482 #if CRYPT_R_PROTO != REENTRANT_PROTO_B_CCD
483 Safefree(PL_reentrant_buffer->_${func}_struct_buffer);
488 elsif ($func =~ /^(drand48|gmtime|localtime)$/) {
491 $seent{$func} _${func}_struct;
493 if ($1 eq 'drand48') {
495 double _${func}_double;
500 elsif ($func =~ /^random$/) {
503 # if RANDOM_R_PROTO != REENTRANT_PROTO_I_St
504 $seent{$func} _${func}_struct;
509 elsif ($func =~ /^(getgrnam|getpwnam|getspnam)$/) {
511 # 'genfunc' can be read either as 'generic' or 'genre',
512 # it represents a group of functions.
514 $genfunc =~ s/nam/ent/g;
515 $genfunc =~ s/^get//;
516 my $GENFUNC = uc $genfunc;
518 $seent{$func} _${genfunc}_struct;
519 char* _${genfunc}_buffer;
520 size_t _${genfunc}_size;
523 # ifdef USE_${GENFUNC}_PTR
524 $seent{$func}* _${genfunc}_ptr;
528 # ifdef USE_${GENFUNC}_FPTR
529 FILE* _${genfunc}_fptr;
533 # ifdef USE_${GENFUNC}_FPTR
534 PL_reentrant_buffer->_${genfunc}_fptr = NULL;
537 my $sc = $genfunc eq 'grent' ?
538 '_SC_GETGR_R_SIZE_MAX' : '_SC_GETPW_R_SIZE_MAX';
539 my $sz = "_${genfunc}_size";
541 # if defined(HAS_SYSCONF) && defined($sc) && !defined(__GLIBC__)
542 PL_reentrant_buffer->$sz = sysconf($sc);
543 if (PL_reentrant_buffer->$sz == -1)
544 PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE;
546 # if defined(__osf__) && defined(__alpha) && defined(SIABUFSIZ)
547 PL_reentrant_buffer->$sz = SIABUFSIZ;
550 PL_reentrant_buffer->$sz = BUFSIZ;
552 PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE;
557 pushinitfree $genfunc;
560 elsif ($func =~ /^(gethostbyname|getnetbyname|getservbyname|getprotobyname)$/) {
563 $genfunc =~ s/byname/ent/;
564 $genfunc =~ s/^get//;
565 my $GENFUNC = uc $genfunc;
566 my $D = ifprotomatch($FUNC, grep {/D/} @p);
567 my $d = $seend{$func};
568 $d =~ s/\*$//; # snip: we need need the base type.
570 $seent{$func} _${genfunc}_struct;
574 char* _${genfunc}_buffer;
575 size_t _${genfunc}_size;
577 # ifdef USE_${GENFUNC}_PTR
578 $seent{$func}* _${genfunc}_ptr;
582 # ifdef USE_${GENFUNC}_ERRNO
583 int _${genfunc}_errno;
588 PL_reentrant_buffer->_${genfunc}_size = REENTRANTUSUALSIZE;
593 New(31338, PL_reentrant_buffer->_${genfunc}_buffer, PL_reentrant_buffer->_${genfunc}_size, char);
598 Safefree(PL_reentrant_buffer->_${genfunc}_buffer);
603 elsif ($func =~ /^(readdir|readdir64)$/) {
605 my $R = ifprotomatch($FUNC, grep {/R/} @p);
607 $seent{$func}* _${func}_struct;
608 size_t _${func}_size;
610 $seent{$func}* _${func}_ptr;
614 /* This is the size Solaris recommends.
615 * (though we go static, should use pathconf() instead) */
616 PL_reentrant_buffer->_${func}_size = sizeof($seent{$func}) + MAXPATHLEN + 1;
619 PL_reentrant_buffer->_${func}_struct = ($seent{$func}*)safemalloc(PL_reentrant_buffer->_${func}_size);
622 Safefree(PL_reentrant_buffer->_${func}_struct);
633 # Write out what we have learned.
636 my $v = join(", ", @v[0..$seenu{$func}-1]);
638 my ($r, $a) = split '_', $p;
639 my $test = $r eq 'I' ? ' == 0' : '';
642 if ($genfunc =~ /^(?:get|set|end)(pw|gr|host|net|proto|serv|sp)/) {
643 $genfunc = "${1}ent";
644 } elsif ($genfunc eq 'srand48') {
645 $genfunc = "drand48";
649 substr($b, 0, $seenu{$func}) = '';
650 if ($func =~ /^random$/) {
651 $true = "PL_reentrant_buffer->_random_retval";
652 } elsif ($b =~ /R/) {
653 $true = "PL_reentrant_buffer->_${genfunc}_ptr";
654 } elsif ($b =~ /T/ && $func eq 'drand48') {
655 $true = "PL_reentrant_buffer->_${genfunc}_double";
656 } elsif ($b =~ /S/) {
657 if ($func =~ /^readdir/) {
658 $true = "PL_reentrant_buffer->_${genfunc}_struct";
660 $true = "&PL_reentrant_buffer->_${genfunc}_struct";
662 } elsif ($b =~ /B/) {
663 $true = "PL_reentrant_buffer->_${genfunc}_buffer";
669 "&PL_reentrant_buffer->_${genfunc}_ptr" :
671 "&PL_reentrant_buffer->_${genfunc}_errno" :
673 "PL_reentrant_buffer->_${genfunc}_buffer" :
675 "PL_reentrant_buffer->_${genfunc}_size" :
677 "&PL_reentrant_buffer->_${genfunc}_fptr" :
679 "&PL_reentrant_buffer->_${genfunc}_data" :
681 ($func =~ /^readdir\d*$/ ?
682 "PL_reentrant_buffer->_${genfunc}_struct" :
684 "PL_reentrant_buffer->_${genfunc}_struct_buffer" :
685 "&PL_reentrant_buffer->_${genfunc}_struct") :
686 $_ eq 'T' && $func eq 'drand48' ?
687 "&PL_reentrant_buffer->_${genfunc}_double" :
688 $_ =~ /^[ilt]$/ && $func eq 'random' ?
689 "&PL_reentrant_buffer->_random_retval" :
692 $w = ", $w" if length $v;
694 my $call = "${func}_r($v$w)";
696 # Must make OpenBSD happy
699 ($genfunc eq 'protoent' || $genfunc eq 'servent')) {
700 $memzero = 'REENTR_MEMZERO(&PL_reentrant_buffer->_' . $genfunc . '_data, sizeof(PL_reentrant_buffer->_' . $genfunc . '_data))';
703 # if !defined($func) && ${FUNC}_R_PROTO == REENTRANT_PROTO_$p
705 if ($r eq 'V' || $r eq 'B') {
707 # define $func($v) $call
710 if ($func =~ /^get/) {
711 my $rv = $v ? ", $v" : "";
713 $call = qq[((PL_REENTRANT_RETINT = $call)$test ? $true : (((PL_REENTRANT_RETINT == ERANGE) || (errno == ERANGE)) ? ($seenm{$func}{$seenr{$func}})Perl_reentrant_retry("$func"$rv) : 0))];
714 my $arg = join(", ", map { $seenm{$func}{substr($a,$_,1)}." ".$v[$_] } 0..$seenu{$func}-1);
715 my $ret = $seenr{$func} eq 'V' ? "" : "return ";
716 my $memzero_ = $memzero ? "$memzero, " : "";
719 # define $func($v) ($memzero_$call)
721 # if defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(PERL_GCC_PEDANTIC)
722 # define $func($v) ({int PL_REENTRANT_RETINT; $memzero; $call;})
724 # define $func($v) Perl_reentr_$func($v)
725 static $seenm{$func}{$seenr{$func}} Perl_reentr_$func($arg) {
727 int PL_REENTRANT_RETINT;
736 # define $func($v) ($call$test ? $true : ((errno == ERANGE) ? ($seent{$func} *) Perl_reentrant_retry("$func"$rv) : 0))
741 # define $func($v) ($call$test ? $true : 0)
750 push @wrap, $endif, "\n";
754 # New struct members added here to maintain binary compatibility with 5.8.0
756 if (exists $seena{crypt}) {
759 #if CRYPT_R_PROTO == REENTRANT_PROTO_B_CCD
761 struct crypt_data *_crypt_struct_buffer;
763 #endif /* HAS_CRYPT_R */
767 if (exists $seena{random}) {
770 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_iS
773 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_lS
776 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_St
777 $seent{random} _random_struct;
778 int32_t _random_retval;
780 #endif /* HAS_RANDOM_R */
784 if (exists $seena{srandom}) {
787 $seent{srandom} _srandom_struct;
788 #endif /* HAS_SRANDOM_R */
797 /* Defines for indicating which special features are supported. */
802 int dummy; /* cannot have empty structs */
805 #endif /* USE_REENTRANT_API */
812 die "reentr.inc: $!" unless open(H, ">reentr.inc");
821 * You may distribute under the terms of either the GNU General Public
822 * License or the Artistic License, as specified in the README file.
824 * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
825 * This file is built by reentrl.pl from data in reentr.pl.
831 #ifdef USE_REENTRANT_API
834 * As of OpenBSD 3.7, reentrant functions are now working, they just are
835 * incompatible with everyone else. To make OpenBSD happy, we have to
836 * memzero out certain structures before calling the functions.
838 #if defined(__OpenBSD__)
839 # define REENTR_MEMZERO(a,b) memzero(a,b)
841 # define REENTR_MEMZERO(a,b) 0
844 /* The reentrant wrappers. */
848 #endif /* USE_REENTRANT_API */
856 # Prepare to write the reentr.c.
858 safer_unlink 'reentr.c';
859 die "reentr.c: $!" unless open(C, ">reentr.c");
866 * Copyright (C) 2002, 2003, by Larry Wall and others
868 * You may distribute under the terms of either the GNU General Public
869 * License or the Artistic License, as specified in the README file.
871 * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
872 * This file is built by reentr.pl from data in reentr.pl.
874 * "Saruman," I said, standing away from him, "only one hand at a time can
875 * wield the One, and you know that well, so do not trouble to say we!"
877 * This file contains a collection of automatically created wrappers
878 * (created by running reentr.pl) for reentrant (thread-safe) versions of
879 * various library calls, such as getpwent_r. The wrapping is done so
880 * that other files like pp_sys.c calling those library functions need not
881 * care about the differences between various platforms' idiosyncrasies
882 * regarding these reentrant interfaces.
886 #define PERL_IN_REENTR_C
891 Perl_reentrant_size(pTHX) {
892 #ifdef USE_REENTRANT_API
893 #define REENTRANTSMALLSIZE 256 /* Make something up. */
894 #define REENTRANTUSUALSIZE 4096 /* Make something up. */
896 #endif /* USE_REENTRANT_API */
900 Perl_reentrant_init(pTHX) {
901 #ifdef USE_REENTRANT_API
902 New(31337, PL_reentrant_buffer, 1, REENTR);
903 Perl_reentrant_size(aTHX);
905 #endif /* USE_REENTRANT_API */
909 Perl_reentrant_free(pTHX) {
910 #ifdef USE_REENTRANT_API
912 Safefree(PL_reentrant_buffer);
913 #endif /* USE_REENTRANT_API */
917 Perl_reentrant_retry(const char *f, ...)
921 #ifdef USE_REENTRANT_API
922 # if defined(USE_HOSTENT_BUFFER) || defined(USE_GRENT_BUFFER) || defined(USE_NETENT_BUFFER) || defined(USE_PWENT_BUFFER) || defined(USE_PROTOENT_BUFFER) || defined(USE_SERVENT_BUFFER)
925 # if defined(USE_SERVENT_BUFFER)
928 # if defined(USE_HOSTENT_BUFFER)
931 # if defined(USE_HOSTENT_BUFFER) || defined(USE_NETENT_BUFFER) || defined(USE_PROTOENT_BUFFER) || defined(USE_SERVENT_BUFFER)
938 switch (PL_op->op_type) {
939 #ifdef USE_HOSTENT_BUFFER
944 #ifdef PERL_REENTRANT_MAXSIZE
945 if (PL_reentrant_buffer->_hostent_size <=
946 PERL_REENTRANT_MAXSIZE / 2)
949 PL_reentrant_buffer->_hostent_size *= 2;
950 Renew(PL_reentrant_buffer->_hostent_buffer,
951 PL_reentrant_buffer->_hostent_size, char);
952 switch (PL_op->op_type) {
954 p0 = va_arg(ap, void *);
955 asize = va_arg(ap, size_t);
956 anint = va_arg(ap, int);
957 retptr = gethostbyaddr(p0, asize, anint); break;
959 p0 = va_arg(ap, void *);
960 retptr = gethostbyname((char *)p0); break;
962 retptr = gethostent(); break;
964 SETERRNO(ERANGE, LIB_INVARG);
971 #ifdef USE_GRENT_BUFFER
976 #ifdef PERL_REENTRANT_MAXSIZE
977 if (PL_reentrant_buffer->_grent_size <=
978 PERL_REENTRANT_MAXSIZE / 2)
982 PL_reentrant_buffer->_grent_size *= 2;
983 Renew(PL_reentrant_buffer->_grent_buffer,
984 PL_reentrant_buffer->_grent_size, char);
985 switch (PL_op->op_type) {
987 p0 = va_arg(ap, void *);
988 retptr = getgrnam((char *)p0); break;
990 #if Gid_t_size < INTSIZE
991 gid = (Gid_t)va_arg(ap, int);
993 gid = va_arg(ap, Gid_t);
995 retptr = getgrgid(gid); break;
997 retptr = getgrent(); break;
999 SETERRNO(ERANGE, LIB_INVARG);
1006 #ifdef USE_NETENT_BUFFER
1011 #ifdef PERL_REENTRANT_MAXSIZE
1012 if (PL_reentrant_buffer->_netent_size <=
1013 PERL_REENTRANT_MAXSIZE / 2)
1017 PL_reentrant_buffer->_netent_size *= 2;
1018 Renew(PL_reentrant_buffer->_netent_buffer,
1019 PL_reentrant_buffer->_netent_size, char);
1020 switch (PL_op->op_type) {
1022 net = va_arg(ap, Netdb_net_t);
1023 anint = va_arg(ap, int);
1024 retptr = getnetbyaddr(net, anint); break;
1026 p0 = va_arg(ap, void *);
1027 retptr = getnetbyname((char *)p0); break;
1029 retptr = getnetent(); break;
1031 SETERRNO(ERANGE, LIB_INVARG);
1038 #ifdef USE_PWENT_BUFFER
1043 #ifdef PERL_REENTRANT_MAXSIZE
1044 if (PL_reentrant_buffer->_pwent_size <=
1045 PERL_REENTRANT_MAXSIZE / 2)
1049 PL_reentrant_buffer->_pwent_size *= 2;
1050 Renew(PL_reentrant_buffer->_pwent_buffer,
1051 PL_reentrant_buffer->_pwent_size, char);
1052 switch (PL_op->op_type) {
1054 p0 = va_arg(ap, void *);
1055 retptr = getpwnam((char *)p0); break;
1057 #if Uid_t_size < INTSIZE
1058 uid = (Uid_t)va_arg(ap, int);
1060 uid = va_arg(ap, Uid_t);
1062 retptr = getpwuid(uid); break;
1064 retptr = getpwent(); break;
1066 SETERRNO(ERANGE, LIB_INVARG);
1073 #ifdef USE_PROTOENT_BUFFER
1078 #ifdef PERL_REENTRANT_MAXSIZE
1079 if (PL_reentrant_buffer->_protoent_size <=
1080 PERL_REENTRANT_MAXSIZE / 2)
1083 PL_reentrant_buffer->_protoent_size *= 2;
1084 Renew(PL_reentrant_buffer->_protoent_buffer,
1085 PL_reentrant_buffer->_protoent_size, char);
1086 switch (PL_op->op_type) {
1088 p0 = va_arg(ap, void *);
1089 retptr = getprotobyname((char *)p0); break;
1091 anint = va_arg(ap, int);
1092 retptr = getprotobynumber(anint); break;
1094 retptr = getprotoent(); break;
1096 SETERRNO(ERANGE, LIB_INVARG);
1103 #ifdef USE_SERVENT_BUFFER
1108 #ifdef PERL_REENTRANT_MAXSIZE
1109 if (PL_reentrant_buffer->_servent_size <=
1110 PERL_REENTRANT_MAXSIZE / 2)
1113 PL_reentrant_buffer->_servent_size *= 2;
1114 Renew(PL_reentrant_buffer->_servent_buffer,
1115 PL_reentrant_buffer->_servent_size, char);
1116 switch (PL_op->op_type) {
1118 p0 = va_arg(ap, void *);
1119 p1 = va_arg(ap, void *);
1120 retptr = getservbyname((char *)p0, (char *)p1); break;
1122 anint = va_arg(ap, int);
1123 p0 = va_arg(ap, void *);
1124 retptr = getservbyport(anint, (char *)p0); break;
1126 retptr = getservent(); break;
1128 SETERRNO(ERANGE, LIB_INVARG);
1136 /* Not known how to retry, so just fail. */
1148 asctime B_S |time |const struct tm|B_SB|B_SBI|I_SB|I_SBI
1149 crypt B_CC |crypt |struct crypt_data|B_CCS|B_CCD|D=CRYPTD*
1150 ctermid B_B |stdio | |B_B
1151 ctime B_S |time |const time_t |B_SB|B_SBI|I_SB|I_SBI
1152 drand48 d_V |stdlib |struct drand48_data |I_ST|T=double*|d=double
1153 endgrent |grp | |I_H|V_H
1154 endhostent |netdb | |I_D|V_D|D=struct hostent_data*
1155 endnetent |netdb | |I_D|V_D|D=struct netent_data*
1156 endprotoent |netdb | |I_D|V_D|D=struct protoent_data*
1157 endpwent |pwd | |I_H|V_H
1158 endservent |netdb | |I_D|V_D|D=struct servent_data*
1159 getgrent S_V |grp |struct group |I_SBWR|I_SBIR|S_SBW|S_SBI|I_SBI|I_SBIH
1160 getgrgid S_T |grp |struct group |I_TSBWR|I_TSBIR|I_TSBI|S_TSBI|T=gid_t
1161 getgrnam S_C |grp |struct group |I_CSBWR|I_CSBIR|S_CBI|I_CSBI|S_CSBI
1162 gethostbyaddr S_CWI |netdb |struct hostent |I_CWISBWRE|S_CWISBWIE|S_CWISBIE|S_TWISBIE|S_CIISBIE|S_CSBIE|S_TSBIE|I_CWISD|I_CIISD|I_CII|I_TsISBWRE|D=struct hostent_data*|T=const void*|s=socklen_t
1163 gethostbyname S_C |netdb |struct hostent |I_CSBWRE|S_CSBIE|I_CSD|D=struct hostent_data*
1164 gethostent S_V |netdb |struct hostent |I_SBWRE|I_SBIE|S_SBIE|S_SBI|I_SBI|I_SD|D=struct hostent_data*
1165 getlogin B_V |unistd |char |I_BW|I_BI|B_BW|B_BI
1166 getnetbyaddr S_LI |netdb |struct netent |I_UISBWRE|I_LISBI|S_TISBI|S_LISBI|I_TISD|I_LISD|I_IISD|I_uISBWRE|D=struct netent_data*|T=in_addr_t|U=unsigned long|u=uint32_t
1167 getnetbyname S_C |netdb |struct netent |I_CSBWRE|I_CSBI|S_CSBI|I_CSD|D=struct netent_data*
1168 getnetent S_V |netdb |struct netent |I_SBWRE|I_SBIE|S_SBIE|S_SBI|I_SBI|I_SD|D=struct netent_data*
1169 getprotobyname S_C |netdb |struct protoent|I_CSBWR|S_CSBI|I_CSD|D=struct protoent_data*
1170 getprotobynumber S_I |netdb |struct protoent|I_ISBWR|S_ISBI|I_ISD|D=struct protoent_data*
1171 getprotoent S_V |netdb |struct protoent|I_SBWR|I_SBI|S_SBI|I_SD|D=struct protoent_data*
1172 getpwent S_V |pwd |struct passwd |I_SBWR|I_SBIR|S_SBW|S_SBI|I_SBI|I_SBIH
1173 getpwnam S_C |pwd |struct passwd |I_CSBWR|I_CSBIR|S_CSBI|I_CSBI
1174 getpwuid S_T |pwd |struct passwd |I_TSBWR|I_TSBIR|I_TSBI|S_TSBI|T=uid_t
1175 getservbyname S_CC |netdb |struct servent |I_CCSBWR|S_CCSBI|I_CCSD|D=struct servent_data*
1176 getservbyport S_IC |netdb |struct servent |I_ICSBWR|S_ICSBI|I_ICSD|D=struct servent_data*
1177 getservent S_V |netdb |struct servent |I_SBWR|I_SBI|S_SBI|I_SD|D=struct servent_data*
1178 getspnam S_C |shadow |struct spwd |I_CSBWR|S_CSBI
1179 gmtime S_T |time |struct tm |S_TS|I_TS|T=const time_t*
1180 localtime S_T |time |struct tm |S_TS|I_TS|T=const time_t*
1181 random L_V |stdlib |struct random_data|I_iS|I_lS|I_St|i=int*|l=long*|t=int32_t*
1182 readdir S_T |dirent |struct dirent |I_TSR|I_TS|T=DIR*
1183 readdir64 S_T |dirent |struct dirent64|I_TSR|I_TS|T=DIR*
1184 setgrent |grp | |I_H|V_H
1185 sethostent V_I |netdb | |I_ID|V_ID|D=struct hostent_data*
1186 setlocale B_IC |locale | |I_ICBI
1187 setnetent V_I |netdb | |I_ID|V_ID|D=struct netent_data*
1188 setprotoent V_I |netdb | |I_ID|V_ID|D=struct protoent_data*
1189 setpwent |pwd | |I_H|V_H
1190 setservent V_I |netdb | |I_ID|V_ID|D=struct servent_data*
1191 srand48 V_L |stdlib |struct drand48_data |I_LS
1192 srandom V_T |stdlib |struct random_data|I_TS|T=unsigned int
1193 strerror B_I |string | |I_IBW|I_IBI|B_IBW
1194 tmpnam B_B |stdio | |B_B
1195 ttyname B_I |unistd | |I_IBW|I_IBI|B_IBI