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");
47 /* -*- buffer-read-only: t -*-
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
65 /* Deprecations: some platforms have the said reentrant interfaces
66 * but they are declared obsolete and are not to be used. Often this
67 * means that the platform has threadsafed the interfaces (hopefully).
68 * All this is OS version dependent, so we are of course fooling ourselves.
69 * If you know of more deprecations on some platforms, please add your own. */
74 # undef HAS_ENDGRENT_R
75 # undef HAS_ENDPWENT_R
76 # undef HAS_GETGRENT_R
77 # undef HAS_GETPWENT_R
78 # undef HAS_SETLOCALE_R
80 # undef HAS_STRERROR_R
81 # define NETDB_R_OBSOLETE
84 #if defined(__osf__) && defined(__alpha) /* Tru64 aka Digital UNIX */
86 # undef HAS_STRERROR_R
87 # define NETDB_R_OBSOLETE
91 * As of OpenBSD 3.7, reentrant functions are now working, they just are
92 * incompatible with everyone else. To make OpenBSD happy, we have to
93 * memzero out certain structures before calling the functions.
95 #if defined(__OpenBSD__)
96 # define REENTR_MEMZERO(a,b) memzero(a,b),
98 # define REENTR_MEMZERO(a,b)
101 #ifdef NETDB_R_OBSOLETE
102 # undef HAS_ENDHOSTENT_R
103 # undef HAS_ENDNETENT_R
104 # undef HAS_ENDPROTOENT_R
105 # undef HAS_ENDSERVENT_R
106 # undef HAS_GETHOSTBYADDR_R
107 # undef HAS_GETHOSTBYNAME_R
108 # undef HAS_GETHOSTENT_R
109 # undef HAS_GETNETBYADDR_R
110 # undef HAS_GETNETBYNAME_R
111 # undef HAS_GETNETENT_R
112 # undef HAS_GETPROTOBYNAME_R
113 # undef HAS_GETPROTOBYNUMBER_R
114 # undef HAS_GETPROTOENT_R
115 # undef HAS_GETSERVBYNAME_R
116 # undef HAS_GETSERVBYPORT_R
117 # undef HAS_GETSERVENT_R
118 # undef HAS_SETHOSTENT_R
119 # undef HAS_SETNETENT_R
120 # undef HAS_SETPROTOENT_R
121 # undef HAS_SETSERVENT_R
134 # include <stdlib.h> /* drand48_data */
141 #ifdef HAS_GETSPNAM_R
149 my %seenh; # the different prototypes signatures for this function
150 my %seena; # the different prototypes signatures for this function in order
151 my @seenf; # all the seen functions
152 my %seenp; # the different prototype signatures for all functions
153 my %seent; # the return type of this function
154 my %seens; # the type of this function's "S"
155 my %seend; # the type of this function's "D"
156 my %seenm; # all the types
157 my %seenu; # the length of the argument list of this function
159 while (<DATA>) { # Read in the protypes.
162 my ($func, $hdr, $type, @p) = split(/\s*\|\s*/, $_, -1);
164 # Split off the real function name and the argument list.
165 ($func, $u) = split(' ', $func);
166 $seenu{$func} = defined $u ? length $u : 0;
167 my $FUNC = uc $func; # for output.
175 # Set any special mapping variables (like X=x_t)
177 while ($p[-1] =~ /=/) {
178 my ($k, $v) = ($p[-1] =~ /^([A-Za-z])\s*=\s*(.*)/);
184 # If given the -U option open up the metaconfig unit for this function.
185 if ($opts{U} && open(U, ">d_${func}_r.U")) {
190 # The metaconfig units needs prerequisite dependencies.
194 if ($hdr ne 'stdio') { # There's no i_stdio.
197 $prereqsh = "\$$prereqs $prereqh";
199 my @prereq = qw(Inlibc Protochk Hasproto i_systypes usethreads);
200 push @prereq, $prereqs;
201 my $hdrs = "\$i_systypes sys/types.h define stdio.h $prereqsh";
202 if ($hdr eq 'time') {
203 $hdrs .= " \$i_systime sys/time.h";
204 push @prereq, 'i_systime';
206 # Output the metaconfig unit header.
208 ?RCS: \$Id: d_${func}_r.U,v $
210 ?RCS: Copyright (c) 2002,2003 Jarkko Hietaniemi
212 ?RCS: You may distribute under the terms of either the GNU General Public
213 ?RCS: License or the Artistic License, as specified in the README file.
215 ?RCS: Generated by the reentr.pl from the Perl 5.8 distribution.
217 ?MAKE:d_${func}_r ${func}_r_proto: @prereq
218 ?MAKE: -pick add \$@ %<
220 ?S: This variable conditionally defines the HAS_${FUNC}_R symbol,
221 ?S: which indicates to the C program that the ${func}_r()
222 ?S: routine is available.
225 ?S: This variable encodes the prototype of ${func}_r.
226 ?S: It is zero if d_${func}_r is undef, and one of the
227 ?S: REENTRANT_PROTO_T_ABC macros of reentr.h if d_${func}_r
231 ?C: This symbol, if defined, indicates that the ${func}_r routine
232 ?C: is available to ${func} re-entrantly.
235 ?C: This symbol encodes the prototype of ${func}_r.
236 ?C: It is zero if d_${func}_r is undef, and one of the
237 ?C: REENTRANT_PROTO_T_ABC macros of reentr.h if d_${func}_r
240 ?H:#\$d_${func}_r HAS_${FUNC}_R /**/
241 ?H:#define ${FUNC}_R_PROTO \$${func}_r_proto /**/
243 ?T:try hdrs d_${func}_r_proto
244 ?LINT:set d_${func}_r
245 ?LINT:set ${func}_r_proto
246 : see if ${func}_r exists
247 set ${func}_r d_${func}_r
249 case "\$d_${func}_r" in
254 case "\$d_${func}_r_proto:\$usethreads" in
255 ":define") d_${func}_r_proto=define
256 set d_${func}_r_proto ${func}_r \$hdrs
260 case "\$d_${func}_r_proto" in
265 my ($r, $a) = ($p =~ /^(.)_(.+)/);
266 my $v = join(", ", map { $m{$_} } split '', $a);
269 case "\$${func}_r_proto" in
270 ''|0) try='$m{$r} ${func}_r($v);'
271 ./protochk "extern \$try" \$hdrs && ${func}_r_proto=$p ;;
275 $seenh{$func}->{$p}++;
276 push @{$seena{$func}}, $p;
278 $seent{$func} = $type;
279 $seens{$func} = $m{S};
280 $seend{$func} = $m{D};
285 case "\$${func}_r_proto" in
286 ''|0) d_${func}_r=undef
288 echo "Disabling ${func}_r, cannot determine prototype." >&4 ;;
289 * ) case "\$${func}_r_proto" in
291 *) ${func}_r_proto="REENTRANT_PROTO_\$${func}_r_proto" ;;
293 echo "Prototype: \$try" ;;
296 *) case "\$usethreads" in
297 define) echo "${func}_r has no prototype, not using it." >&4 ;;
315 # Prepare to continue writing the reentr.h.
320 # Write out all the known prototype signatures.
322 for my $p (sort keys %seenp) {
323 print "#define REENTRANT_PROTO_${p} ${i}\n";
328 my @struct; # REENTR struct members
329 my @size; # struct member buffer size initialization code
330 my @init; # struct member buffer initialization (malloc) code
331 my @free; # struct member buffer release (free) code
332 my @wrap; # the wrapper (foo(a) -> foo_r(a,...)) cpp code
333 my @define; # defines for optional features
337 join " || ", map { "${FUNC}_R_PROTO == REENTRANT_PROTO_$_" } @_;
350 New(31338, PL_reentrant_buffer->_${func}_buffer, PL_reentrant_buffer->_${func}_size, char);
353 Safefree(PL_reentrant_buffer->_${func}_buffer);
358 my ($n, $p, @F) = @_;
362 /* The @F using \L$n? */
368 my $HAS = "${FUNC}_R_HAS_$n";
370 my @h = grep { /$p/ } @{$seena{$func}};
371 unless (defined $GENFUNC) {
373 $GENFUNC =~ s/^GET//;
376 push @define, "#if defined(HAS_${FUNC}_R) && (" . join(" || ", map { "${FUNC}_R_PROTO == REENTRANT_PROTO_$_" } @h) . ")\n";
389 /* Any of the @F using \L$n? */
392 push @define, "#if (" . join(" || ", map { "defined($_)" } @H) . ")\n";
394 # define USE_${GENFUNC}_$n
396 # undef USE_${GENFUNC}_$n
402 define('BUFFER', 'B',
403 qw(getgrent getgrgid getgrnam));
406 qw(getgrent getgrgid getgrnam));
408 qw(getpwent getpwnam getpwuid));
410 qw(getspent getspnam));
413 qw(getgrent getgrgid getgrnam setgrent endgrent));
415 qw(getpwent getpwnam getpwuid setpwent endpwent));
417 define('BUFFER', 'B',
418 qw(getpwent getpwgid getpwnam));
421 qw(gethostent gethostbyaddr gethostbyname));
423 qw(getnetent getnetbyaddr getnetbyname));
425 qw(getprotoent getprotobyname getprotobynumber));
427 qw(getservent getservbyname getservbyport));
429 define('BUFFER', 'B',
430 qw(gethostent gethostbyaddr gethostbyname));
431 define('BUFFER', 'B',
432 qw(getnetent getnetbyaddr getnetbyname));
433 define('BUFFER', 'B',
434 qw(getprotoent getprotobyname getprotobynumber));
435 define('BUFFER', 'B',
436 qw(getservent getservbyname getservbyport));
439 qw(gethostent gethostbyaddr gethostbyname));
441 qw(getnetent getnetbyaddr getnetbyname));
443 # The following loop accumulates the "ssif" (struct, size, init, free)
444 # sections that declare the struct members (in reentr.h), and the buffer
445 # size initialization, buffer initialization (malloc), and buffer
446 # release (free) code (in reentr.c).
448 # The loop also contains a lot of intrinsic logic about groups of
449 # functions (since functions of certain kind operate the same way).
451 for my $func (@seenf) {
453 my $ifdef = "#ifdef HAS_${FUNC}_R\n";
454 my $endif = "#endif /* HAS_${FUNC}_R */\n";
455 if (exists $seena{$func}) {
456 my @p = @{$seena{$func}};
457 if ($func =~ /^(asctime|ctime|getlogin|setlocale|strerror|ttyname)$/) {
460 char* _${func}_buffer;
461 size_t _${func}_size;
464 PL_reentrant_buffer->_${func}_size = REENTRANTSMALLSIZE;
469 elsif ($func =~ /^(crypt)$/) {
472 #if CRYPT_R_PROTO == REENTRANT_PROTO_B_CCD
473 $seend{$func} _${func}_data;
475 $seent{$func} *_${func}_struct_buffer;
479 #if CRYPT_R_PROTO != REENTRANT_PROTO_B_CCD
480 PL_reentrant_buffer->_${func}_struct_buffer = 0;
484 #if CRYPT_R_PROTO != REENTRANT_PROTO_B_CCD
485 Safefree(PL_reentrant_buffer->_${func}_struct_buffer);
490 elsif ($func =~ /^(drand48|gmtime|localtime|random|srandom)$/) {
493 $seent{$func} _${func}_struct;
495 if ($1 eq 'drand48') {
497 double _${func}_double;
499 } elsif ($1 eq 'random') {
501 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_iS
504 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_lS
505 long _${func}_retval;
507 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_St
508 int32_t _${func}_retval;
514 elsif ($func =~ /^(getgrnam|getpwnam|getspnam)$/) {
516 # 'genfunc' can be read either as 'generic' or 'genre',
517 # it represents a group of functions.
519 $genfunc =~ s/nam/ent/g;
520 $genfunc =~ s/^get//;
521 my $GENFUNC = uc $genfunc;
523 $seent{$func} _${genfunc}_struct;
524 char* _${genfunc}_buffer;
525 size_t _${genfunc}_size;
528 # ifdef USE_${GENFUNC}_PTR
529 $seent{$func}* _${genfunc}_ptr;
533 # ifdef USE_${GENFUNC}_FPTR
534 FILE* _${genfunc}_fptr;
538 # ifdef USE_${GENFUNC}_FPTR
539 PL_reentrant_buffer->_${genfunc}_fptr = NULL;
542 my $sc = $genfunc eq 'grent' ?
543 '_SC_GETGR_R_SIZE_MAX' : '_SC_GETPW_R_SIZE_MAX';
544 my $sz = "_${genfunc}_size";
546 # if defined(HAS_SYSCONF) && defined($sc) && !defined(__GLIBC__)
547 PL_reentrant_buffer->$sz = sysconf($sc);
548 if (PL_reentrant_buffer->$sz == -1)
549 PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE;
551 # if defined(__osf__) && defined(__alpha) && defined(SIABUFSIZ)
552 PL_reentrant_buffer->$sz = SIABUFSIZ;
555 PL_reentrant_buffer->$sz = BUFSIZ;
557 PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE;
562 pushinitfree $genfunc;
565 elsif ($func =~ /^(gethostbyname|getnetbyname|getservbyname|getprotobyname)$/) {
568 $genfunc =~ s/byname/ent/;
569 $genfunc =~ s/^get//;
570 my $GENFUNC = uc $genfunc;
571 my $D = ifprotomatch($FUNC, grep {/D/} @p);
572 my $d = $seend{$func};
573 $d =~ s/\*$//; # snip: we need need the base type.
575 $seent{$func} _${genfunc}_struct;
579 char* _${genfunc}_buffer;
580 size_t _${genfunc}_size;
582 # ifdef USE_${GENFUNC}_PTR
583 $seent{$func}* _${genfunc}_ptr;
587 # ifdef USE_${GENFUNC}_ERRNO
588 int _${genfunc}_errno;
593 PL_reentrant_buffer->_${genfunc}_size = REENTRANTUSUALSIZE;
598 New(31338, PL_reentrant_buffer->_${genfunc}_buffer, PL_reentrant_buffer->_${genfunc}_size, char);
603 Safefree(PL_reentrant_buffer->_${genfunc}_buffer);
608 elsif ($func =~ /^(readdir|readdir64)$/) {
610 my $R = ifprotomatch($FUNC, grep {/R/} @p);
612 $seent{$func}* _${func}_struct;
613 size_t _${func}_size;
615 $seent{$func}* _${func}_ptr;
619 /* This is the size Solaris recommends.
620 * (though we go static, should use pathconf() instead) */
621 PL_reentrant_buffer->_${func}_size = sizeof($seent{$func}) + MAXPATHLEN + 1;
624 PL_reentrant_buffer->_${func}_struct = ($seent{$func}*)safemalloc(PL_reentrant_buffer->_${func}_size);
627 Safefree(PL_reentrant_buffer->_${func}_struct);
638 # Write out what we have learned.
641 my $v = join(", ", @v[0..$seenu{$func}-1]);
643 my ($r, $a) = split '_', $p;
644 my $test = $r eq 'I' ? ' == 0' : '';
647 if ($genfunc =~ /^(?:get|set|end)(pw|gr|host|net|proto|serv|sp)/) {
648 $genfunc = "${1}ent";
649 } elsif ($genfunc eq 'srand48') {
650 $genfunc = "drand48";
654 substr($b, 0, $seenu{$func}) = '';
655 if ($func =~ /^random$/) {
656 $true = "PL_reentrant_buffer->_random_retval";
657 } elsif ($b =~ /R/) {
658 $true = "PL_reentrant_buffer->_${genfunc}_ptr";
659 } elsif ($b =~ /T/ && $func eq 'drand48') {
660 $true = "PL_reentrant_buffer->_${genfunc}_double";
661 } elsif ($b =~ /S/) {
662 if ($func =~ /^readdir/) {
663 $true = "PL_reentrant_buffer->_${genfunc}_struct";
665 $true = "&PL_reentrant_buffer->_${genfunc}_struct";
667 } elsif ($b =~ /B/) {
668 $true = "PL_reentrant_buffer->_${genfunc}_buffer";
674 "&PL_reentrant_buffer->_${genfunc}_ptr" :
676 "&PL_reentrant_buffer->_${genfunc}_errno" :
678 "PL_reentrant_buffer->_${genfunc}_buffer" :
680 "PL_reentrant_buffer->_${genfunc}_size" :
682 "&PL_reentrant_buffer->_${genfunc}_fptr" :
684 "&PL_reentrant_buffer->_${genfunc}_data" :
686 ($func =~ /^readdir\d*$/ ?
687 "PL_reentrant_buffer->_${genfunc}_struct" :
689 "PL_reentrant_buffer->_${genfunc}_struct_buffer" :
690 "&PL_reentrant_buffer->_${genfunc}_struct") :
691 $_ eq 'T' && $func eq 'drand48' ?
692 "&PL_reentrant_buffer->_${genfunc}_double" :
693 $_ =~ /^[ilt]$/ && $func eq 'random' ?
694 "&PL_reentrant_buffer->_random_retval" :
697 $w = ", $w" if length $v;
699 my $call = "${func}_r($v$w)";
701 # Must make OpenBSD happy
704 ($genfunc eq 'protoent' || $genfunc eq 'servent')) {
705 $memzero = 'REENTR_MEMZERO(&PL_reentrant_buffer->_' . $genfunc . '_data, sizeof(PL_reentrant_buffer->_' . $genfunc . '_data))';
708 # if !defined($func) && ${FUNC}_R_PROTO == REENTRANT_PROTO_$p
710 if ($r eq 'V' || $r eq 'B') {
712 # define $func($v) $call
715 if ($func =~ /^get/) {
716 my $rv = $v ? ", $v" : "";
719 # define $func($v) ($memzero(PL_reentrant_retint = $call)$test ? $true : (((PL_reentrant_retint == ERANGE) || (errno == ERANGE)) ? ($seent{$func} *) Perl_reentrant_retry("$func"$rv) : 0))
723 # define $func($v) ($call$test ? $true : ((errno == ERANGE) ? ($seent{$func} *) Perl_reentrant_retry("$func"$rv) : 0))
728 # define $func($v) ($call$test ? $true : 0)
737 push @wrap, $endif, "\n";
745 /* Defines for indicating which special features are supported. */
750 int dummy; /* cannot have empty structs */
757 #endif /* USE_REENTRANT_API */
766 # Prepare to write the reentr.c.
768 safer_unlink 'reentr.c';
769 die "reentr.c: $!" unless open(C, ">reentr.c");
772 /* -*- buffer-read-only: t -*-
776 * Copyright (C) 2002, 2003, 2005 by Larry Wall and others
778 * You may distribute under the terms of either the GNU General Public
779 * License or the Artistic License, as specified in the README file.
781 * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
782 * This file is built by reentr.pl from data in reentr.pl.
784 * "Saruman," I said, standing away from him, "only one hand at a time can
785 * wield the One, and you know that well, so do not trouble to say we!"
787 * This file contains a collection of automatically created wrappers
788 * (created by running reentr.pl) for reentrant (thread-safe) versions of
789 * various library calls, such as getpwent_r. The wrapping is done so
790 * that other files like pp_sys.c calling those library functions need not
791 * care about the differences between various platforms' idiosyncrasies
792 * regarding these reentrant interfaces.
796 #define PERL_IN_REENTR_C
801 Perl_reentrant_size(pTHX) {
802 #ifdef USE_REENTRANT_API
803 #define REENTRANTSMALLSIZE 256 /* Make something up. */
804 #define REENTRANTUSUALSIZE 4096 /* Make something up. */
806 #endif /* USE_REENTRANT_API */
810 Perl_reentrant_init(pTHX) {
811 #ifdef USE_REENTRANT_API
812 New(31337, PL_reentrant_buffer, 1, REENTR);
813 Perl_reentrant_size(aTHX);
815 #endif /* USE_REENTRANT_API */
819 Perl_reentrant_free(pTHX) {
820 #ifdef USE_REENTRANT_API
822 Safefree(PL_reentrant_buffer);
823 #endif /* USE_REENTRANT_API */
827 Perl_reentrant_retry(const char *f, ...)
831 #ifdef USE_REENTRANT_API
832 # 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)
835 # if defined(USE_SERVENT_BUFFER)
838 # if defined(USE_HOSTENT_BUFFER)
841 # if defined(USE_HOSTENT_BUFFER) || defined(USE_NETENT_BUFFER) || defined(USE_PROTOENT_BUFFER) || defined(USE_SERVENT_BUFFER)
848 switch (PL_op->op_type) {
849 #ifdef USE_HOSTENT_BUFFER
854 #ifdef PERL_REENTRANT_MAXSIZE
855 if (PL_reentrant_buffer->_hostent_size <=
856 PERL_REENTRANT_MAXSIZE / 2)
859 PL_reentrant_buffer->_hostent_size *= 2;
860 Renew(PL_reentrant_buffer->_hostent_buffer,
861 PL_reentrant_buffer->_hostent_size, char);
862 switch (PL_op->op_type) {
864 p0 = va_arg(ap, void *);
865 asize = va_arg(ap, size_t);
866 anint = va_arg(ap, int);
867 retptr = gethostbyaddr(p0, asize, anint); break;
869 p0 = va_arg(ap, void *);
870 retptr = gethostbyname((char *)p0); break;
872 retptr = gethostent(); break;
874 SETERRNO(ERANGE, LIB_INVARG);
881 #ifdef USE_GRENT_BUFFER
886 #ifdef PERL_REENTRANT_MAXSIZE
887 if (PL_reentrant_buffer->_grent_size <=
888 PERL_REENTRANT_MAXSIZE / 2)
892 PL_reentrant_buffer->_grent_size *= 2;
893 Renew(PL_reentrant_buffer->_grent_buffer,
894 PL_reentrant_buffer->_grent_size, char);
895 switch (PL_op->op_type) {
897 p0 = va_arg(ap, void *);
898 retptr = getgrnam((char *)p0); break;
900 #if Gid_t_size < INTSIZE
901 gid = (Gid_t)va_arg(ap, int);
903 gid = va_arg(ap, Gid_t);
905 retptr = getgrgid(gid); break;
907 retptr = getgrent(); break;
909 SETERRNO(ERANGE, LIB_INVARG);
916 #ifdef USE_NETENT_BUFFER
921 #ifdef PERL_REENTRANT_MAXSIZE
922 if (PL_reentrant_buffer->_netent_size <=
923 PERL_REENTRANT_MAXSIZE / 2)
927 PL_reentrant_buffer->_netent_size *= 2;
928 Renew(PL_reentrant_buffer->_netent_buffer,
929 PL_reentrant_buffer->_netent_size, char);
930 switch (PL_op->op_type) {
932 net = va_arg(ap, Netdb_net_t);
933 anint = va_arg(ap, int);
934 retptr = getnetbyaddr(net, anint); break;
936 p0 = va_arg(ap, void *);
937 retptr = getnetbyname((char *)p0); break;
939 retptr = getnetent(); break;
941 SETERRNO(ERANGE, LIB_INVARG);
948 #ifdef USE_PWENT_BUFFER
953 #ifdef PERL_REENTRANT_MAXSIZE
954 if (PL_reentrant_buffer->_pwent_size <=
955 PERL_REENTRANT_MAXSIZE / 2)
959 PL_reentrant_buffer->_pwent_size *= 2;
960 Renew(PL_reentrant_buffer->_pwent_buffer,
961 PL_reentrant_buffer->_pwent_size, char);
962 switch (PL_op->op_type) {
964 p0 = va_arg(ap, void *);
965 retptr = getpwnam((char *)p0); break;
967 #if Uid_t_size < INTSIZE
968 uid = (Uid_t)va_arg(ap, int);
970 uid = va_arg(ap, Uid_t);
972 retptr = getpwuid(uid); break;
974 retptr = getpwent(); break;
976 SETERRNO(ERANGE, LIB_INVARG);
983 #ifdef USE_PROTOENT_BUFFER
988 #ifdef PERL_REENTRANT_MAXSIZE
989 if (PL_reentrant_buffer->_protoent_size <=
990 PERL_REENTRANT_MAXSIZE / 2)
993 PL_reentrant_buffer->_protoent_size *= 2;
994 Renew(PL_reentrant_buffer->_protoent_buffer,
995 PL_reentrant_buffer->_protoent_size, char);
996 switch (PL_op->op_type) {
998 p0 = va_arg(ap, void *);
999 retptr = getprotobyname((char *)p0); break;
1001 anint = va_arg(ap, int);
1002 retptr = getprotobynumber(anint); break;
1004 retptr = getprotoent(); break;
1006 SETERRNO(ERANGE, LIB_INVARG);
1013 #ifdef USE_SERVENT_BUFFER
1018 #ifdef PERL_REENTRANT_MAXSIZE
1019 if (PL_reentrant_buffer->_servent_size <=
1020 PERL_REENTRANT_MAXSIZE / 2)
1023 PL_reentrant_buffer->_servent_size *= 2;
1024 Renew(PL_reentrant_buffer->_servent_buffer,
1025 PL_reentrant_buffer->_servent_size, char);
1026 switch (PL_op->op_type) {
1028 p0 = va_arg(ap, void *);
1029 p1 = va_arg(ap, void *);
1030 retptr = getservbyname((char *)p0, (char *)p1); break;
1032 anint = va_arg(ap, int);
1033 p0 = va_arg(ap, void *);
1034 retptr = getservbyport(anint, (char *)p0); break;
1036 retptr = getservent(); break;
1038 SETERRNO(ERANGE, LIB_INVARG);
1046 /* Not known how to retry, so just fail. */
1059 asctime S |time |const struct tm|B_SB|B_SBI|I_SB|I_SBI
1060 crypt CC |crypt |struct crypt_data|B_CCS|B_CCD|D=CRYPTD*
1061 ctermid B |stdio | |B_B
1062 ctime S |time |const time_t |B_SB|B_SBI|I_SB|I_SBI
1063 drand48 |stdlib |struct drand48_data |I_ST|T=double*
1064 endgrent |grp | |I_H|V_H
1065 endhostent |netdb | |I_D|V_D|D=struct hostent_data*
1066 endnetent |netdb | |I_D|V_D|D=struct netent_data*
1067 endprotoent |netdb | |I_D|V_D|D=struct protoent_data*
1068 endpwent |pwd | |I_H|V_H
1069 endservent |netdb | |I_D|V_D|D=struct servent_data*
1070 getgrent |grp |struct group |I_SBWR|I_SBIR|S_SBW|S_SBI|I_SBI|I_SBIH
1071 getgrgid T |grp |struct group |I_TSBWR|I_TSBIR|I_TSBI|S_TSBI|T=gid_t
1072 getgrnam C |grp |struct group |I_CSBWR|I_CSBIR|S_CBI|I_CSBI|S_CSBI
1073 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
1074 gethostbyname C |netdb |struct hostent |I_CSBWRE|S_CSBIE|I_CSD|D=struct hostent_data*
1075 gethostent |netdb |struct hostent |I_SBWRE|I_SBIE|S_SBIE|S_SBI|I_SBI|I_SD|D=struct hostent_data*
1076 getlogin |unistd |char |I_BW|I_BI|B_BW|B_BI
1077 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
1078 getnetbyname C |netdb |struct netent |I_CSBWRE|I_CSBI|S_CSBI|I_CSD|D=struct netent_data*
1079 getnetent |netdb |struct netent |I_SBWRE|I_SBIE|S_SBIE|S_SBI|I_SBI|I_SD|D=struct netent_data*
1080 getprotobyname C|netdb |struct protoent|I_CSBWR|S_CSBI|I_CSD|D=struct protoent_data*
1081 getprotobynumber I |netdb |struct protoent|I_ISBWR|S_ISBI|I_ISD|D=struct protoent_data*
1082 getprotoent |netdb |struct protoent|I_SBWR|I_SBI|S_SBI|I_SD|D=struct protoent_data*
1083 getpwent |pwd |struct passwd |I_SBWR|I_SBIR|S_SBW|S_SBI|I_SBI|I_SBIH
1084 getpwnam C |pwd |struct passwd |I_CSBWR|I_CSBIR|S_CSBI|I_CSBI
1085 getpwuid T |pwd |struct passwd |I_TSBWR|I_TSBIR|I_TSBI|S_TSBI|T=uid_t
1086 getservbyname CC|netdb |struct servent |I_CCSBWR|S_CCSBI|I_CCSD|D=struct servent_data*
1087 getservbyport IC|netdb |struct servent |I_ICSBWR|S_ICSBI|I_ICSD|D=struct servent_data*
1088 getservent |netdb |struct servent |I_SBWR|I_SBI|S_SBI|I_SD|D=struct servent_data*
1089 getspnam C |shadow |struct spwd |I_CSBWR|S_CSBI
1090 gmtime T |time |struct tm |S_TS|I_TS|T=const time_t*
1091 localtime T |time |struct tm |S_TS|I_TS|T=const time_t*
1092 random |stdlib |struct random_data|I_iS|I_lS|I_St|i=int*|l=long*|t=int32_t*
1093 readdir T |dirent |struct dirent |I_TSR|I_TS|T=DIR*
1094 readdir64 T |dirent |struct dirent64|I_TSR|I_TS|T=DIR*
1095 setgrent |grp | |I_H|V_H
1096 sethostent I |netdb | |I_ID|V_ID|D=struct hostent_data*
1097 setlocale IC |locale | |I_ICBI
1098 setnetent I |netdb | |I_ID|V_ID|D=struct netent_data*
1099 setprotoent I |netdb | |I_ID|V_ID|D=struct protoent_data*
1100 setpwent |pwd | |I_H|V_H
1101 setservent I |netdb | |I_ID|V_ID|D=struct servent_data*
1102 srand48 L |stdlib |struct drand48_data |I_LS
1103 srandom T |stdlib |struct random_data|I_TS|T=unsigned int
1104 strerror I |string | |I_IBW|I_IBI|B_IBW
1105 tmpnam B |stdio | |B_B
1106 ttyname I |unistd | |I_IBW|I_IBI|B_IBI