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");
48 /* -*- buffer-read-only: t -*-
52 * Copyright (C) 2002, 2003, 2005, 2006, 2007 by Larry Wall and others
54 * You may distribute under the terms of either the GNU General Public
55 * License or the Artistic License, as specified in the README file.
57 * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
58 * This file is built by reentr.pl from data in reentr.pl.
64 /* If compiling for a threaded perl, we will macro-wrap the system/library
65 * interfaces (e.g. getpwent()) which have threaded versions
66 * (e.g. getpwent_r()), which will handle things correctly for
67 * the Perl interpreter, but otherwise (for XS) the wrapping does
68 * not take place. See L<perlxs/Thread-aware system interfaces>.
71 #ifndef PERL_REENTR_API
72 # if defined(PERL_CORE) || defined(PERL_EXT)
73 # define PERL_REENTR_API 1
75 # define PERL_REENTR_API 0
79 #ifdef USE_REENTRANT_API
81 /* Deprecations: some platforms have the said reentrant interfaces
82 * but they are declared obsolete and are not to be used. Often this
83 * means that the platform has threadsafed the interfaces (hopefully).
84 * All this is OS version dependent, so we are of course fooling ourselves.
85 * If you know of more deprecations on some platforms, please add your own
86 * (by editing reentr.pl, mind!) */
91 # undef HAS_ENDGRENT_R
92 # undef HAS_ENDPWENT_R
93 # undef HAS_GETGRENT_R
94 # undef HAS_GETPWENT_R
95 # undef HAS_SETLOCALE_R
97 # undef HAS_STRERROR_R
98 # define NETDB_R_OBSOLETE
101 #if defined(__osf__) && defined(__alpha) /* Tru64 aka Digital UNIX */
103 # undef HAS_STRERROR_R
104 # define NETDB_R_OBSOLETE
108 * As of OpenBSD 3.7, reentrant functions are now working, they just are
109 * incompatible with everyone else. To make OpenBSD happy, we have to
110 * memzero out certain structures before calling the functions.
112 #if defined(__OpenBSD__)
113 # define REENTR_MEMZERO(a,b) memzero(a,b)
115 # define REENTR_MEMZERO(a,b) 0
118 #ifdef NETDB_R_OBSOLETE
119 # undef HAS_ENDHOSTENT_R
120 # undef HAS_ENDNETENT_R
121 # undef HAS_ENDPROTOENT_R
122 # undef HAS_ENDSERVENT_R
123 # undef HAS_GETHOSTBYADDR_R
124 # undef HAS_GETHOSTBYNAME_R
125 # undef HAS_GETHOSTENT_R
126 # undef HAS_GETNETBYADDR_R
127 # undef HAS_GETNETBYNAME_R
128 # undef HAS_GETNETENT_R
129 # undef HAS_GETPROTOBYNAME_R
130 # undef HAS_GETPROTOBYNUMBER_R
131 # undef HAS_GETPROTOENT_R
132 # undef HAS_GETSERVBYNAME_R
133 # undef HAS_GETSERVBYPORT_R
134 # undef HAS_GETSERVENT_R
135 # undef HAS_SETHOSTENT_R
136 # undef HAS_SETNETENT_R
137 # undef HAS_SETPROTOENT_R
138 # undef HAS_SETSERVENT_R
151 # include <stdlib.h> /* drand48_data */
158 #ifdef HAS_GETSPNAM_R
166 my %seenh; # the different prototypes signatures for this function
167 my %seena; # the different prototypes signatures for this function in order
168 my @seenf; # all the seen functions
169 my %seenp; # the different prototype signatures for all functions
170 my %seent; # the return type of this function
171 my %seens; # the type of this function's "S"
172 my %seend; # the type of this function's "D"
173 my %seenm; # all the types
174 my %seenu; # the length of the argument list of this function
176 while (<DATA>) { # Read in the protypes.
179 my ($func, $hdr, $type, @p) = split(/\s*\|\s*/, $_, -1);
181 # Split off the real function name and the argument list.
182 ($func, $u) = split(' ', $func);
183 $seenu{$func} = defined $u ? length $u : 0;
184 my $FUNC = uc $func; # for output.
192 # Set any special mapping variables (like X=x_t)
194 while ($p[-1] =~ /=/) {
195 my ($k, $v) = ($p[-1] =~ /^([A-Za-z])\s*=\s*(.*)/);
201 # If given the -U option open up the metaconfig unit for this function.
202 if ($opts{U} && open(U, ">d_${func}_r.U")) {
208 # The metaconfig units needs prerequisite dependencies.
212 if ($hdr ne 'stdio') { # There's no i_stdio.
215 $prereqsh = "\$$prereqs $prereqh";
217 my @prereq = qw(Inlibc Protochk Hasproto i_systypes usethreads);
218 push @prereq, $prereqs;
219 my $hdrs = "\$i_systypes sys/types.h define stdio.h $prereqsh";
220 if ($hdr eq 'time') {
221 $hdrs .= " \$i_systime sys/time.h";
222 push @prereq, 'i_systime';
224 # Output the metaconfig unit header.
226 ?RCS: \$Id: d_${func}_r.U,v $
228 ?RCS: Copyright (c) 2002,2003 Jarkko Hietaniemi
230 ?RCS: You may distribute under the terms of either the GNU General Public
231 ?RCS: License or the Artistic License, as specified in the README file.
233 ?RCS: Generated by the reentr.pl from the Perl 5.8 distribution.
235 ?MAKE:d_${func}_r ${func}_r_proto: @prereq
236 ?MAKE: -pick add \$@ %<
238 ?S: This variable conditionally defines the HAS_${FUNC}_R symbol,
239 ?S: which indicates to the C program that the ${func}_r()
240 ?S: routine is available.
243 ?S: This variable encodes the prototype of ${func}_r.
244 ?S: It is zero if d_${func}_r is undef, and one of the
245 ?S: REENTRANT_PROTO_T_ABC macros of reentr.h if d_${func}_r
249 ?C: This symbol, if defined, indicates that the ${func}_r routine
250 ?C: is available to ${func} re-entrantly.
253 ?C: This symbol encodes the prototype of ${func}_r.
254 ?C: It is zero if d_${func}_r is undef, and one of the
255 ?C: REENTRANT_PROTO_T_ABC macros of reentr.h if d_${func}_r
258 ?H:#\$d_${func}_r HAS_${FUNC}_R /**/
259 ?H:#define ${FUNC}_R_PROTO \$${func}_r_proto /**/
261 ?T:try hdrs d_${func}_r_proto
262 ?LINT:set d_${func}_r
263 ?LINT:set ${func}_r_proto
264 : see if ${func}_r exists
265 set ${func}_r d_${func}_r
267 case "\$d_${func}_r" in
272 case "\$d_${func}_r_proto:\$usethreads" in
273 ":define") d_${func}_r_proto=define
274 set d_${func}_r_proto ${func}_r \$hdrs
278 case "\$d_${func}_r_proto" in
283 my ($r, $a) = ($p =~ /^(.)_(.+)/);
284 my $v = join(", ", map { $m{$_} } split '', $a);
287 case "\$${func}_r_proto" in
288 ''|0) try='$m{$r} ${func}_r($v);'
289 ./protochk "extern \$try" \$hdrs && ${func}_r_proto=$p ;;
293 $seenh{$func}->{$p}++;
294 push @{$seena{$func}}, $p;
296 $seent{$func} = $type;
297 $seens{$func} = $m{S};
298 $seend{$func} = $m{D};
303 case "\$${func}_r_proto" in
304 ''|0) d_${func}_r=undef
306 echo "Disabling ${func}_r, cannot determine prototype." >&4 ;;
307 * ) case "\$${func}_r_proto" in
309 *) ${func}_r_proto="REENTRANT_PROTO_\$${func}_r_proto" ;;
311 echo "Prototype: \$try" ;;
314 *) case "\$usethreads" in
315 define) echo "${func}_r has no prototype, not using it." >&4 ;;
333 # Prepare to continue writing the reentr.h.
338 # Write out all the known prototype signatures.
340 for my $p (sort keys %seenp) {
341 print "#define REENTRANT_PROTO_${p} ${i}\n";
346 my @struct; # REENTR struct members
347 my @size; # struct member buffer size initialization code
348 my @init; # struct member buffer initialization (malloc) code
349 my @free; # struct member buffer release (free) code
350 my @wrap; # the wrapper (foo(a) -> foo_r(a,...)) cpp code
351 my @define; # defines for optional features
355 join " || ", map { "${FUNC}_R_PROTO == REENTRANT_PROTO_$_" } @_;
368 Newx(PL_reentrant_buffer->_${func}_buffer, PL_reentrant_buffer->_${func}_size, char);
371 Safefree(PL_reentrant_buffer->_${func}_buffer);
376 my ($n, $p, @F) = @_;
380 /* The @F using \L$n? */
386 my $HAS = "${FUNC}_R_HAS_$n";
388 my @h = grep { /$p/ } @{$seena{$func}};
389 unless (defined $GENFUNC) {
391 $GENFUNC =~ s/^GET//;
394 push @define, "#if defined(HAS_${FUNC}_R) && (" . join(" || ", map { "${FUNC}_R_PROTO == REENTRANT_PROTO_$_" } @h) . ")\n";
407 /* Any of the @F using \L$n? */
410 push @define, "#if (" . join(" || ", map { "defined($_)" } @H) . ")\n";
412 # define USE_${GENFUNC}_$n
414 # undef USE_${GENFUNC}_$n
420 define('BUFFER', 'B',
421 qw(getgrent getgrgid getgrnam));
424 qw(getgrent getgrgid getgrnam));
426 qw(getpwent getpwnam getpwuid));
428 qw(getspent getspnam));
431 qw(getgrent getgrgid getgrnam setgrent endgrent));
433 qw(getpwent getpwnam getpwuid setpwent endpwent));
435 define('BUFFER', 'B',
436 qw(getpwent getpwgid getpwnam));
439 qw(gethostent gethostbyaddr gethostbyname));
441 qw(getnetent getnetbyaddr getnetbyname));
443 qw(getprotoent getprotobyname getprotobynumber));
445 qw(getservent getservbyname getservbyport));
447 define('BUFFER', 'B',
448 qw(gethostent gethostbyaddr gethostbyname));
449 define('BUFFER', 'B',
450 qw(getnetent getnetbyaddr getnetbyname));
451 define('BUFFER', 'B',
452 qw(getprotoent getprotobyname getprotobynumber));
453 define('BUFFER', 'B',
454 qw(getservent getservbyname getservbyport));
457 qw(gethostent gethostbyaddr gethostbyname));
459 qw(getnetent getnetbyaddr getnetbyname));
461 # The following loop accumulates the "ssif" (struct, size, init, free)
462 # sections that declare the struct members (in reentr.h), and the buffer
463 # size initialization, buffer initialization (malloc), and buffer
464 # release (free) code (in reentr.c).
466 # The loop also contains a lot of intrinsic logic about groups of
467 # functions (since functions of certain kind operate the same way).
469 for my $func (@seenf) {
471 my $ifdef = "#ifdef HAS_${FUNC}_R\n";
472 my $endif = "#endif /* HAS_${FUNC}_R */\n";
473 if (exists $seena{$func}) {
474 my @p = @{$seena{$func}};
475 if ($func =~ /^(asctime|ctime|getlogin|setlocale|strerror|ttyname)$/) {
478 char* _${func}_buffer;
479 size_t _${func}_size;
482 PL_reentrant_buffer->_${func}_size = REENTRANTSMALLSIZE;
487 elsif ($func =~ /^(crypt)$/) {
490 #if CRYPT_R_PROTO == REENTRANT_PROTO_B_CCD
491 $seend{$func} _${func}_data;
493 $seent{$func} *_${func}_struct_buffer;
497 #if CRYPT_R_PROTO != REENTRANT_PROTO_B_CCD
498 PL_reentrant_buffer->_${func}_struct_buffer = 0;
502 #if CRYPT_R_PROTO != REENTRANT_PROTO_B_CCD
503 Safefree(PL_reentrant_buffer->_${func}_struct_buffer);
508 elsif ($func =~ /^(drand48|gmtime|localtime|random|srandom)$/) {
511 $seent{$func} _${func}_struct;
513 if ($1 eq 'drand48') {
515 double _${func}_double;
517 } elsif ($1 eq 'random') {
519 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_iS
522 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_lS
523 long _${func}_retval;
525 # if RANDOM_R_PROTO == REENTRANT_PROTO_I_St
526 int32_t _${func}_retval;
532 elsif ($func =~ /^(getgrnam|getpwnam|getspnam)$/) {
534 # 'genfunc' can be read either as 'generic' or 'genre',
535 # it represents a group of functions.
537 $genfunc =~ s/nam/ent/g;
538 $genfunc =~ s/^get//;
539 my $GENFUNC = uc $genfunc;
541 $seent{$func} _${genfunc}_struct;
542 char* _${genfunc}_buffer;
543 size_t _${genfunc}_size;
546 # ifdef USE_${GENFUNC}_PTR
547 $seent{$func}* _${genfunc}_ptr;
551 # ifdef USE_${GENFUNC}_FPTR
552 FILE* _${genfunc}_fptr;
556 # ifdef USE_${GENFUNC}_FPTR
557 PL_reentrant_buffer->_${genfunc}_fptr = NULL;
560 my $sc = $genfunc eq 'grent' ?
561 '_SC_GETGR_R_SIZE_MAX' : '_SC_GETPW_R_SIZE_MAX';
562 my $sz = "_${genfunc}_size";
564 # if defined(HAS_SYSCONF) && defined($sc) && !defined(__GLIBC__)
565 PL_reentrant_buffer->$sz = sysconf($sc);
566 if (PL_reentrant_buffer->$sz == (size_t) -1)
567 PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE;
569 # if defined(__osf__) && defined(__alpha) && defined(SIABUFSIZ)
570 PL_reentrant_buffer->$sz = SIABUFSIZ;
573 PL_reentrant_buffer->$sz = BUFSIZ;
575 PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE;
580 pushinitfree $genfunc;
583 elsif ($func =~ /^(gethostbyname|getnetbyname|getservbyname|getprotobyname)$/) {
586 $genfunc =~ s/byname/ent/;
587 $genfunc =~ s/^get//;
588 my $GENFUNC = uc $genfunc;
589 my $D = ifprotomatch($FUNC, grep {/D/} @p);
590 my $d = $seend{$func};
591 $d =~ s/\*$//; # snip: we need need the base type.
593 $seent{$func} _${genfunc}_struct;
597 char* _${genfunc}_buffer;
598 size_t _${genfunc}_size;
600 # ifdef USE_${GENFUNC}_PTR
601 $seent{$func}* _${genfunc}_ptr;
605 # ifdef USE_${GENFUNC}_ERRNO
606 int _${genfunc}_errno;
611 PL_reentrant_buffer->_${genfunc}_size = REENTRANTUSUALSIZE;
616 Newx(PL_reentrant_buffer->_${genfunc}_buffer, PL_reentrant_buffer->_${genfunc}_size, char);
621 Safefree(PL_reentrant_buffer->_${genfunc}_buffer);
626 elsif ($func =~ /^(readdir|readdir64)$/) {
628 my $R = ifprotomatch($FUNC, grep {/R/} @p);
630 $seent{$func}* _${func}_struct;
631 size_t _${func}_size;
633 $seent{$func}* _${func}_ptr;
637 /* This is the size Solaris recommends.
638 * (though we go static, should use pathconf() instead) */
639 PL_reentrant_buffer->_${func}_size = sizeof($seent{$func}) + MAXPATHLEN + 1;
642 PL_reentrant_buffer->_${func}_struct = ($seent{$func}*)safemalloc(PL_reentrant_buffer->_${func}_size);
645 Safefree(PL_reentrant_buffer->_${func}_struct);
653 # if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
657 # Write out what we have learned.
660 my $v = join(", ", @v[0..$seenu{$func}-1]);
662 my ($r, $a) = split '_', $p;
663 my $test = $r eq 'I' ? ' == 0' : '';
666 if ($genfunc =~ /^(?:get|set|end)(pw|gr|host|net|proto|serv|sp)/) {
667 $genfunc = "${1}ent";
668 } elsif ($genfunc eq 'srand48') {
669 $genfunc = "drand48";
673 substr($b, 0, $seenu{$func}) = '';
674 if ($func =~ /^random$/) {
675 $true = "PL_reentrant_buffer->_random_retval";
676 } elsif ($b =~ /R/) {
677 $true = "PL_reentrant_buffer->_${genfunc}_ptr";
678 } elsif ($b =~ /T/ && $func eq 'drand48') {
679 $true = "PL_reentrant_buffer->_${genfunc}_double";
680 } elsif ($b =~ /S/) {
681 if ($func =~ /^readdir/) {
682 $true = "PL_reentrant_buffer->_${genfunc}_struct";
684 $true = "&PL_reentrant_buffer->_${genfunc}_struct";
686 } elsif ($b =~ /B/) {
687 $true = "PL_reentrant_buffer->_${genfunc}_buffer";
693 "&PL_reentrant_buffer->_${genfunc}_ptr" :
695 "&PL_reentrant_buffer->_${genfunc}_errno" :
697 "PL_reentrant_buffer->_${genfunc}_buffer" :
699 "PL_reentrant_buffer->_${genfunc}_size" :
701 "&PL_reentrant_buffer->_${genfunc}_fptr" :
703 "&PL_reentrant_buffer->_${genfunc}_data" :
705 ($func =~ /^readdir\d*$/ ?
706 "PL_reentrant_buffer->_${genfunc}_struct" :
708 "PL_reentrant_buffer->_${genfunc}_struct_buffer" :
709 "&PL_reentrant_buffer->_${genfunc}_struct") :
710 $_ eq 'T' && $func eq 'drand48' ?
711 "&PL_reentrant_buffer->_${genfunc}_double" :
712 $_ =~ /^[ilt]$/ && $func eq 'random' ?
713 "&PL_reentrant_buffer->_random_retval" :
716 $w = ", $w" if length $v;
719 my $call = "${func}_r($v$w)";
720 if ($func eq 'localtime') {
721 $call = "L_R_TZSET $call";
724 # Must make OpenBSD happy
727 ($genfunc eq 'protoent' || $genfunc eq 'servent')) {
728 $memzero = 'REENTR_MEMZERO(&PL_reentrant_buffer->_' . $genfunc . '_data, sizeof(PL_reentrant_buffer->_' . $genfunc . '_data)),';
731 # if !defined($func) && ${FUNC}_R_PROTO == REENTRANT_PROTO_$p
733 if ($r eq 'V' || $r eq 'B') {
735 # define $func($v) $call
738 if ($func =~ /^get/) {
739 my $rv = $v ? ", $v" : "";
742 # define $func($v) ($memzero(PL_reentrant_retint = $call)$test ? $true : ((PL_reentrant_retint == ERANGE) ? ($seent{$func} *) Perl_reentrant_retry("$func"$rv) : 0))
746 # define $func($v) ($call$test ? $true : ((errno == ERANGE) ? ($seent{$func} *) Perl_reentrant_retry("$func"$rv) : 0))
751 # define $func($v) ($call$test ? $true : 0)
756 # endif /* if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) */
761 # endif /* HAS_\U$func */
764 push @wrap, $endif, "\n";
772 /* Defines for indicating which special features are supported. */
777 int dummy; /* cannot have empty structs */
784 #endif /* USE_REENTRANT_API */
793 # Prepare to write the reentr.c.
795 safer_unlink 'reentr.c';
796 die "reentr.c: $!" unless open(C, ">reentr.c");
800 /* -*- buffer-read-only: t -*-
804 * Copyright (C) 2002, 2003, 2005, 2006, 2007 by Larry Wall and others
806 * You may distribute under the terms of either the GNU General Public
807 * License or the Artistic License, as specified in the README file.
809 * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
810 * This file is built by reentr.pl from data in reentr.pl.
812 * "Saruman," I said, standing away from him, "only one hand at a time can
813 * wield the One, and you know that well, so do not trouble to say we!"
815 * This file contains a collection of automatically created wrappers
816 * (created by running reentr.pl) for reentrant (thread-safe) versions of
817 * various library calls, such as getpwent_r. The wrapping is done so
818 * that other files like pp_sys.c calling those library functions need not
819 * care about the differences between various platforms' idiosyncrasies
820 * regarding these reentrant interfaces.
824 #define PERL_IN_REENTR_C
829 Perl_reentrant_size(pTHX) {
830 #ifdef USE_REENTRANT_API
831 #define REENTRANTSMALLSIZE 256 /* Make something up. */
832 #define REENTRANTUSUALSIZE 4096 /* Make something up. */
834 #endif /* USE_REENTRANT_API */
838 Perl_reentrant_init(pTHX) {
839 #ifdef USE_REENTRANT_API
840 Newx(PL_reentrant_buffer, 1, REENTR);
841 Perl_reentrant_size(aTHX);
843 #endif /* USE_REENTRANT_API */
847 Perl_reentrant_free(pTHX) {
848 #ifdef USE_REENTRANT_API
850 Safefree(PL_reentrant_buffer);
851 #endif /* USE_REENTRANT_API */
855 Perl_reentrant_retry(const char *f, ...)
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)
876 switch (PL_op->op_type) {
877 #ifdef USE_HOSTENT_BUFFER
882 #ifdef PERL_REENTRANT_MAXSIZE
883 if (PL_reentrant_buffer->_hostent_size <=
884 PERL_REENTRANT_MAXSIZE / 2)
887 PL_reentrant_buffer->_hostent_size *= 2;
888 Renew(PL_reentrant_buffer->_hostent_buffer,
889 PL_reentrant_buffer->_hostent_size, char);
890 switch (PL_op->op_type) {
892 p0 = va_arg(ap, void *);
893 asize = va_arg(ap, size_t);
894 anint = va_arg(ap, int);
895 retptr = gethostbyaddr(p0, asize, anint); break;
897 p0 = va_arg(ap, void *);
898 retptr = gethostbyname((char *)p0); break;
900 retptr = gethostent(); break;
902 SETERRNO(ERANGE, LIB_INVARG);
909 #ifdef USE_GRENT_BUFFER
914 #ifdef PERL_REENTRANT_MAXSIZE
915 if (PL_reentrant_buffer->_grent_size <=
916 PERL_REENTRANT_MAXSIZE / 2)
920 PL_reentrant_buffer->_grent_size *= 2;
921 Renew(PL_reentrant_buffer->_grent_buffer,
922 PL_reentrant_buffer->_grent_size, char);
923 switch (PL_op->op_type) {
925 p0 = va_arg(ap, void *);
926 retptr = getgrnam((char *)p0); break;
928 #if Gid_t_size < INTSIZE
929 gid = (Gid_t)va_arg(ap, int);
931 gid = va_arg(ap, Gid_t);
933 retptr = getgrgid(gid); break;
935 retptr = getgrent(); break;
937 SETERRNO(ERANGE, LIB_INVARG);
944 #ifdef USE_NETENT_BUFFER
949 #ifdef PERL_REENTRANT_MAXSIZE
950 if (PL_reentrant_buffer->_netent_size <=
951 PERL_REENTRANT_MAXSIZE / 2)
955 PL_reentrant_buffer->_netent_size *= 2;
956 Renew(PL_reentrant_buffer->_netent_buffer,
957 PL_reentrant_buffer->_netent_size, char);
958 switch (PL_op->op_type) {
960 net = va_arg(ap, Netdb_net_t);
961 anint = va_arg(ap, int);
962 retptr = getnetbyaddr(net, anint); break;
964 p0 = va_arg(ap, void *);
965 retptr = getnetbyname((char *)p0); break;
967 retptr = getnetent(); break;
969 SETERRNO(ERANGE, LIB_INVARG);
976 #ifdef USE_PWENT_BUFFER
981 #ifdef PERL_REENTRANT_MAXSIZE
982 if (PL_reentrant_buffer->_pwent_size <=
983 PERL_REENTRANT_MAXSIZE / 2)
987 PL_reentrant_buffer->_pwent_size *= 2;
988 Renew(PL_reentrant_buffer->_pwent_buffer,
989 PL_reentrant_buffer->_pwent_size, char);
990 switch (PL_op->op_type) {
992 p0 = va_arg(ap, void *);
993 retptr = getpwnam((char *)p0); break;
995 #if Uid_t_size < INTSIZE
996 uid = (Uid_t)va_arg(ap, int);
998 uid = va_arg(ap, Uid_t);
1000 retptr = getpwuid(uid); break;
1002 retptr = getpwent(); break;
1004 SETERRNO(ERANGE, LIB_INVARG);
1011 #ifdef USE_PROTOENT_BUFFER
1016 #ifdef PERL_REENTRANT_MAXSIZE
1017 if (PL_reentrant_buffer->_protoent_size <=
1018 PERL_REENTRANT_MAXSIZE / 2)
1021 PL_reentrant_buffer->_protoent_size *= 2;
1022 Renew(PL_reentrant_buffer->_protoent_buffer,
1023 PL_reentrant_buffer->_protoent_size, char);
1024 switch (PL_op->op_type) {
1026 p0 = va_arg(ap, void *);
1027 retptr = getprotobyname((char *)p0); break;
1029 anint = va_arg(ap, int);
1030 retptr = getprotobynumber(anint); break;
1032 retptr = getprotoent(); break;
1034 SETERRNO(ERANGE, LIB_INVARG);
1041 #ifdef USE_SERVENT_BUFFER
1046 #ifdef PERL_REENTRANT_MAXSIZE
1047 if (PL_reentrant_buffer->_servent_size <=
1048 PERL_REENTRANT_MAXSIZE / 2)
1051 PL_reentrant_buffer->_servent_size *= 2;
1052 Renew(PL_reentrant_buffer->_servent_buffer,
1053 PL_reentrant_buffer->_servent_size, char);
1054 switch (PL_op->op_type) {
1056 p0 = va_arg(ap, void *);
1057 p1 = va_arg(ap, void *);
1058 retptr = getservbyname((char *)p0, (char *)p1); break;
1060 anint = va_arg(ap, int);
1061 p0 = va_arg(ap, void *);
1062 retptr = getservbyport(anint, (char *)p0); break;
1064 retptr = getservent(); break;
1066 SETERRNO(ERANGE, LIB_INVARG);
1074 /* Not known how to retry, so just fail. */
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 gmtime T |time |struct tm |S_TS|I_TS|T=const time_t*
1121 localtime T |time |struct tm |S_TS|I_TS|T=const time_t*
1122 random |stdlib |struct random_data|I_iS|I_lS|I_St|i=int*|l=long*|t=int32_t*
1123 readdir T |dirent |struct dirent |I_TSR|I_TS|T=DIR*
1124 readdir64 T |dirent |struct dirent64|I_TSR|I_TS|T=DIR*
1125 setgrent |grp | |I_H|V_H
1126 sethostent I |netdb | |I_ID|V_ID|D=struct hostent_data*
1127 setlocale IC |locale | |I_ICBI
1128 setnetent I |netdb | |I_ID|V_ID|D=struct netent_data*
1129 setprotoent I |netdb | |I_ID|V_ID|D=struct protoent_data*
1130 setpwent |pwd | |I_H|V_H
1131 setservent I |netdb | |I_ID|V_ID|D=struct servent_data*
1132 srand48 L |stdlib |struct drand48_data |I_LS
1133 srandom T |stdlib |struct random_data|I_TS|T=unsigned int
1134 strerror I |string | |I_IBW|I_IBI|B_IBW
1135 tmpnam B |stdio | |B_B
1136 ttyname I |unistd | |I_IBW|I_IBI|B_IBI