4 # Generate the reentr.c and reentr.h,
5 # and optionally also the relevant metaconfig units (-U option).
15 A => "char*", # as an input argument
16 B => "char*", # as an output argument
17 C => "const char*", # as a read-only input argument
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".)
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".
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)
38 die "reentr.h: $!" unless open(H, ">reentr.h");
44 * Copyright (C) 2002, 2003, 2005 by Larry Wall and others
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.
49 * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
50 * This file is built by reentr.pl from data in reentr.pl.
56 #ifdef USE_REENTRANT_API
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. */
67 # undef HAS_ENDGRENT_R
68 # undef HAS_ENDPWENT_R
69 # undef HAS_GETGRENT_R
70 # undef HAS_GETPWENT_R
71 # undef HAS_SETLOCALE_R
73 # undef HAS_STRERROR_R
74 # define NETDB_R_OBSOLETE
77 #if defined(__osf__) && defined(__alpha) /* Tru64 aka Digital UNIX */
79 # undef HAS_STRERROR_R
80 # define NETDB_R_OBSOLETE
84 * As of OpenBSD 3.7, reentrant functions are now working, they just are
85 * incompatible with everyone else. To make OpenBSD happy, we have to
86 * memzero out certain structures before calling the functions.
88 #if defined(__OpenBSD__)
89 # define REENTR_MEMZERO(a,b) memzero(a,b),
91 # define REENTR_MEMZERO(a,b)
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
152 while (<DATA>) { # Read in the protypes.
155 my ($func, $hdr, $type, @p) = split(/\s*\|\s*/, $_, -1);
157 # Split off the real function name and the argument list.
158 ($func, $u) = split(' ', $func);
159 $seenu{$func} = defined $u ? length $u : 0;
160 my $FUNC = uc $func; # for output.
168 # Set any special mapping variables (like X=x_t)
170 while ($p[-1] =~ /=/) {
171 my ($k, $v) = ($p[-1] =~ /^([A-Za-z])\s*=\s*(.*)/);
177 # If given the -U option open up the metaconfig unit for this function.
178 if ($opts{U} && open(U, ">d_${func}_r.U")) {
183 # The metaconfig units needs prerequisite dependencies.
187 if ($hdr ne 'stdio') { # There's no i_stdio.
190 $prereqsh = "\$$prereqs $prereqh";
192 my @prereq = qw(Inlibc Protochk Hasproto i_systypes usethreads);
193 push @prereq, $prereqs;
194 my $hdrs = "\$i_systypes sys/types.h define stdio.h $prereqsh";
195 if ($hdr eq 'time') {
196 $hdrs .= " \$i_systime sys/time.h";
197 push @prereq, 'i_systime';
199 # Output the metaconfig unit header.
201 ?RCS: \$Id: d_${func}_r.U,v $
203 ?RCS: Copyright (c) 2002,2003 Jarkko Hietaniemi
205 ?RCS: You may distribute under the terms of either the GNU General Public
206 ?RCS: License or the Artistic License, as specified in the README file.
208 ?RCS: Generated by the reentr.pl from the Perl 5.8 distribution.
210 ?MAKE:d_${func}_r ${func}_r_proto: @prereq
211 ?MAKE: -pick add \$@ %<
213 ?S: This variable conditionally defines the HAS_${FUNC}_R symbol,
214 ?S: which indicates to the C program that the ${func}_r()
215 ?S: routine is available.
218 ?S: This variable encodes the prototype of ${func}_r.
219 ?S: It is zero if d_${func}_r is undef, and one of the
220 ?S: REENTRANT_PROTO_T_ABC macros of reentr.h if d_${func}_r
224 ?C: This symbol, if defined, indicates that the ${func}_r routine
225 ?C: is available to ${func} re-entrantly.
228 ?C: This symbol encodes the prototype of ${func}_r.
229 ?C: It is zero if d_${func}_r is undef, and one of the
230 ?C: REENTRANT_PROTO_T_ABC macros of reentr.h if d_${func}_r
233 ?H:#\$d_${func}_r HAS_${FUNC}_R /**/
234 ?H:#define ${FUNC}_R_PROTO \$${func}_r_proto /**/
236 ?T:try hdrs d_${func}_r_proto
237 ?LINT:set d_${func}_r
238 ?LINT:set ${func}_r_proto
239 : see if ${func}_r exists
240 set ${func}_r d_${func}_r
242 case "\$d_${func}_r" in
247 case "\$d_${func}_r_proto:\$usethreads" in
248 ":define") d_${func}_r_proto=define
249 set d_${func}_r_proto ${func}_r \$hdrs
253 case "\$d_${func}_r_proto" in
258 my ($r, $a) = ($p =~ /^(.)_(.+)/);
259 my $v = join(", ", map { $m{$_} } split '', $a);
262 case "\$${func}_r_proto" in
263 ''|0) try='$m{$r} ${func}_r($v);'
264 ./protochk "extern \$try" \$hdrs && ${func}_r_proto=$p ;;
268 $seenh{$func}->{$p}++;
269 push @{$seena{$func}}, $p;
271 $seent{$func} = $type;
272 $seens{$func} = $m{S};
273 $seend{$func} = $m{D};
278 case "\$${func}_r_proto" in
279 ''|0) d_${func}_r=undef
281 echo "Disabling ${func}_r, cannot determine prototype." >&4 ;;
282 * ) case "\$${func}_r_proto" in
284 *) ${func}_r_proto="REENTRANT_PROTO_\$${func}_r_proto" ;;
286 echo "Prototype: \$try" ;;
289 *) case "\$usethreads" in
290 define) echo "${func}_r has no prototype, not using it." >&4 ;;
308 # Prepare to continue writing the reentr.h.
313 # Write out all the known prototype signatures.
315 for my $p (sort keys %seenp) {
316 print "#define REENTRANT_PROTO_${p} ${i}\n";
321 my @struct; # REENTR struct members
322 my @size; # struct member buffer size initialization code
323 my @init; # struct member buffer initialization (malloc) code
324 my @free; # struct member buffer release (free) code
325 my @wrap; # the wrapper (foo(a) -> foo_r(a,...)) cpp code
326 my @define; # defines for optional features
330 join " || ", map { "${FUNC}_R_PROTO == REENTRANT_PROTO_$_" } @_;
343 New(31338, PL_reentrant_buffer->_${func}_buffer, PL_reentrant_buffer->_${func}_size, char);
346 Safefree(PL_reentrant_buffer->_${func}_buffer);
351 my ($n, $p, @F) = @_;
355 /* The @F using \L$n? */
361 my $HAS = "${FUNC}_R_HAS_$n";
363 my @h = grep { /$p/ } @{$seena{$func}};
364 unless (defined $GENFUNC) {
366 $GENFUNC =~ s/^GET//;
369 push @define, "#if defined(HAS_${FUNC}_R) && (" . join(" || ", map { "${FUNC}_R_PROTO == REENTRANT_PROTO_$_" } @h) . ")\n";
382 /* Any of the @F using \L$n? */
385 push @define, "#if (" . join(" || ", map { "defined($_)" } @H) . ")\n";
387 # define USE_${GENFUNC}_$n
389 # undef USE_${GENFUNC}_$n
395 define('BUFFER', 'B',
396 qw(getgrent getgrgid getgrnam));
399 qw(getgrent getgrgid getgrnam));
401 qw(getpwent getpwnam getpwuid));
403 qw(getspent getspnam));
406 qw(getgrent getgrgid getgrnam setgrent endgrent));
408 qw(getpwent getpwnam getpwuid setpwent endpwent));
410 define('BUFFER', 'B',
411 qw(getpwent getpwgid getpwnam));
414 qw(gethostent gethostbyaddr gethostbyname));
416 qw(getnetent getnetbyaddr getnetbyname));
418 qw(getprotoent getprotobyname getprotobynumber));
420 qw(getservent getservbyname getservbyport));
422 define('BUFFER', 'B',
423 qw(gethostent gethostbyaddr gethostbyname));
424 define('BUFFER', 'B',
425 qw(getnetent getnetbyaddr getnetbyname));
426 define('BUFFER', 'B',
427 qw(getprotoent getprotobyname getprotobynumber));
428 define('BUFFER', 'B',
429 qw(getservent getservbyname getservbyport));
432 qw(gethostent gethostbyaddr gethostbyname));
434 qw(getnetent getnetbyaddr getnetbyname));
436 # The following loop accumulates the "ssif" (struct, size, init, free)
437 # sections that declare the struct members (in reentr.h), and the buffer
438 # size initialization, buffer initialization (malloc), and buffer
439 # release (free) code (in reentr.c).
441 # The loop also contains a lot of intrinsic logic about groups of
442 # functions (since functions of certain kind operate the same way).
444 for my $func (@seenf) {
446 my $ifdef = "#ifdef HAS_${FUNC}_R\n";
447 my $endif = "#endif /* HAS_${FUNC}_R */\n";
448 if (exists $seena{$func}) {
449 my @p = @{$seena{$func}};
450 if ($func =~ /^(asctime|ctime|getlogin|setlocale|strerror|ttyname)$/) {
453 char* _${func}_buffer;
454 size_t _${func}_size;
457 PL_reentrant_buffer->_${func}_size = REENTRANTSMALLSIZE;
462 elsif ($func =~ /^(crypt)$/) {
465 #if CRYPT_R_PROTO == REENTRANT_PROTO_B_CCD
466 $seend{$func} _${func}_data;
468 $seent{$func} *_${func}_struct_buffer;
472 #if CRYPT_R_PROTO != REENTRANT_PROTO_B_CCD
473 PL_reentrant_buffer->_${func}_struct_buffer = 0;
477 #if CRYPT_R_PROTO != REENTRANT_PROTO_B_CCD
478 Safefree(PL_reentrant_buffer->_${func}_struct_buffer);
483 elsif ($func =~ /^(drand48|gmtime|localtime|random|srandom)$/) {
486 $seent{$func} _${func}_struct;
488 if ($1 eq 'drand48') {
490 double _${func}_double;
492 } elsif ($1 eq 'random') {
494 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_iS
497 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_lS
498 long _${func}_retval;
500 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_St
501 int32_t _${func}_retval;
507 elsif ($func =~ /^(getgrnam|getpwnam|getspnam)$/) {
509 # 'genfunc' can be read either as 'generic' or 'genre',
510 # it represents a group of functions.
512 $genfunc =~ s/nam/ent/g;
513 $genfunc =~ s/^get//;
514 my $GENFUNC = uc $genfunc;
516 $seent{$func} _${genfunc}_struct;
517 char* _${genfunc}_buffer;
518 size_t _${genfunc}_size;
521 # ifdef USE_${GENFUNC}_PTR
522 $seent{$func}* _${genfunc}_ptr;
526 # ifdef USE_${GENFUNC}_FPTR
527 FILE* _${genfunc}_fptr;
531 # ifdef USE_${GENFUNC}_FPTR
532 PL_reentrant_buffer->_${genfunc}_fptr = NULL;
535 my $sc = $genfunc eq 'grent' ?
536 '_SC_GETGR_R_SIZE_MAX' : '_SC_GETPW_R_SIZE_MAX';
537 my $sz = "_${genfunc}_size";
539 # if defined(HAS_SYSCONF) && defined($sc) && !defined(__GLIBC__)
540 PL_reentrant_buffer->$sz = sysconf($sc);
541 if (PL_reentrant_buffer->$sz == -1)
542 PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE;
544 # if defined(__osf__) && defined(__alpha) && defined(SIABUFSIZ)
545 PL_reentrant_buffer->$sz = SIABUFSIZ;
548 PL_reentrant_buffer->$sz = BUFSIZ;
550 PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE;
555 pushinitfree $genfunc;
558 elsif ($func =~ /^(gethostbyname|getnetbyname|getservbyname|getprotobyname)$/) {
561 $genfunc =~ s/byname/ent/;
562 $genfunc =~ s/^get//;
563 my $GENFUNC = uc $genfunc;
564 my $D = ifprotomatch($FUNC, grep {/D/} @p);
565 my $d = $seend{$func};
566 $d =~ s/\*$//; # snip: we need need the base type.
568 $seent{$func} _${genfunc}_struct;
572 char* _${genfunc}_buffer;
573 size_t _${genfunc}_size;
575 # ifdef USE_${GENFUNC}_PTR
576 $seent{$func}* _${genfunc}_ptr;
580 # ifdef USE_${GENFUNC}_ERRNO
581 int _${genfunc}_errno;
586 PL_reentrant_buffer->_${genfunc}_size = REENTRANTUSUALSIZE;
591 New(31338, PL_reentrant_buffer->_${genfunc}_buffer, PL_reentrant_buffer->_${genfunc}_size, char);
596 Safefree(PL_reentrant_buffer->_${genfunc}_buffer);
601 elsif ($func =~ /^(readdir|readdir64)$/) {
603 my $R = ifprotomatch($FUNC, grep {/R/} @p);
605 $seent{$func}* _${func}_struct;
606 size_t _${func}_size;
608 $seent{$func}* _${func}_ptr;
612 /* This is the size Solaris recommends.
613 * (though we go static, should use pathconf() instead) */
614 PL_reentrant_buffer->_${func}_size = sizeof($seent{$func}) + MAXPATHLEN + 1;
617 PL_reentrant_buffer->_${func}_struct = ($seent{$func}*)safemalloc(PL_reentrant_buffer->_${func}_size);
620 Safefree(PL_reentrant_buffer->_${func}_struct);
631 # Write out what we have learned.
634 my $v = join(", ", @v[0..$seenu{$func}-1]);
636 my ($r, $a) = split '_', $p;
637 my $test = $r eq 'I' ? ' == 0' : '';
640 if ($genfunc =~ /^(?:get|set|end)(pw|gr|host|net|proto|serv|sp)/) {
641 $genfunc = "${1}ent";
642 } elsif ($genfunc eq 'srand48') {
643 $genfunc = "drand48";
647 substr($b, 0, $seenu{$func}) = '';
648 if ($func =~ /^random$/) {
649 $true = "PL_reentrant_buffer->_random_retval";
650 } elsif ($b =~ /R/) {
651 $true = "PL_reentrant_buffer->_${genfunc}_ptr";
652 } elsif ($b =~ /T/ && $func eq 'drand48') {
653 $true = "PL_reentrant_buffer->_${genfunc}_double";
654 } elsif ($b =~ /S/) {
655 if ($func =~ /^readdir/) {
656 $true = "PL_reentrant_buffer->_${genfunc}_struct";
658 $true = "&PL_reentrant_buffer->_${genfunc}_struct";
660 } elsif ($b =~ /B/) {
661 $true = "PL_reentrant_buffer->_${genfunc}_buffer";
667 "&PL_reentrant_buffer->_${genfunc}_ptr" :
669 "&PL_reentrant_buffer->_${genfunc}_errno" :
671 "PL_reentrant_buffer->_${genfunc}_buffer" :
673 "PL_reentrant_buffer->_${genfunc}_size" :
675 "&PL_reentrant_buffer->_${genfunc}_fptr" :
677 "&PL_reentrant_buffer->_${genfunc}_data" :
679 ($func =~ /^readdir\d*$/ ?
680 "PL_reentrant_buffer->_${genfunc}_struct" :
682 "PL_reentrant_buffer->_${genfunc}_struct_buffer" :
683 "&PL_reentrant_buffer->_${genfunc}_struct") :
684 $_ eq 'T' && $func eq 'drand48' ?
685 "&PL_reentrant_buffer->_${genfunc}_double" :
686 $_ =~ /^[ilt]$/ && $func eq 'random' ?
687 "&PL_reentrant_buffer->_random_retval" :
690 $w = ", $w" if length $v;
692 my $call = "${func}_r($v$w)";
694 # Must make OpenBSD happy
697 ($genfunc eq 'protoent' || $genfunc eq 'servent')) {
698 $memzero = 'REENTR_MEMZERO(&PL_reentrant_buffer->_' . $genfunc . '_data, sizeof(PL_reentrant_buffer->_' . $genfunc . '_data))';
701 # if !defined($func) && ${FUNC}_R_PROTO == REENTRANT_PROTO_$p
703 if ($r eq 'V' || $r eq 'B') {
705 # define $func($v) $call
708 if ($func =~ /^get/) {
709 my $rv = $v ? ", $v" : "";
712 # define $func($v) ($memzero(PL_reentrant_retint = $call)$test ? $true : (((PL_reentrant_retint == ERANGE) || (errno == ERANGE)) ? ($seent{$func} *) Perl_reentrant_retry("$func"$rv) : 0))
716 # define $func($v) ($call$test ? $true : ((errno == ERANGE) ? ($seent{$func} *) Perl_reentrant_retry("$func"$rv) : 0))
721 # define $func($v) ($call$test ? $true : 0)
730 push @wrap, $endif, "\n";
738 /* Defines for indicating which special features are supported. */
743 int dummy; /* cannot have empty structs */
750 #endif /* USE_REENTRANT_API */
758 # Prepare to write the reentr.c.
760 die "reentr.c: $!" unless open(C, ">reentr.c");
766 * Copyright (C) 2002, 2003, by Larry Wall and others
768 * You may distribute under the terms of either the GNU General Public
769 * License or the Artistic License, as specified in the README file.
771 * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
772 * This file is built by reentr.pl from data in reentr.pl.
774 * "Saruman," I said, standing away from him, "only one hand at a time can
775 * wield the One, and you know that well, so do not trouble to say we!"
777 * This file contains a collection of automatically created wrappers
778 * (created by running reentr.pl) for reentrant (thread-safe) versions of
779 * various library calls, such as getpwent_r. The wrapping is done so
780 * that other files like pp_sys.c calling those library functions need not
781 * care about the differences between various platforms' idiosyncrasies
782 * regarding these reentrant interfaces.
786 #define PERL_IN_REENTR_C
791 Perl_reentrant_size(pTHX) {
792 #ifdef USE_REENTRANT_API
793 #define REENTRANTSMALLSIZE 256 /* Make something up. */
794 #define REENTRANTUSUALSIZE 4096 /* Make something up. */
796 #endif /* USE_REENTRANT_API */
800 Perl_reentrant_init(pTHX) {
801 #ifdef USE_REENTRANT_API
802 New(31337, PL_reentrant_buffer, 1, REENTR);
803 Perl_reentrant_size(aTHX);
805 #endif /* USE_REENTRANT_API */
809 Perl_reentrant_free(pTHX) {
810 #ifdef USE_REENTRANT_API
812 Safefree(PL_reentrant_buffer);
813 #endif /* USE_REENTRANT_API */
817 Perl_reentrant_retry(const char *f, ...)
821 #ifdef USE_REENTRANT_API
822 # 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)
825 # if defined(USE_SERVENT_BUFFER)
828 # if defined(USE_HOSTENT_BUFFER)
831 # if defined(USE_HOSTENT_BUFFER) || defined(USE_NETENT_BUFFER) || defined(USE_PROTOENT_BUFFER) || defined(USE_SERVENT_BUFFER)
838 switch (PL_op->op_type) {
839 #ifdef USE_HOSTENT_BUFFER
844 #ifdef PERL_REENTRANT_MAXSIZE
845 if (PL_reentrant_buffer->_hostent_size <=
846 PERL_REENTRANT_MAXSIZE / 2)
849 PL_reentrant_buffer->_hostent_size *= 2;
850 Renew(PL_reentrant_buffer->_hostent_buffer,
851 PL_reentrant_buffer->_hostent_size, char);
852 switch (PL_op->op_type) {
854 p0 = va_arg(ap, void *);
855 asize = va_arg(ap, size_t);
856 anint = va_arg(ap, int);
857 retptr = gethostbyaddr(p0, asize, anint); break;
859 p0 = va_arg(ap, void *);
860 retptr = gethostbyname((char *)p0); break;
862 retptr = gethostent(); break;
864 SETERRNO(ERANGE, LIB_INVARG);
871 #ifdef USE_GRENT_BUFFER
876 #ifdef PERL_REENTRANT_MAXSIZE
877 if (PL_reentrant_buffer->_grent_size <=
878 PERL_REENTRANT_MAXSIZE / 2)
882 PL_reentrant_buffer->_grent_size *= 2;
883 Renew(PL_reentrant_buffer->_grent_buffer,
884 PL_reentrant_buffer->_grent_size, char);
885 switch (PL_op->op_type) {
887 p0 = va_arg(ap, void *);
888 retptr = getgrnam((char *)p0); break;
890 #if Gid_t_size < INTSIZE
891 gid = (Gid_t)va_arg(ap, int);
893 gid = va_arg(ap, Gid_t);
895 retptr = getgrgid(gid); break;
897 retptr = getgrent(); break;
899 SETERRNO(ERANGE, LIB_INVARG);
906 #ifdef USE_NETENT_BUFFER
911 #ifdef PERL_REENTRANT_MAXSIZE
912 if (PL_reentrant_buffer->_netent_size <=
913 PERL_REENTRANT_MAXSIZE / 2)
917 PL_reentrant_buffer->_netent_size *= 2;
918 Renew(PL_reentrant_buffer->_netent_buffer,
919 PL_reentrant_buffer->_netent_size, char);
920 switch (PL_op->op_type) {
922 net = va_arg(ap, Netdb_net_t);
923 anint = va_arg(ap, int);
924 retptr = getnetbyaddr(net, anint); break;
926 p0 = va_arg(ap, void *);
927 retptr = getnetbyname((char *)p0); break;
929 retptr = getnetent(); break;
931 SETERRNO(ERANGE, LIB_INVARG);
938 #ifdef USE_PWENT_BUFFER
943 #ifdef PERL_REENTRANT_MAXSIZE
944 if (PL_reentrant_buffer->_pwent_size <=
945 PERL_REENTRANT_MAXSIZE / 2)
949 PL_reentrant_buffer->_pwent_size *= 2;
950 Renew(PL_reentrant_buffer->_pwent_buffer,
951 PL_reentrant_buffer->_pwent_size, char);
952 switch (PL_op->op_type) {
954 p0 = va_arg(ap, void *);
955 retptr = getpwnam((char *)p0); break;
957 #if Uid_t_size < INTSIZE
958 uid = (Uid_t)va_arg(ap, int);
960 uid = va_arg(ap, Uid_t);
962 retptr = getpwuid(uid); break;
964 retptr = getpwent(); break;
966 SETERRNO(ERANGE, LIB_INVARG);
973 #ifdef USE_PROTOENT_BUFFER
978 #ifdef PERL_REENTRANT_MAXSIZE
979 if (PL_reentrant_buffer->_protoent_size <=
980 PERL_REENTRANT_MAXSIZE / 2)
983 PL_reentrant_buffer->_protoent_size *= 2;
984 Renew(PL_reentrant_buffer->_protoent_buffer,
985 PL_reentrant_buffer->_protoent_size, char);
986 switch (PL_op->op_type) {
988 p0 = va_arg(ap, void *);
989 retptr = getprotobyname((char *)p0); break;
991 anint = va_arg(ap, int);
992 retptr = getprotobynumber(anint); break;
994 retptr = getprotoent(); break;
996 SETERRNO(ERANGE, LIB_INVARG);
1003 #ifdef USE_SERVENT_BUFFER
1008 #ifdef PERL_REENTRANT_MAXSIZE
1009 if (PL_reentrant_buffer->_servent_size <=
1010 PERL_REENTRANT_MAXSIZE / 2)
1013 PL_reentrant_buffer->_servent_size *= 2;
1014 Renew(PL_reentrant_buffer->_servent_buffer,
1015 PL_reentrant_buffer->_servent_size, char);
1016 switch (PL_op->op_type) {
1018 p0 = va_arg(ap, void *);
1019 p1 = va_arg(ap, void *);
1020 retptr = getservbyname((char *)p0, (char *)p1); break;
1022 anint = va_arg(ap, int);
1023 p0 = va_arg(ap, void *);
1024 retptr = getservbyport(anint, (char *)p0); break;
1026 retptr = getservent(); break;
1028 SETERRNO(ERANGE, LIB_INVARG);
1036 /* Not known how to retry, so just fail. */
1048 asctime S |time |const struct tm|B_SB|B_SBI|I_SB|I_SBI
1049 crypt CC |crypt |struct crypt_data|B_CCS|B_CCD|D=CRYPTD*
1050 ctermid B |stdio | |B_B
1051 ctime S |time |const time_t |B_SB|B_SBI|I_SB|I_SBI
1052 drand48 |stdlib |struct drand48_data |I_ST|T=double*
1053 endgrent |grp | |I_H|V_H
1054 endhostent |netdb | |I_D|V_D|D=struct hostent_data*
1055 endnetent |netdb | |I_D|V_D|D=struct netent_data*
1056 endprotoent |netdb | |I_D|V_D|D=struct protoent_data*
1057 endpwent |pwd | |I_H|V_H
1058 endservent |netdb | |I_D|V_D|D=struct servent_data*
1059 getgrent |grp |struct group |I_SBWR|I_SBIR|S_SBW|S_SBI|I_SBI|I_SBIH
1060 getgrgid T |grp |struct group |I_TSBWR|I_TSBIR|I_TSBI|S_TSBI|T=gid_t
1061 getgrnam C |grp |struct group |I_CSBWR|I_CSBIR|S_CBI|I_CSBI|S_CSBI
1062 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|I_TsISBWRE|D=struct hostent_data*|T=const void*|s=socklen_t
1063 gethostbyname C |netdb |struct hostent |I_CSBWRE|S_CSBIE|I_CSD|D=struct hostent_data*
1064 gethostent |netdb |struct hostent |I_SBWRE|I_SBIE|S_SBIE|S_SBI|I_SBI|I_SD|D=struct hostent_data*
1065 getlogin |unistd |char |I_BW|I_BI|B_BW|B_BI
1066 getnetbyaddr 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
1067 getnetbyname C |netdb |struct netent |I_CSBWRE|I_CSBI|S_CSBI|I_CSD|D=struct netent_data*
1068 getnetent |netdb |struct netent |I_SBWRE|I_SBIE|S_SBIE|S_SBI|I_SBI|I_SD|D=struct netent_data*
1069 getprotobyname C|netdb |struct protoent|I_CSBWR|S_CSBI|I_CSD|D=struct protoent_data*
1070 getprotobynumber I |netdb |struct protoent|I_ISBWR|S_ISBI|I_ISD|D=struct protoent_data*
1071 getprotoent |netdb |struct protoent|I_SBWR|I_SBI|S_SBI|I_SD|D=struct protoent_data*
1072 getpwent |pwd |struct passwd |I_SBWR|I_SBIR|S_SBW|S_SBI|I_SBI|I_SBIH
1073 getpwnam C |pwd |struct passwd |I_CSBWR|I_CSBIR|S_CSBI|I_CSBI
1074 getpwuid T |pwd |struct passwd |I_TSBWR|I_TSBIR|I_TSBI|S_TSBI|T=uid_t
1075 getservbyname CC|netdb |struct servent |I_CCSBWR|S_CCSBI|I_CCSD|D=struct servent_data*
1076 getservbyport IC|netdb |struct servent |I_ICSBWR|S_ICSBI|I_ICSD|D=struct servent_data*
1077 getservent |netdb |struct servent |I_SBWR|I_SBI|S_SBI|I_SD|D=struct servent_data*
1078 getspnam C |shadow |struct spwd |I_CSBWR|S_CSBI
1079 gmtime T |time |struct tm |S_TS|I_TS|T=const time_t*
1080 localtime T |time |struct tm |S_TS|I_TS|T=const time_t*
1081 random |stdlib |struct random_data|I_iS|I_lS|I_St|i=int*|l=long*|t=int32_t*
1082 readdir T |dirent |struct dirent |I_TSR|I_TS|T=DIR*
1083 readdir64 T |dirent |struct dirent64|I_TSR|I_TS|T=DIR*
1084 setgrent |grp | |I_H|V_H
1085 sethostent I |netdb | |I_ID|V_ID|D=struct hostent_data*
1086 setlocale IC |locale | |I_ICBI
1087 setnetent I |netdb | |I_ID|V_ID|D=struct netent_data*
1088 setprotoent I |netdb | |I_ID|V_ID|D=struct protoent_data*
1089 setpwent |pwd | |I_H|V_H
1090 setservent I |netdb | |I_ID|V_ID|D=struct servent_data*
1091 srand48 L |stdlib |struct drand48_data |I_LS
1092 srandom T |stdlib |struct random_data|I_TS|T=unsigned int
1093 strerror I |string | |I_IBW|I_IBI|B_IBW
1094 tmpnam B |stdio | |B_B
1095 ttyname I |unistd | |I_IBW|I_IBI|B_IBI