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)
53 sub open_print_header {
54 my ($file, $quote) = @_;
55 return open_new($file, '>',
56 { by => 'regen/reentr.pl',
57 from => 'data in regen/reentr.pl',
58 file => $file, style => '*',
59 copyright => [2002, 2003, 2005 .. 2007],
63 my $h = open_print_header('reentr.h');
68 /* If compiling for a threaded perl, we will macro-wrap the system/library
69 * interfaces (e.g. getpwent()) which have threaded versions
70 * (e.g. getpwent_r()), which will handle things correctly for
71 * the Perl interpreter, but otherwise (for XS) the wrapping does
72 * not take place. See L<perlxs/Thread-aware system interfaces>.
75 #ifndef PERL_REENTR_API
76 # if defined(PERL_CORE) || defined(PERL_EXT)
77 # define PERL_REENTR_API 1
79 # define PERL_REENTR_API 0
83 #ifdef USE_REENTRANT_API
85 /* Deprecations: some platforms have the said reentrant interfaces
86 * but they are declared obsolete and are not to be used. Often this
87 * means that the platform has threadsafed the interfaces (hopefully).
88 * All this is OS version dependent, so we are of course fooling ourselves.
89 * If you know of more deprecations on some platforms, please add your own
90 * (by editing reentr.pl, mind!) */
94 # undef HAS_ENDGRENT_R
95 # undef HAS_ENDPWENT_R
96 # undef HAS_GETGRENT_R
97 # undef HAS_GETPWENT_R
98 # undef HAS_SETLOCALE_R
99 # undef HAS_STRERROR_R
100 # define NETDB_R_OBSOLETE
103 #if defined(__osf__) && defined(__alpha) /* Tru64 aka Digital UNIX */
105 # undef HAS_STRERROR_R
106 # define NETDB_R_OBSOLETE
110 * As of OpenBSD 3.7, reentrant functions are now working, they just are
111 * incompatible with everyone else. To make OpenBSD happy, we have to
112 * memzero out certain structures before calling the functions.
114 #if defined(__OpenBSD__)
115 # define REENTR_MEMZERO(a,b) memzero(a,b)
117 # define REENTR_MEMZERO(a,b) 0
120 #ifdef NETDB_R_OBSOLETE
121 # undef HAS_ENDHOSTENT_R
122 # undef HAS_ENDNETENT_R
123 # undef HAS_ENDPROTOENT_R
124 # undef HAS_ENDSERVENT_R
125 # undef HAS_GETHOSTBYADDR_R
126 # undef HAS_GETHOSTBYNAME_R
127 # undef HAS_GETHOSTENT_R
128 # undef HAS_GETNETBYADDR_R
129 # undef HAS_GETNETBYNAME_R
130 # undef HAS_GETNETENT_R
131 # undef HAS_GETPROTOBYNAME_R
132 # undef HAS_GETPROTOBYNUMBER_R
133 # undef HAS_GETPROTOENT_R
134 # undef HAS_GETSERVBYNAME_R
135 # undef HAS_GETSERVBYPORT_R
136 # undef HAS_GETSERVENT_R
137 # undef HAS_SETHOSTENT_R
138 # undef HAS_SETNETENT_R
139 # undef HAS_SETPROTOENT_R
140 # undef HAS_SETSERVENT_R
157 #ifdef HAS_GETSPNAM_R
165 my %seenh; # the different prototypes signatures for this function
166 my %seena; # the different prototypes signatures for this function in order
167 my @seenf; # all the seen functions
168 my %seenp; # the different prototype signatures for all functions
169 my %seent; # the return type of this function
170 my %seens; # the type of this function's "S"
171 my %seend; # the type of this function's "D"
172 my %seenm; # all the types
173 my %seenu; # the length of the argument list of this function
175 while (<DATA>) { # Read in the protoypes.
178 my ($func, $hdr, $type, @p) = split(/\s*\|\s*/, $_, -1);
180 # Split off the real function name and the argument list.
181 ($func, $u) = split(' ', $func);
182 $seenu{$func} = defined $u ? length $u : 0;
183 my $FUNC = uc $func; # for output.
191 # Set any special mapping variables (like X=x_t)
193 while ($p[-1] =~ /=/) {
194 my ($k, $v) = ($p[-1] =~ /^([A-Za-z])\s*=\s*(.*)/);
200 # If given the -U option open up the metaconfig unit for this function.
201 if ($opts{U} && open(U, ">d_${func}_r.U")) {
206 # The metaconfig units needs prerequisite dependencies.
210 if ($hdr ne 'stdio') { # There's no i_stdio.
213 $prereqsh = "\$$prereqs $prereqh";
215 my @prereq = qw(Inlibc Protochk Hasproto i_systypes usethreads);
216 push @prereq, $prereqs;
217 my $hdrs = "\$i_systypes sys/types.h define stdio.h $prereqsh";
218 if ($hdr eq 'time') {
219 $hdrs .= " \$i_systime sys/time.h";
220 push @prereq, 'i_systime';
222 # Output the metaconfig unit header.
224 ?RCS: \$Id: d_${func}_r.U,v $
226 ?RCS: Copyright (c) 2002,2003 Jarkko Hietaniemi
228 ?RCS: You may distribute under the terms of either the GNU General Public
229 ?RCS: License or the Artistic License, as specified in the README file.
231 ?RCS: Generated by the reentr.pl from the Perl 5.8 distribution.
233 ?MAKE:d_${func}_r ${func}_r_proto: @prereq
234 ?MAKE: -pick add \$@ %<
236 ?S: This variable conditionally defines the HAS_${FUNC}_R symbol,
237 ?S: which indicates to the C program that the ${func}_r()
238 ?S: routine is available.
241 ?S: This variable encodes the prototype of ${func}_r.
242 ?S: It is zero if d_${func}_r is undef, and one of the
243 ?S: REENTRANT_PROTO_T_ABC macros of reentr.h if d_${func}_r
247 ?C: This symbol, if defined, indicates that the ${func}_r routine
248 ?C: is available to ${func} re-entrantly.
251 ?C: This symbol encodes the prototype of ${func}_r.
252 ?C: It is zero if d_${func}_r is undef, and one of the
253 ?C: REENTRANT_PROTO_T_ABC macros of reentr.h if d_${func}_r
256 ?H:#\$d_${func}_r HAS_${FUNC}_R /**/
257 ?H:#define ${FUNC}_R_PROTO \$${func}_r_proto /**/
259 ?T:try hdrs d_${func}_r_proto
260 ?LINT:set d_${func}_r
261 ?LINT:set ${func}_r_proto
262 : see if ${func}_r exists
263 set ${func}_r d_${func}_r
265 case "\$d_${func}_r" in
270 case "\$d_${func}_r_proto:\$usethreads" in
271 ":define") d_${func}_r_proto=define
272 set d_${func}_r_proto ${func}_r \$hdrs
276 case "\$d_${func}_r_proto" in
281 my ($r, $a) = ($p =~ /^(.)_(.+)/);
282 my $v = join(", ", map { $m{$_} } split '', $a);
285 case "\$${func}_r_proto" in
286 ''|0) try='$m{$r} ${func}_r($v);'
287 ./protochk "extern \$try" \$hdrs && ${func}_r_proto=$p ;;
291 $seenh{$func}->{$p}++;
292 push @{$seena{$func}}, $p;
294 $seent{$func} = $type;
295 $seens{$func} = $m{S};
296 $seend{$func} = $m{D};
301 case "\$${func}_r_proto" in
302 ''|0) d_${func}_r=undef
304 echo "Disabling ${func}_r, cannot determine prototype." >&4 ;;
305 * ) case "\$${func}_r_proto" in
307 *) ${func}_r_proto="REENTRANT_PROTO_\$${func}_r_proto" ;;
309 echo "Prototype: \$try" ;;
312 *) case "\$usethreads" in
313 define) echo "${func}_r has no prototype, not using it." >&4 ;;
332 # Write out all the known prototype signatures.
334 for my $p (sort keys %seenp) {
335 print $h "#define REENTRANT_PROTO_${p} ${i}\n";
340 my @struct; # REENTR struct members
341 my @size; # struct member buffer size initialization code
342 my @init; # struct member buffer initialization (malloc) code
343 my @free; # struct member buffer release (free) code
344 my @wrap; # the wrapper (foo(a) -> foo_r(a,...)) cpp code
345 my @define; # defines for optional features
349 join " || ", map { "${FUNC}_R_PROTO == REENTRANT_PROTO_$_" } @_;
362 Newx(PL_reentrant_buffer->_${func}_buffer, PL_reentrant_buffer->_${func}_size, char);
365 Safefree(PL_reentrant_buffer->_${func}_buffer);
370 my ($n, $p, @F) = @_;
374 /* The @F using \L$n? */
380 my $HAS = "${FUNC}_R_HAS_$n";
382 my @h = grep { /$p/ } @{$seena{$func}};
383 unless (defined $GENFUNC) {
385 $GENFUNC =~ s/^GET//;
388 push @define, "#if defined(HAS_${FUNC}_R) && (" . join(" || ", map { "${FUNC}_R_PROTO == REENTRANT_PROTO_$_" } @h) . ")\n";
401 /* Any of the @F using \L$n? */
404 push @define, "#if (" . join(" || ", map { "defined($_)" } @H) . ")\n";
406 # define USE_${GENFUNC}_$n
408 # undef USE_${GENFUNC}_$n
414 define('BUFFER', 'B',
415 qw(getgrent getgrgid getgrnam));
418 qw(getgrent getgrgid getgrnam));
420 qw(getpwent getpwnam getpwuid));
422 qw(getspent getspnam));
425 qw(getgrent getgrgid getgrnam setgrent endgrent));
427 qw(getpwent getpwnam getpwuid setpwent endpwent));
429 define('BUFFER', 'B',
430 qw(getpwent getpwgid getpwnam));
433 qw(gethostent gethostbyaddr gethostbyname));
435 qw(getnetent getnetbyaddr getnetbyname));
437 qw(getprotoent getprotobyname getprotobynumber));
439 qw(getservent getservbyname getservbyport));
441 define('BUFFER', 'B',
442 qw(gethostent gethostbyaddr gethostbyname));
443 define('BUFFER', 'B',
444 qw(getnetent getnetbyaddr getnetbyname));
445 define('BUFFER', 'B',
446 qw(getprotoent getprotobyname getprotobynumber));
447 define('BUFFER', 'B',
448 qw(getservent getservbyname getservbyport));
451 qw(gethostent gethostbyaddr gethostbyname));
453 qw(getnetent getnetbyaddr getnetbyname));
455 # The following loop accumulates the "ssif" (struct, size, init, free)
456 # sections that declare the struct members (in reentr.h), and the buffer
457 # size initialization, buffer initialization (malloc), and buffer
458 # release (free) code (in reentr.c).
460 # The loop also contains a lot of intrinsic logic about groups of
461 # functions (since functions of certain kind operate the same way).
463 for my $func (@seenf) {
465 my $ifdef = "#ifdef HAS_${FUNC}_R\n";
466 my $endif = "#endif /* HAS_${FUNC}_R */\n";
467 if (exists $seena{$func}) {
468 my @p = @{$seena{$func}};
469 if ($func =~ /^(asctime|ctime|getlogin|setlocale|strerror|ttyname)$/) {
472 char* _${func}_buffer;
473 size_t _${func}_size;
476 PL_reentrant_buffer->_${func}_size = REENTRANTSMALLSIZE;
481 elsif ($func =~ /^(crypt)$/) {
484 #if CRYPT_R_PROTO == REENTRANT_PROTO_B_CCD
485 $seend{$func} _${func}_data;
487 $seent{$func} *_${func}_struct_buffer;
491 #if CRYPT_R_PROTO != REENTRANT_PROTO_B_CCD
492 PL_reentrant_buffer->_${func}_struct_buffer = 0;
496 #if CRYPT_R_PROTO != REENTRANT_PROTO_B_CCD
497 Safefree(PL_reentrant_buffer->_${func}_struct_buffer);
502 elsif ($func =~ /^(getgrnam|getpwnam|getspnam)$/) {
504 # 'genfunc' can be read either as 'generic' or 'genre',
505 # it represents a group of functions.
507 $genfunc =~ s/nam/ent/g;
508 $genfunc =~ s/^get//;
509 my $GENFUNC = uc $genfunc;
511 $seent{$func} _${genfunc}_struct;
512 char* _${genfunc}_buffer;
513 size_t _${genfunc}_size;
516 # ifdef USE_${GENFUNC}_PTR
517 $seent{$func}* _${genfunc}_ptr;
521 # ifdef USE_${GENFUNC}_FPTR
522 FILE* _${genfunc}_fptr;
526 # ifdef USE_${GENFUNC}_FPTR
527 PL_reentrant_buffer->_${genfunc}_fptr = NULL;
530 my $sc = $genfunc eq 'grent' ?
531 '_SC_GETGR_R_SIZE_MAX' : '_SC_GETPW_R_SIZE_MAX';
532 my $sz = "_${genfunc}_size";
534 # if defined(HAS_SYSCONF) && defined($sc) && !defined(__GLIBC__)
535 PL_reentrant_buffer->$sz = sysconf($sc);
536 if (PL_reentrant_buffer->$sz == (size_t) -1)
537 PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE;
539 # if defined(__osf__) && defined(__alpha) && defined(SIABUFSIZ)
540 PL_reentrant_buffer->$sz = SIABUFSIZ;
543 PL_reentrant_buffer->$sz = BUFSIZ;
545 PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE;
550 pushinitfree $genfunc;
553 elsif ($func =~ /^(gethostbyname|getnetbyname|getservbyname|getprotobyname)$/) {
556 $genfunc =~ s/byname/ent/;
557 $genfunc =~ s/^get//;
558 my $GENFUNC = uc $genfunc;
559 my $D = ifprotomatch($FUNC, grep {/D/} @p);
560 my $d = $seend{$func};
561 $d =~ s/\*$//; # snip: we need the base type.
563 $seent{$func} _${genfunc}_struct;
567 char* _${genfunc}_buffer;
568 size_t _${genfunc}_size;
570 # ifdef USE_${GENFUNC}_PTR
571 $seent{$func}* _${genfunc}_ptr;
575 # ifdef USE_${GENFUNC}_ERRNO
576 int _${genfunc}_errno;
581 PL_reentrant_buffer->_${genfunc}_size = REENTRANTUSUALSIZE;
586 Newx(PL_reentrant_buffer->_${genfunc}_buffer, PL_reentrant_buffer->_${genfunc}_size, char);
591 Safefree(PL_reentrant_buffer->_${genfunc}_buffer);
596 elsif ($func =~ /^(readdir|readdir64)$/) {
598 my $R = ifprotomatch($FUNC, grep {/R/} @p);
600 $seent{$func}* _${func}_struct;
601 size_t _${func}_size;
603 $seent{$func}* _${func}_ptr;
607 /* This is the size Solaris recommends.
608 * (though we go static, should use pathconf() instead) */
609 PL_reentrant_buffer->_${func}_size = sizeof($seent{$func}) + MAXPATHLEN + 1;
612 PL_reentrant_buffer->_${func}_struct = ($seent{$func}*)safemalloc(PL_reentrant_buffer->_${func}_size);
615 Safefree(PL_reentrant_buffer->_${func}_struct);
623 # if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
627 # Write out what we have learned.
630 my $v = join(", ", @v[0..$seenu{$func}-1]);
632 my ($r, $a) = split '_', $p;
633 my $test = $r eq 'I' ? ' == 0' : '';
636 if ($genfunc =~ /^(?:get|set|end)(pw|gr|host|net|proto|serv|sp)/) {
637 $genfunc = "${1}ent";
641 substr($b, 0, $seenu{$func}) = '';
643 $true = "PL_reentrant_buffer->_${genfunc}_ptr";
644 } elsif ($b =~ /S/) {
645 if ($func =~ /^readdir/) {
646 $true = "PL_reentrant_buffer->_${genfunc}_struct";
648 $true = "&PL_reentrant_buffer->_${genfunc}_struct";
650 } elsif ($b =~ /B/) {
651 $true = "PL_reentrant_buffer->_${genfunc}_buffer";
657 "&PL_reentrant_buffer->_${genfunc}_ptr" :
659 "&PL_reentrant_buffer->_${genfunc}_errno" :
661 "PL_reentrant_buffer->_${genfunc}_buffer" :
663 "PL_reentrant_buffer->_${genfunc}_size" :
665 "&PL_reentrant_buffer->_${genfunc}_fptr" :
667 "&PL_reentrant_buffer->_${genfunc}_data" :
669 ($func =~ /^readdir\d*$/ ?
670 "PL_reentrant_buffer->_${genfunc}_struct" :
672 "PL_reentrant_buffer->_${genfunc}_struct_buffer" :
673 "&PL_reentrant_buffer->_${genfunc}_struct") :
676 $w = ", $w" if length $v;
679 my $call = "${func}_r($v$w)";
681 # Must make OpenBSD happy
684 ($genfunc eq 'protoent' || $genfunc eq 'servent')) {
685 $memzero = 'REENTR_MEMZERO(&PL_reentrant_buffer->_' . $genfunc . '_data, sizeof(PL_reentrant_buffer->_' . $genfunc . '_data)),';
688 # if !defined($func) && ${FUNC}_R_PROTO == REENTRANT_PROTO_$p
690 if ($r eq 'V' || $r eq 'B') {
692 # define $func($v) $call
695 if ($func =~ /^get/) {
696 my $rv = $v ? ", $v" : "";
699 # define $func($v) ($memzero(PL_reentrant_retint = $call)$test ? $true : ((PL_reentrant_retint == ERANGE) ? ($seent{$func} *) Perl_reentrant_retry("$func"$rv) : 0))
703 # define $func($v) ($call$test ? $true : ((errno == ERANGE) ? ($seent{$func} *) Perl_reentrant_retry("$func"$rv) : 0))
708 # define $func($v) ($call$test ? $true : 0)
712 push @wrap, <<EOF; # !defined(xxx) && XXX_R_PROTO == REENTRANT_PROTO_Y_TS
717 push @wrap, <<EOF; # defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1)
721 push @wrap, $endif, "\n";
729 /* Defines for indicating which special features are supported. */
734 int dummy; /* cannot have empty structs */
741 #endif /* USE_REENTRANT_API */
746 read_only_bottom_close_and_rename($h);
748 # Prepare to write the reentr.c.
750 my $c = open_print_header('reentr.c', <<'EOQ');
754 * "Saruman," I said, standing away from him, "only one hand at a time can
755 * wield the One, and you know that well, so do not trouble to say we!"
757 * [p.260 of _The Lord of the Rings_, II/ii: "The Council of Elrond"]
761 * This file contains a collection of automatically created wrappers
762 * (created by running reentr.pl) for reentrant (thread-safe) versions of
763 * various library calls, such as getpwent_r. The wrapping is done so
764 * that other files like pp_sys.c calling those library functions need not
765 * care about the differences between various platforms' idiosyncrasies
766 * regarding these reentrant interfaces.
772 #define PERL_IN_REENTR_C
777 Perl_reentrant_size(pTHX) {
779 #ifdef USE_REENTRANT_API
780 #define REENTRANTSMALLSIZE 256 /* Make something up. */
781 #define REENTRANTUSUALSIZE 4096 /* Make something up. */
783 #endif /* USE_REENTRANT_API */
787 Perl_reentrant_init(pTHX) {
789 #ifdef USE_REENTRANT_API
790 Newx(PL_reentrant_buffer, 1, REENTR);
791 Perl_reentrant_size(aTHX);
793 #endif /* USE_REENTRANT_API */
797 Perl_reentrant_free(pTHX) {
799 #ifdef USE_REENTRANT_API
801 Safefree(PL_reentrant_buffer);
802 #endif /* USE_REENTRANT_API */
806 Perl_reentrant_retry(const char *f, ...)
810 #ifdef USE_REENTRANT_API
812 /* Easier to special case this here than in embed.pl. (Look at what it
813 generates for proto.h) */
814 PERL_ARGS_ASSERT_REENTRANT_RETRY;
818 #ifdef USE_REENTRANT_API
819 # 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)
822 # if defined(USE_SERVENT_BUFFER)
825 # if defined(USE_HOSTENT_BUFFER)
828 # if defined(USE_HOSTENT_BUFFER) || defined(USE_NETENT_BUFFER) || defined(USE_PROTOENT_BUFFER) || defined(USE_SERVENT_BUFFER)
832 switch (PL_op->op_type) {
833 #ifdef USE_HOSTENT_BUFFER
838 #ifdef PERL_REENTRANT_MAXSIZE
839 if (PL_reentrant_buffer->_hostent_size <=
840 PERL_REENTRANT_MAXSIZE / 2)
843 PL_reentrant_buffer->_hostent_size *= 2;
844 Renew(PL_reentrant_buffer->_hostent_buffer,
845 PL_reentrant_buffer->_hostent_size, char);
846 switch (PL_op->op_type) {
848 p0 = va_arg(ap, void *);
849 asize = va_arg(ap, size_t);
850 anint = va_arg(ap, int);
851 retptr = gethostbyaddr(p0, asize, anint); break;
853 p0 = va_arg(ap, void *);
854 retptr = gethostbyname((char *)p0); break;
856 retptr = gethostent(); break;
858 SETERRNO(ERANGE, LIB_INVARG);
865 #ifdef USE_GRENT_BUFFER
870 #ifdef PERL_REENTRANT_MAXSIZE
871 if (PL_reentrant_buffer->_grent_size <=
872 PERL_REENTRANT_MAXSIZE / 2)
876 PL_reentrant_buffer->_grent_size *= 2;
877 Renew(PL_reentrant_buffer->_grent_buffer,
878 PL_reentrant_buffer->_grent_size, char);
879 switch (PL_op->op_type) {
881 p0 = va_arg(ap, void *);
882 retptr = getgrnam((char *)p0); break;
884 #if Gid_t_size < INTSIZE
885 gid = (Gid_t)va_arg(ap, int);
887 gid = va_arg(ap, Gid_t);
889 retptr = getgrgid(gid); break;
891 retptr = getgrent(); break;
893 SETERRNO(ERANGE, LIB_INVARG);
900 #ifdef USE_NETENT_BUFFER
905 #ifdef PERL_REENTRANT_MAXSIZE
906 if (PL_reentrant_buffer->_netent_size <=
907 PERL_REENTRANT_MAXSIZE / 2)
911 PL_reentrant_buffer->_netent_size *= 2;
912 Renew(PL_reentrant_buffer->_netent_buffer,
913 PL_reentrant_buffer->_netent_size, char);
914 switch (PL_op->op_type) {
916 net = va_arg(ap, Netdb_net_t);
917 anint = va_arg(ap, int);
918 retptr = getnetbyaddr(net, anint); break;
920 p0 = va_arg(ap, void *);
921 retptr = getnetbyname((char *)p0); break;
923 retptr = getnetent(); break;
925 SETERRNO(ERANGE, LIB_INVARG);
932 #ifdef USE_PWENT_BUFFER
937 #ifdef PERL_REENTRANT_MAXSIZE
938 if (PL_reentrant_buffer->_pwent_size <=
939 PERL_REENTRANT_MAXSIZE / 2)
943 PL_reentrant_buffer->_pwent_size *= 2;
944 Renew(PL_reentrant_buffer->_pwent_buffer,
945 PL_reentrant_buffer->_pwent_size, char);
946 switch (PL_op->op_type) {
948 p0 = va_arg(ap, void *);
949 retptr = getpwnam((char *)p0); break;
951 #if Uid_t_size < INTSIZE
952 uid = (Uid_t)va_arg(ap, int);
954 uid = va_arg(ap, Uid_t);
956 retptr = getpwuid(uid); break;
957 #if defined(HAS_GETPWENT) || defined(HAS_GETPWENT_R)
959 retptr = getpwent(); break;
962 SETERRNO(ERANGE, LIB_INVARG);
969 #ifdef USE_PROTOENT_BUFFER
974 #ifdef PERL_REENTRANT_MAXSIZE
975 if (PL_reentrant_buffer->_protoent_size <=
976 PERL_REENTRANT_MAXSIZE / 2)
979 PL_reentrant_buffer->_protoent_size *= 2;
980 Renew(PL_reentrant_buffer->_protoent_buffer,
981 PL_reentrant_buffer->_protoent_size, char);
982 switch (PL_op->op_type) {
984 p0 = va_arg(ap, void *);
985 retptr = getprotobyname((char *)p0); break;
987 anint = va_arg(ap, int);
988 retptr = getprotobynumber(anint); break;
990 retptr = getprotoent(); break;
992 SETERRNO(ERANGE, LIB_INVARG);
999 #ifdef USE_SERVENT_BUFFER
1004 #ifdef PERL_REENTRANT_MAXSIZE
1005 if (PL_reentrant_buffer->_servent_size <=
1006 PERL_REENTRANT_MAXSIZE / 2)
1009 PL_reentrant_buffer->_servent_size *= 2;
1010 Renew(PL_reentrant_buffer->_servent_buffer,
1011 PL_reentrant_buffer->_servent_size, char);
1012 switch (PL_op->op_type) {
1014 p0 = va_arg(ap, void *);
1015 p1 = va_arg(ap, void *);
1016 retptr = getservbyname((char *)p0, (char *)p1); break;
1018 anint = va_arg(ap, int);
1019 p0 = va_arg(ap, void *);
1020 retptr = getservbyport(anint, (char *)p0); break;
1022 retptr = getservent(); break;
1024 SETERRNO(ERANGE, LIB_INVARG);
1032 /* Not known how to retry, so just fail. */
1044 read_only_bottom_close_and_rename($c);
1047 asctime S |time |const struct tm|B_SB|B_SBI|I_SB|I_SBI
1048 crypt CC |crypt |struct crypt_data|B_CCS|B_CCD|D=CRYPTD*
1049 ctermid B |stdio | |B_B
1050 ctime S |time |const time_t |B_SB|B_SBI|I_SB|I_SBI
1051 endgrent |grp | |I_H|V_H
1052 endhostent |netdb | |I_D|V_D|D=struct hostent_data*
1053 endnetent |netdb | |I_D|V_D|D=struct netent_data*
1054 endprotoent |netdb | |I_D|V_D|D=struct protoent_data*
1055 endpwent |pwd | |I_H|V_H
1056 endservent |netdb | |I_D|V_D|D=struct servent_data*
1057 getgrent |grp |struct group |I_SBWR|I_SBIR|S_SBW|S_SBI|I_SBI|I_SBIH
1058 getgrgid T |grp |struct group |I_TSBWR|I_TSBIR|I_TSBI|S_TSBI|T=gid_t
1059 getgrnam C |grp |struct group |I_CSBWR|I_CSBIR|S_CBI|I_CSBI|S_CSBI
1060 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
1061 gethostbyname C |netdb |struct hostent |I_CSBWRE|S_CSBIE|I_CSD|D=struct hostent_data*
1062 gethostent |netdb |struct hostent |I_SBWRE|I_SBIE|S_SBIE|S_SBI|I_SBI|I_SD|D=struct hostent_data*
1063 getlogin |unistd |char |I_BW|I_BI|B_BW|B_BI
1064 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
1065 getnetbyname C |netdb |struct netent |I_CSBWRE|I_CSBI|S_CSBI|I_CSD|D=struct netent_data*
1066 getnetent |netdb |struct netent |I_SBWRE|I_SBIE|S_SBIE|S_SBI|I_SBI|I_SD|D=struct netent_data*
1067 getprotobyname C|netdb |struct protoent|I_CSBWR|S_CSBI|I_CSD|D=struct protoent_data*
1068 getprotobynumber I |netdb |struct protoent|I_ISBWR|S_ISBI|I_ISD|D=struct protoent_data*
1069 getprotoent |netdb |struct protoent|I_SBWR|I_SBI|S_SBI|I_SD|D=struct protoent_data*
1070 getpwent |pwd |struct passwd |I_SBWR|I_SBIR|S_SBW|S_SBI|I_SBI|I_SBIH
1071 getpwnam C |pwd |struct passwd |I_CSBWR|I_CSBIR|S_CSBI|I_CSBI
1072 getpwuid T |pwd |struct passwd |I_TSBWR|I_TSBIR|I_TSBI|S_TSBI|T=uid_t
1073 getservbyname CC|netdb |struct servent |I_CCSBWR|S_CCSBI|I_CCSD|D=struct servent_data*
1074 getservbyport IC|netdb |struct servent |I_ICSBWR|S_ICSBI|I_ICSD|D=struct servent_data*
1075 getservent |netdb |struct servent |I_SBWR|I_SBI|S_SBI|I_SD|D=struct servent_data*
1076 getspnam C |shadow |struct spwd |I_CSBWR|S_CSBI
1077 readdir T |dirent |struct dirent |I_TSR|I_TS|T=DIR*
1078 readdir64 T |dirent |struct dirent64|I_TSR|I_TS|T=DIR*
1079 setgrent |grp | |I_H|V_H
1080 sethostent I |netdb | |I_ID|V_ID|D=struct hostent_data*
1081 setlocale IC |locale | |I_ICBI
1082 setnetent I |netdb | |I_ID|V_ID|D=struct netent_data*
1083 setprotoent I |netdb | |I_ID|V_ID|D=struct protoent_data*
1084 setpwent |pwd | |I_H|V_H
1085 setservent I |netdb | |I_ID|V_ID|D=struct servent_data*
1086 strerror I |string | |I_IBW|I_IBI|B_IBW
1087 tmpnam B |stdio | |B_B
1088 ttyname I |unistd | |I_IBW|I_IBI|B_IBI