3 # Regenerate (overwriting only if changed):
8 # from information stored in the DATA section of this file.
10 # With the -U option, it also unconditionally regenerates the relevant
15 # Also accepts the standard regen_lib -q and -v args.
17 # This script is normally invoked from regen.pl.
20 # Get function prototypes
21 require 'regen/regen_lib.pl';
27 getopts('Uv', \%opts);
31 A => "char*", # as an input argument
32 B => "char*", # as an output argument
33 C => "const char*", # as a read-only input argument
41 # (See the definitions after __DATA__.)
42 # In func|inc|type|... a "S" means "type*", and a "R" means "type**".
43 # (The "types" are often structs, such as "struct passwd".)
45 # After the prototypes one can have |X=...|Y=... to define more types.
46 # A commonly used extra type is to define D to be equal to "type_data",
47 # for example "struct_hostent_data to" go with "struct hostent".
49 # Example #1: I_XSBWR means int func_r(X, type, char*, size_t, type**)
50 # Example #2: S_SBIE means type func_r(type, char*, int, int*)
51 # Example #3: S_CBI means type func_r(const char*, char*, int)
54 my $h = safer_open("reentr.h-new");
56 print read_only_top(lang => 'C', by => 'regen/reentr.pl',
57 from => 'data in regen/reentr.pl',
58 file => 'reentr.h', style => '*',
59 copyright => [2002, 2003, 2005 .. 2007]);
65 /* If compiling for a threaded perl, we will macro-wrap the system/library
66 * interfaces (e.g. getpwent()) which have threaded versions
67 * (e.g. getpwent_r()), which will handle things correctly for
68 * the Perl interpreter, but otherwise (for XS) the wrapping does
69 * not take place. See L<perlxs/Thread-aware system interfaces>.
72 #ifndef PERL_REENTR_API
73 # if defined(PERL_CORE) || defined(PERL_EXT)
74 # define PERL_REENTR_API 1
76 # define PERL_REENTR_API 0
80 #ifdef USE_REENTRANT_API
82 /* Deprecations: some platforms have the said reentrant interfaces
83 * but they are declared obsolete and are not to be used. Often this
84 * means that the platform has threadsafed the interfaces (hopefully).
85 * All this is OS version dependent, so we are of course fooling ourselves.
86 * If you know of more deprecations on some platforms, please add your own
87 * (by editing reentr.pl, mind!) */
92 # undef HAS_ENDGRENT_R
93 # undef HAS_ENDPWENT_R
94 # undef HAS_GETGRENT_R
95 # undef HAS_GETPWENT_R
96 # undef HAS_SETLOCALE_R
98 # undef HAS_STRERROR_R
99 # define NETDB_R_OBSOLETE
102 #if defined(__osf__) && defined(__alpha) /* Tru64 aka Digital UNIX */
104 # undef HAS_STRERROR_R
105 # define NETDB_R_OBSOLETE
109 * As of OpenBSD 3.7, reentrant functions are now working, they just are
110 * incompatible with everyone else. To make OpenBSD happy, we have to
111 * memzero out certain structures before calling the functions.
113 #if defined(__OpenBSD__)
114 # define REENTR_MEMZERO(a,b) memzero(a,b)
116 # define REENTR_MEMZERO(a,b) 0
119 #ifdef NETDB_R_OBSOLETE
120 # undef HAS_ENDHOSTENT_R
121 # undef HAS_ENDNETENT_R
122 # undef HAS_ENDPROTOENT_R
123 # undef HAS_ENDSERVENT_R
124 # undef HAS_GETHOSTBYADDR_R
125 # undef HAS_GETHOSTBYNAME_R
126 # undef HAS_GETHOSTENT_R
127 # undef HAS_GETNETBYADDR_R
128 # undef HAS_GETNETBYNAME_R
129 # undef HAS_GETNETENT_R
130 # undef HAS_GETPROTOBYNAME_R
131 # undef HAS_GETPROTOBYNUMBER_R
132 # undef HAS_GETPROTOENT_R
133 # undef HAS_GETSERVBYNAME_R
134 # undef HAS_GETSERVBYPORT_R
135 # undef HAS_GETSERVENT_R
136 # undef HAS_SETHOSTENT_R
137 # undef HAS_SETNETENT_R
138 # undef HAS_SETPROTOENT_R
139 # undef HAS_SETSERVENT_R
152 # include <stdlib.h> /* drand48_data */
159 #ifdef HAS_GETSPNAM_R
167 my %seenh; # the different prototypes signatures for this function
168 my %seena; # the different prototypes signatures for this function in order
169 my @seenf; # all the seen functions
170 my %seenp; # the different prototype signatures for all functions
171 my %seent; # the return type of this function
172 my %seens; # the type of this function's "S"
173 my %seend; # the type of this function's "D"
174 my %seenm; # all the types
175 my %seenu; # the length of the argument list of this function
177 while (<DATA>) { # Read in the protypes.
180 my ($func, $hdr, $type, @p) = split(/\s*\|\s*/, $_, -1);
182 # Split off the real function name and the argument list.
183 ($func, $u) = split(' ', $func);
184 $seenu{$func} = defined $u ? length $u : 0;
185 my $FUNC = uc $func; # for output.
193 # Set any special mapping variables (like X=x_t)
195 while ($p[-1] =~ /=/) {
196 my ($k, $v) = ($p[-1] =~ /^([A-Za-z])\s*=\s*(.*)/);
202 # If given the -U option open up the metaconfig unit for this function.
203 if ($opts{U} && open(U, ">d_${func}_r.U")) {
209 # The metaconfig units needs prerequisite dependencies.
213 if ($hdr ne 'stdio') { # There's no i_stdio.
216 $prereqsh = "\$$prereqs $prereqh";
218 my @prereq = qw(Inlibc Protochk Hasproto i_systypes usethreads);
219 push @prereq, $prereqs;
220 my $hdrs = "\$i_systypes sys/types.h define stdio.h $prereqsh";
221 if ($hdr eq 'time') {
222 $hdrs .= " \$i_systime sys/time.h";
223 push @prereq, 'i_systime';
225 # Output the metaconfig unit header.
227 ?RCS: \$Id: d_${func}_r.U,v $
229 ?RCS: Copyright (c) 2002,2003 Jarkko Hietaniemi
231 ?RCS: You may distribute under the terms of either the GNU General Public
232 ?RCS: License or the Artistic License, as specified in the README file.
234 ?RCS: Generated by the reentr.pl from the Perl 5.8 distribution.
236 ?MAKE:d_${func}_r ${func}_r_proto: @prereq
237 ?MAKE: -pick add \$@ %<
239 ?S: This variable conditionally defines the HAS_${FUNC}_R symbol,
240 ?S: which indicates to the C program that the ${func}_r()
241 ?S: routine is available.
244 ?S: This variable encodes the prototype of ${func}_r.
245 ?S: It is zero if d_${func}_r is undef, and one of the
246 ?S: REENTRANT_PROTO_T_ABC macros of reentr.h if d_${func}_r
250 ?C: This symbol, if defined, indicates that the ${func}_r routine
251 ?C: is available to ${func} re-entrantly.
254 ?C: This symbol encodes the prototype of ${func}_r.
255 ?C: It is zero if d_${func}_r is undef, and one of the
256 ?C: REENTRANT_PROTO_T_ABC macros of reentr.h if d_${func}_r
259 ?H:#\$d_${func}_r HAS_${FUNC}_R /**/
260 ?H:#define ${FUNC}_R_PROTO \$${func}_r_proto /**/
262 ?T:try hdrs d_${func}_r_proto
263 ?LINT:set d_${func}_r
264 ?LINT:set ${func}_r_proto
265 : see if ${func}_r exists
266 set ${func}_r d_${func}_r
268 case "\$d_${func}_r" in
273 case "\$d_${func}_r_proto:\$usethreads" in
274 ":define") d_${func}_r_proto=define
275 set d_${func}_r_proto ${func}_r \$hdrs
279 case "\$d_${func}_r_proto" in
284 my ($r, $a) = ($p =~ /^(.)_(.+)/);
285 my $v = join(", ", map { $m{$_} } split '', $a);
288 case "\$${func}_r_proto" in
289 ''|0) try='$m{$r} ${func}_r($v);'
290 ./protochk "extern \$try" \$hdrs && ${func}_r_proto=$p ;;
294 $seenh{$func}->{$p}++;
295 push @{$seena{$func}}, $p;
297 $seent{$func} = $type;
298 $seens{$func} = $m{S};
299 $seend{$func} = $m{D};
304 case "\$${func}_r_proto" in
305 ''|0) d_${func}_r=undef
307 echo "Disabling ${func}_r, cannot determine prototype." >&4 ;;
308 * ) case "\$${func}_r_proto" in
310 *) ${func}_r_proto="REENTRANT_PROTO_\$${func}_r_proto" ;;
312 echo "Prototype: \$try" ;;
315 *) case "\$usethreads" in
316 define) echo "${func}_r has no prototype, not using it." >&4 ;;
334 # Prepare to continue writing the reentr.h.
339 # Write out all the known prototype signatures.
341 for my $p (sort keys %seenp) {
342 print "#define REENTRANT_PROTO_${p} ${i}\n";
347 my @struct; # REENTR struct members
348 my @size; # struct member buffer size initialization code
349 my @init; # struct member buffer initialization (malloc) code
350 my @free; # struct member buffer release (free) code
351 my @wrap; # the wrapper (foo(a) -> foo_r(a,...)) cpp code
352 my @define; # defines for optional features
356 join " || ", map { "${FUNC}_R_PROTO == REENTRANT_PROTO_$_" } @_;
369 Newx(PL_reentrant_buffer->_${func}_buffer, PL_reentrant_buffer->_${func}_size, char);
372 Safefree(PL_reentrant_buffer->_${func}_buffer);
377 my ($n, $p, @F) = @_;
381 /* The @F using \L$n? */
387 my $HAS = "${FUNC}_R_HAS_$n";
389 my @h = grep { /$p/ } @{$seena{$func}};
390 unless (defined $GENFUNC) {
392 $GENFUNC =~ s/^GET//;
395 push @define, "#if defined(HAS_${FUNC}_R) && (" . join(" || ", map { "${FUNC}_R_PROTO == REENTRANT_PROTO_$_" } @h) . ")\n";
408 /* Any of the @F using \L$n? */
411 push @define, "#if (" . join(" || ", map { "defined($_)" } @H) . ")\n";
413 # define USE_${GENFUNC}_$n
415 # undef USE_${GENFUNC}_$n
421 define('BUFFER', 'B',
422 qw(getgrent getgrgid getgrnam));
425 qw(getgrent getgrgid getgrnam));
427 qw(getpwent getpwnam getpwuid));
429 qw(getspent getspnam));
432 qw(getgrent getgrgid getgrnam setgrent endgrent));
434 qw(getpwent getpwnam getpwuid setpwent endpwent));
436 define('BUFFER', 'B',
437 qw(getpwent getpwgid getpwnam));
440 qw(gethostent gethostbyaddr gethostbyname));
442 qw(getnetent getnetbyaddr getnetbyname));
444 qw(getprotoent getprotobyname getprotobynumber));
446 qw(getservent getservbyname getservbyport));
448 define('BUFFER', 'B',
449 qw(gethostent gethostbyaddr gethostbyname));
450 define('BUFFER', 'B',
451 qw(getnetent getnetbyaddr getnetbyname));
452 define('BUFFER', 'B',
453 qw(getprotoent getprotobyname getprotobynumber));
454 define('BUFFER', 'B',
455 qw(getservent getservbyname getservbyport));
458 qw(gethostent gethostbyaddr gethostbyname));
460 qw(getnetent getnetbyaddr getnetbyname));
462 # The following loop accumulates the "ssif" (struct, size, init, free)
463 # sections that declare the struct members (in reentr.h), and the buffer
464 # size initialization, buffer initialization (malloc), and buffer
465 # release (free) code (in reentr.c).
467 # The loop also contains a lot of intrinsic logic about groups of
468 # functions (since functions of certain kind operate the same way).
470 for my $func (@seenf) {
472 my $ifdef = "#ifdef HAS_${FUNC}_R\n";
473 my $endif = "#endif /* HAS_${FUNC}_R */\n";
474 if (exists $seena{$func}) {
475 my @p = @{$seena{$func}};
476 if ($func =~ /^(asctime|ctime|getlogin|setlocale|strerror|ttyname)$/) {
479 char* _${func}_buffer;
480 size_t _${func}_size;
483 PL_reentrant_buffer->_${func}_size = REENTRANTSMALLSIZE;
488 elsif ($func =~ /^(crypt)$/) {
491 #if CRYPT_R_PROTO == REENTRANT_PROTO_B_CCD
492 $seend{$func} _${func}_data;
494 $seent{$func} *_${func}_struct_buffer;
498 #if CRYPT_R_PROTO != REENTRANT_PROTO_B_CCD
499 PL_reentrant_buffer->_${func}_struct_buffer = 0;
503 #if CRYPT_R_PROTO != REENTRANT_PROTO_B_CCD
504 Safefree(PL_reentrant_buffer->_${func}_struct_buffer);
509 elsif ($func =~ /^(drand48|random|srandom)$/) {
512 $seent{$func} _${func}_struct;
514 if ($1 eq 'drand48') {
516 double _${func}_double;
518 } elsif ($1 eq 'random') {
520 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_iS
523 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_lS
524 long _${func}_retval;
526 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_St
527 int32_t _${func}_retval;
533 elsif ($func =~ /^(getgrnam|getpwnam|getspnam)$/) {
535 # 'genfunc' can be read either as 'generic' or 'genre',
536 # it represents a group of functions.
538 $genfunc =~ s/nam/ent/g;
539 $genfunc =~ s/^get//;
540 my $GENFUNC = uc $genfunc;
542 $seent{$func} _${genfunc}_struct;
543 char* _${genfunc}_buffer;
544 size_t _${genfunc}_size;
547 # ifdef USE_${GENFUNC}_PTR
548 $seent{$func}* _${genfunc}_ptr;
552 # ifdef USE_${GENFUNC}_FPTR
553 FILE* _${genfunc}_fptr;
557 # ifdef USE_${GENFUNC}_FPTR
558 PL_reentrant_buffer->_${genfunc}_fptr = NULL;
561 my $sc = $genfunc eq 'grent' ?
562 '_SC_GETGR_R_SIZE_MAX' : '_SC_GETPW_R_SIZE_MAX';
563 my $sz = "_${genfunc}_size";
565 # if defined(HAS_SYSCONF) && defined($sc) && !defined(__GLIBC__)
566 PL_reentrant_buffer->$sz = sysconf($sc);
567 if (PL_reentrant_buffer->$sz == (size_t) -1)
568 PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE;
570 # if defined(__osf__) && defined(__alpha) && defined(SIABUFSIZ)
571 PL_reentrant_buffer->$sz = SIABUFSIZ;
574 PL_reentrant_buffer->$sz = BUFSIZ;
576 PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE;
581 pushinitfree $genfunc;
584 elsif ($func =~ /^(gethostbyname|getnetbyname|getservbyname|getprotobyname)$/) {
587 $genfunc =~ s/byname/ent/;
588 $genfunc =~ s/^get//;
589 my $GENFUNC = uc $genfunc;
590 my $D = ifprotomatch($FUNC, grep {/D/} @p);
591 my $d = $seend{$func};
592 $d =~ s/\*$//; # snip: we need need the base type.
594 $seent{$func} _${genfunc}_struct;
598 char* _${genfunc}_buffer;
599 size_t _${genfunc}_size;
601 # ifdef USE_${GENFUNC}_PTR
602 $seent{$func}* _${genfunc}_ptr;
606 # ifdef USE_${GENFUNC}_ERRNO
607 int _${genfunc}_errno;
612 PL_reentrant_buffer->_${genfunc}_size = REENTRANTUSUALSIZE;
617 Newx(PL_reentrant_buffer->_${genfunc}_buffer, PL_reentrant_buffer->_${genfunc}_size, char);
622 Safefree(PL_reentrant_buffer->_${genfunc}_buffer);
627 elsif ($func =~ /^(readdir|readdir64)$/) {
629 my $R = ifprotomatch($FUNC, grep {/R/} @p);
631 $seent{$func}* _${func}_struct;
632 size_t _${func}_size;
634 $seent{$func}* _${func}_ptr;
638 /* This is the size Solaris recommends.
639 * (though we go static, should use pathconf() instead) */
640 PL_reentrant_buffer->_${func}_size = sizeof($seent{$func}) + MAXPATHLEN + 1;
643 PL_reentrant_buffer->_${func}_struct = ($seent{$func}*)safemalloc(PL_reentrant_buffer->_${func}_size);
646 Safefree(PL_reentrant_buffer->_${func}_struct);
654 # if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
658 # Write out what we have learned.
661 my $v = join(", ", @v[0..$seenu{$func}-1]);
663 my ($r, $a) = split '_', $p;
664 my $test = $r eq 'I' ? ' == 0' : '';
667 if ($genfunc =~ /^(?:get|set|end)(pw|gr|host|net|proto|serv|sp)/) {
668 $genfunc = "${1}ent";
669 } elsif ($genfunc eq 'srand48') {
670 $genfunc = "drand48";
674 substr($b, 0, $seenu{$func}) = '';
675 if ($func =~ /^random$/) {
676 $true = "PL_reentrant_buffer->_random_retval";
677 } elsif ($b =~ /R/) {
678 $true = "PL_reentrant_buffer->_${genfunc}_ptr";
679 } elsif ($b =~ /T/ && $func eq 'drand48') {
680 $true = "PL_reentrant_buffer->_${genfunc}_double";
681 } elsif ($b =~ /S/) {
682 if ($func =~ /^readdir/) {
683 $true = "PL_reentrant_buffer->_${genfunc}_struct";
685 $true = "&PL_reentrant_buffer->_${genfunc}_struct";
687 } elsif ($b =~ /B/) {
688 $true = "PL_reentrant_buffer->_${genfunc}_buffer";
694 "&PL_reentrant_buffer->_${genfunc}_ptr" :
696 "&PL_reentrant_buffer->_${genfunc}_errno" :
698 "PL_reentrant_buffer->_${genfunc}_buffer" :
700 "PL_reentrant_buffer->_${genfunc}_size" :
702 "&PL_reentrant_buffer->_${genfunc}_fptr" :
704 "&PL_reentrant_buffer->_${genfunc}_data" :
706 ($func =~ /^readdir\d*$/ ?
707 "PL_reentrant_buffer->_${genfunc}_struct" :
709 "PL_reentrant_buffer->_${genfunc}_struct_buffer" :
710 "&PL_reentrant_buffer->_${genfunc}_struct") :
711 $_ eq 'T' && $func eq 'drand48' ?
712 "&PL_reentrant_buffer->_${genfunc}_double" :
713 $_ =~ /^[ilt]$/ && $func eq 'random' ?
714 "&PL_reentrant_buffer->_random_retval" :
717 $w = ", $w" if length $v;
720 my $call = "${func}_r($v$w)";
722 # Must make OpenBSD happy
725 ($genfunc eq 'protoent' || $genfunc eq 'servent')) {
726 $memzero = 'REENTR_MEMZERO(&PL_reentrant_buffer->_' . $genfunc . '_data, sizeof(PL_reentrant_buffer->_' . $genfunc . '_data)),';
729 # if !defined($func) && ${FUNC}_R_PROTO == REENTRANT_PROTO_$p
731 if ($r eq 'V' || $r eq 'B') {
733 # define $func($v) $call
736 if ($func =~ /^get/) {
737 my $rv = $v ? ", $v" : "";
740 # define $func($v) ($memzero(PL_reentrant_retint = $call)$test ? $true : ((PL_reentrant_retint == ERANGE) ? ($seent{$func} *) Perl_reentrant_retry("$func"$rv) : 0))
744 # define $func($v) ($call$test ? $true : ((errno == ERANGE) ? ($seent{$func} *) Perl_reentrant_retry("$func"$rv) : 0))
749 # define $func($v) ($call$test ? $true : 0)
753 push @wrap, <<EOF; # !defined(xxx) && XXX_R_PROTO == REENTRANT_PROTO_Y_TS
758 push @wrap, <<EOF; # defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
762 push @wrap, $endif, "\n";
770 /* Defines for indicating which special features are supported. */
775 int dummy; /* cannot have empty structs */
782 #endif /* USE_REENTRANT_API */
790 rename_if_different('reentr.h-new', 'reentr.h');
792 # Prepare to write the reentr.c.
794 my $c = safer_open("reentr.c-new");
796 my $top = read_only_top(lang => 'C', by => 'regen/reentr.pl',
797 from => 'data in regen/reentr.pl',
798 file => 'reentr.c', style => '*',
799 copyright => [2002, 2003, 2005 .. 2007]);
802 * "Saruman," I said, standing away from him, "only one hand at a time can
803 * wield the One, and you know that well, so do not trouble to say we\!"
805 * This file contains a collection of automatically created wrappers
806 * (created by running reentr.pl) for reentrant (thread-safe) versions of
807 * various library calls, such as getpwent_r. The wrapping is done so
808 * that other files like pp_sys.c calling those library functions need not
809 * care about the differences between various platforms' idiosyncrasies
810 * regarding these reentrant interfaces.
816 #define PERL_IN_REENTR_C
821 Perl_reentrant_size(pTHX) {
822 #ifdef USE_REENTRANT_API
823 #define REENTRANTSMALLSIZE 256 /* Make something up. */
824 #define REENTRANTUSUALSIZE 4096 /* Make something up. */
826 #endif /* USE_REENTRANT_API */
830 Perl_reentrant_init(pTHX) {
831 #ifdef USE_REENTRANT_API
832 Newx(PL_reentrant_buffer, 1, REENTR);
833 Perl_reentrant_size(aTHX);
835 #endif /* USE_REENTRANT_API */
839 Perl_reentrant_free(pTHX) {
840 #ifdef USE_REENTRANT_API
842 Safefree(PL_reentrant_buffer);
843 #endif /* USE_REENTRANT_API */
847 Perl_reentrant_retry(const char *f, ...)
852 #ifdef USE_REENTRANT_API
853 /* Easier to special case this here than in embed.pl. (Look at what it
854 generates for proto.h) */
855 PERL_ARGS_ASSERT_REENTRANT_RETRY;
859 #ifdef USE_REENTRANT_API
860 # 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)
863 # if defined(USE_SERVENT_BUFFER)
866 # if defined(USE_HOSTENT_BUFFER)
869 # if defined(USE_HOSTENT_BUFFER) || defined(USE_NETENT_BUFFER) || defined(USE_PROTOENT_BUFFER) || defined(USE_SERVENT_BUFFER)
873 switch (PL_op->op_type) {
874 #ifdef USE_HOSTENT_BUFFER
879 #ifdef PERL_REENTRANT_MAXSIZE
880 if (PL_reentrant_buffer->_hostent_size <=
881 PERL_REENTRANT_MAXSIZE / 2)
884 PL_reentrant_buffer->_hostent_size *= 2;
885 Renew(PL_reentrant_buffer->_hostent_buffer,
886 PL_reentrant_buffer->_hostent_size, char);
887 switch (PL_op->op_type) {
889 p0 = va_arg(ap, void *);
890 asize = va_arg(ap, size_t);
891 anint = va_arg(ap, int);
892 retptr = gethostbyaddr(p0, asize, anint); break;
894 p0 = va_arg(ap, void *);
895 retptr = gethostbyname((char *)p0); break;
897 retptr = gethostent(); break;
899 SETERRNO(ERANGE, LIB_INVARG);
906 #ifdef USE_GRENT_BUFFER
911 #ifdef PERL_REENTRANT_MAXSIZE
912 if (PL_reentrant_buffer->_grent_size <=
913 PERL_REENTRANT_MAXSIZE / 2)
917 PL_reentrant_buffer->_grent_size *= 2;
918 Renew(PL_reentrant_buffer->_grent_buffer,
919 PL_reentrant_buffer->_grent_size, char);
920 switch (PL_op->op_type) {
922 p0 = va_arg(ap, void *);
923 retptr = getgrnam((char *)p0); break;
925 #if Gid_t_size < INTSIZE
926 gid = (Gid_t)va_arg(ap, int);
928 gid = va_arg(ap, Gid_t);
930 retptr = getgrgid(gid); break;
932 retptr = getgrent(); break;
934 SETERRNO(ERANGE, LIB_INVARG);
941 #ifdef USE_NETENT_BUFFER
946 #ifdef PERL_REENTRANT_MAXSIZE
947 if (PL_reentrant_buffer->_netent_size <=
948 PERL_REENTRANT_MAXSIZE / 2)
952 PL_reentrant_buffer->_netent_size *= 2;
953 Renew(PL_reentrant_buffer->_netent_buffer,
954 PL_reentrant_buffer->_netent_size, char);
955 switch (PL_op->op_type) {
957 net = va_arg(ap, Netdb_net_t);
958 anint = va_arg(ap, int);
959 retptr = getnetbyaddr(net, anint); break;
961 p0 = va_arg(ap, void *);
962 retptr = getnetbyname((char *)p0); break;
964 retptr = getnetent(); break;
966 SETERRNO(ERANGE, LIB_INVARG);
973 #ifdef USE_PWENT_BUFFER
978 #ifdef PERL_REENTRANT_MAXSIZE
979 if (PL_reentrant_buffer->_pwent_size <=
980 PERL_REENTRANT_MAXSIZE / 2)
984 PL_reentrant_buffer->_pwent_size *= 2;
985 Renew(PL_reentrant_buffer->_pwent_buffer,
986 PL_reentrant_buffer->_pwent_size, char);
987 switch (PL_op->op_type) {
989 p0 = va_arg(ap, void *);
990 retptr = getpwnam((char *)p0); break;
992 #if Uid_t_size < INTSIZE
993 uid = (Uid_t)va_arg(ap, int);
995 uid = va_arg(ap, Uid_t);
997 retptr = getpwuid(uid); break;
999 retptr = getpwent(); break;
1001 SETERRNO(ERANGE, LIB_INVARG);
1008 #ifdef USE_PROTOENT_BUFFER
1013 #ifdef PERL_REENTRANT_MAXSIZE
1014 if (PL_reentrant_buffer->_protoent_size <=
1015 PERL_REENTRANT_MAXSIZE / 2)
1018 PL_reentrant_buffer->_protoent_size *= 2;
1019 Renew(PL_reentrant_buffer->_protoent_buffer,
1020 PL_reentrant_buffer->_protoent_size, char);
1021 switch (PL_op->op_type) {
1023 p0 = va_arg(ap, void *);
1024 retptr = getprotobyname((char *)p0); break;
1026 anint = va_arg(ap, int);
1027 retptr = getprotobynumber(anint); break;
1029 retptr = getprotoent(); break;
1031 SETERRNO(ERANGE, LIB_INVARG);
1038 #ifdef USE_SERVENT_BUFFER
1043 #ifdef PERL_REENTRANT_MAXSIZE
1044 if (PL_reentrant_buffer->_servent_size <=
1045 PERL_REENTRANT_MAXSIZE / 2)
1048 PL_reentrant_buffer->_servent_size *= 2;
1049 Renew(PL_reentrant_buffer->_servent_buffer,
1050 PL_reentrant_buffer->_servent_size, char);
1051 switch (PL_op->op_type) {
1053 p0 = va_arg(ap, void *);
1054 p1 = va_arg(ap, void *);
1055 retptr = getservbyname((char *)p0, (char *)p1); break;
1057 anint = va_arg(ap, int);
1058 p0 = va_arg(ap, void *);
1059 retptr = getservbyport(anint, (char *)p0); break;
1061 retptr = getservent(); break;
1063 SETERRNO(ERANGE, LIB_INVARG);
1071 /* Not known how to retry, so just fail. */
1086 rename_if_different('reentr.c-new', 'reentr.c');
1089 asctime S |time |const struct tm|B_SB|B_SBI|I_SB|I_SBI
1090 crypt CC |crypt |struct crypt_data|B_CCS|B_CCD|D=CRYPTD*
1091 ctermid B |stdio | |B_B
1092 ctime S |time |const time_t |B_SB|B_SBI|I_SB|I_SBI
1093 drand48 |stdlib |struct drand48_data |I_ST|T=double*
1094 endgrent |grp | |I_H|V_H
1095 endhostent |netdb | |I_D|V_D|D=struct hostent_data*
1096 endnetent |netdb | |I_D|V_D|D=struct netent_data*
1097 endprotoent |netdb | |I_D|V_D|D=struct protoent_data*
1098 endpwent |pwd | |I_H|V_H
1099 endservent |netdb | |I_D|V_D|D=struct servent_data*
1100 getgrent |grp |struct group |I_SBWR|I_SBIR|S_SBW|S_SBI|I_SBI|I_SBIH
1101 getgrgid T |grp |struct group |I_TSBWR|I_TSBIR|I_TSBI|S_TSBI|T=gid_t
1102 getgrnam C |grp |struct group |I_CSBWR|I_CSBIR|S_CBI|I_CSBI|S_CSBI
1103 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
1104 gethostbyname C |netdb |struct hostent |I_CSBWRE|S_CSBIE|I_CSD|D=struct hostent_data*
1105 gethostent |netdb |struct hostent |I_SBWRE|I_SBIE|S_SBIE|S_SBI|I_SBI|I_SD|D=struct hostent_data*
1106 getlogin |unistd |char |I_BW|I_BI|B_BW|B_BI
1107 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
1108 getnetbyname C |netdb |struct netent |I_CSBWRE|I_CSBI|S_CSBI|I_CSD|D=struct netent_data*
1109 getnetent |netdb |struct netent |I_SBWRE|I_SBIE|S_SBIE|S_SBI|I_SBI|I_SD|D=struct netent_data*
1110 getprotobyname C|netdb |struct protoent|I_CSBWR|S_CSBI|I_CSD|D=struct protoent_data*
1111 getprotobynumber I |netdb |struct protoent|I_ISBWR|S_ISBI|I_ISD|D=struct protoent_data*
1112 getprotoent |netdb |struct protoent|I_SBWR|I_SBI|S_SBI|I_SD|D=struct protoent_data*
1113 getpwent |pwd |struct passwd |I_SBWR|I_SBIR|S_SBW|S_SBI|I_SBI|I_SBIH
1114 getpwnam C |pwd |struct passwd |I_CSBWR|I_CSBIR|S_CSBI|I_CSBI
1115 getpwuid T |pwd |struct passwd |I_TSBWR|I_TSBIR|I_TSBI|S_TSBI|T=uid_t
1116 getservbyname CC|netdb |struct servent |I_CCSBWR|S_CCSBI|I_CCSD|D=struct servent_data*
1117 getservbyport IC|netdb |struct servent |I_ICSBWR|S_ICSBI|I_ICSD|D=struct servent_data*
1118 getservent |netdb |struct servent |I_SBWR|I_SBI|S_SBI|I_SD|D=struct servent_data*
1119 getspnam C |shadow |struct spwd |I_CSBWR|S_CSBI
1120 random |stdlib |struct random_data|I_iS|I_lS|I_St|i=int*|l=long*|t=int32_t*
1121 readdir T |dirent |struct dirent |I_TSR|I_TS|T=DIR*
1122 readdir64 T |dirent |struct dirent64|I_TSR|I_TS|T=DIR*
1123 setgrent |grp | |I_H|V_H
1124 sethostent I |netdb | |I_ID|V_ID|D=struct hostent_data*
1125 setlocale IC |locale | |I_ICBI
1126 setnetent I |netdb | |I_ID|V_ID|D=struct netent_data*
1127 setprotoent I |netdb | |I_ID|V_ID|D=struct protoent_data*
1128 setpwent |pwd | |I_H|V_H
1129 setservent I |netdb | |I_ID|V_ID|D=struct servent_data*
1130 srand48 L |stdlib |struct drand48_data |I_LS
1131 srandom T |stdlib |struct random_data|I_TS|T=unsigned int
1132 strerror I |string | |I_IBW|I_IBI|B_IBW
1133 tmpnam B |stdio | |B_B
1134 ttyname I |unistd | |I_IBW|I_IBI|B_IBI