4 # Generate the reentr.c and reentr.h,
5 # and optionally also the relevant metaconfig units (-U option).
15 A => "char*", # as an input argument
16 B => "char*", # as an output argument
17 C => "const char*", # as a read-only input argument
25 # (See the definitions after __DATA__.)
26 # In func|inc|type|... a "S" means "type*", and a "R" means "type**".
27 # (The "types" are often structs, such as "struct passwd".)
29 # After the prototypes one can have |X=...|Y=... to define more types.
30 # A commonly used extra type is to define D to be equal to "type_data",
31 # for example "struct_hostent_data to" go with "struct hostent".
33 # Example #1: I_XSBWR means int func_r(X, type, char*, size_t, type**)
34 # Example #2: S_SBIE means type func_r(type, char*, int, int*)
35 # Example #3: S_CBI means type func_r(const char*, char*, int)
38 die "reentr.h: $!" unless open(H, ">reentr.h");
44 * Copyright (C) 2002, 2003, by Larry Wall and others
46 * You may distribute under the terms of either the GNU General Public
47 * License or the Artistic License, as specified in the README file.
49 * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
50 * This file is built by reentrl.pl from data in reentr.pl.
56 #ifdef USE_REENTRANT_API
58 /* Deprecations: some platforms have the said reentrant interfaces
59 * but they are declared obsolete and are not to be used. Often this
60 * means that the platform has threadsafed the interfaces (hopefully).
61 * All this is OS version dependent, so we are of course fooling ourselves.
62 * If you know of more deprecations on some platforms, please add your own. */
67 # undef HAS_ENDGRENT_R
68 # undef HAS_ENDPWENT_R
69 # undef HAS_GETGRENT_R
70 # undef HAS_GETPWENT_R
71 # undef HAS_SETLOCALE_R
73 # undef HAS_STRERROR_R
74 # define NETDB_R_OBSOLETE
77 #if defined(__osf__) && defined(__alpha) /* Tru64 aka Digital UNIX */
79 # undef HAS_STRERROR_R
80 # define NETDB_R_OBSOLETE
83 #ifdef NETDB_R_OBSOLETE
84 # undef HAS_ENDHOSTENT_R
85 # undef HAS_ENDNETENT_R
86 # undef HAS_ENDPROTOENT_R
87 # undef HAS_ENDSERVENT_R
88 # undef HAS_GETHOSTBYADDR_R
89 # undef HAS_GETHOSTBYNAME_R
90 # undef HAS_GETHOSTENT_R
91 # undef HAS_GETNETBYADDR_R
92 # undef HAS_GETNETBYNAME_R
93 # undef HAS_GETNETENT_R
94 # undef HAS_GETPROTOBYNAME_R
95 # undef HAS_GETPROTOBYNUMBER_R
96 # undef HAS_GETPROTOENT_R
97 # undef HAS_GETSERVBYNAME_R
98 # undef HAS_GETSERVBYPORT_R
99 # undef HAS_GETSERVENT_R
100 # undef HAS_SETHOSTENT_R
101 # undef HAS_SETNETENT_R
102 # undef HAS_SETPROTOENT_R
103 # undef HAS_SETSERVENT_R
116 # include <stdlib.h> /* drand48_data */
123 #ifdef HAS_GETSPNAM_R
131 my %seenh; # the different prototypes signatures for this function
132 my %seena; # the different prototypes signatures for this function in order
133 my @seenf; # all the seen functions
134 my %seenp; # the different prototype signatures for all functions
135 my %seent; # the return type of this function
136 my %seens; # the type of this function's "S"
137 my %seend; # the type of this function's "D"
138 my %seenm; # all the types
139 my %seenu; # the length of the argument list of this function
141 while (<DATA>) { # Read in the protypes.
144 my ($func, $hdr, $type, @p) = split(/\s*\|\s*/, $_, -1);
146 # Split off the real function name and the argument list.
147 ($func, $u) = split(' ', $func);
148 $seenu{$func} = defined $u ? length $u : 0;
149 my $FUNC = uc $func; # for output.
157 # Set any special mapping variables (like X=x_t)
159 while ($p[-1] =~ /=/) {
160 my ($k, $v) = ($p[-1] =~ /^([A-Za-z])\s*=\s*(.*)/);
166 # If given the -U option open up the metaconfig unit for this function.
167 if ($opts{U} && open(U, ">d_${func}_r.U")) {
172 # The metaconfig units needs prerequisite dependencies.
176 if ($hdr ne 'stdio') { # There's no i_stdio.
179 $prereqsh = "\$$prereqs $prereqh";
181 my @prereq = qw(Inlibc Protochk Hasproto i_systypes usethreads);
182 push @prereq, $prereqs;
183 my $hdrs = "\$i_systypes sys/types.h define stdio.h $prereqsh";
184 if ($hdr eq 'time') {
185 $hdrs .= " \$i_systime sys/time.h";
186 push @prereq, 'i_systime';
188 # Output the metaconfig unit header.
190 ?RCS: \$Id: d_${func}_r.U,v $
192 ?RCS: Copyright (c) 2002,2003 Jarkko Hietaniemi
194 ?RCS: You may distribute under the terms of either the GNU General Public
195 ?RCS: License or the Artistic License, as specified in the README file.
197 ?RCS: Generated by the reentr.pl from the Perl 5.8 distribution.
199 ?MAKE:d_${func}_r ${func}_r_proto: @prereq
200 ?MAKE: -pick add \$@ %<
202 ?S: This variable conditionally defines the HAS_${FUNC}_R symbol,
203 ?S: which indicates to the C program that the ${func}_r()
204 ?S: routine is available.
207 ?S: This variable encodes the prototype of ${func}_r.
208 ?S: It is zero if d_${func}_r is undef, and one of the
209 ?S: REENTRANT_PROTO_T_ABC macros of reentr.h if d_${func}_r
213 ?C: This symbol, if defined, indicates that the ${func}_r routine
214 ?C: is available to ${func} re-entrantly.
217 ?C: This symbol encodes the prototype of ${func}_r.
218 ?C: It is zero if d_${func}_r is undef, and one of the
219 ?C: REENTRANT_PROTO_T_ABC macros of reentr.h if d_${func}_r
222 ?H:#\$d_${func}_r HAS_${FUNC}_R /**/
223 ?H:#define ${FUNC}_R_PROTO \$${func}_r_proto /**/
225 ?T:try hdrs d_${func}_r_proto
226 ?LINT:set d_${func}_r
227 ?LINT:set ${func}_r_proto
228 : see if ${func}_r exists
229 set ${func}_r d_${func}_r
231 case "\$d_${func}_r" in
236 case "\$d_${func}_r_proto:\$usethreads" in
237 ":define") d_${func}_r_proto=define
238 set d_${func}_r_proto ${func}_r \$hdrs
242 case "\$d_${func}_r_proto" in
247 my ($r, $a) = ($p =~ /^(.)_(.+)/);
248 my $v = join(", ", map { $m{$_} } split '', $a);
251 case "\$${func}_r_proto" in
252 ''|0) try='$m{$r} ${func}_r($v);'
253 ./protochk "extern \$try" \$hdrs && ${func}_r_proto=$p ;;
257 $seenh{$func}->{$p}++;
258 push @{$seena{$func}}, $p;
260 $seent{$func} = $type;
261 $seens{$func} = $m{S};
262 $seend{$func} = $m{D};
267 case "\$${func}_r_proto" in
268 ''|0) d_${func}_r=undef
270 echo "Disabling ${func}_r, cannot determine prototype." >&4 ;;
271 * ) case "\$${func}_r_proto" in
273 *) ${func}_r_proto="REENTRANT_PROTO_\$${func}_r_proto" ;;
275 echo "Prototype: \$try" ;;
278 *) case "\$usethreads" in
279 define) echo "${func}_r has no prototype, not using it." >&4 ;;
297 # Prepare to continue writing the reentr.h.
302 # Write out all the known prototype signatures.
304 for my $p (sort keys %seenp) {
305 print "#define REENTRANT_PROTO_${p} ${i}\n";
310 my @struct; # REENTR struct members
311 my @size; # struct member buffer size initialization code
312 my @init; # struct member buffer initialization (malloc) code
313 my @free; # struct member buffer release (free) code
314 my @wrap; # the wrapper (foo(a) -> foo_r(a,...)) cpp code
315 my @define; # defines for optional features
319 join " || ", map { "${FUNC}_R_PROTO == REENTRANT_PROTO_$_" } @_;
332 New(31338, PL_reentrant_buffer->_${func}_buffer, PL_reentrant_buffer->_${func}_size, char);
335 Safefree(PL_reentrant_buffer->_${func}_buffer);
340 my ($n, $p, @F) = @_;
344 /* The @F using \L$n? */
350 my $HAS = "${FUNC}_R_HAS_$n";
352 my @h = grep { /$p/ } @{$seena{$func}};
353 unless (defined $GENFUNC) {
355 $GENFUNC =~ s/^GET//;
358 push @define, "#if defined(HAS_${FUNC}_R) && (" . join(" || ", map { "${FUNC}_R_PROTO == REENTRANT_PROTO_$_" } @h) . ")\n";
371 /* Any of the @F using \L$n? */
374 push @define, "#if (" . join(" || ", map { "defined($_)" } @H) . ")\n";
376 # define USE_${GENFUNC}_$n
378 # undef USE_${GENFUNC}_$n
384 define('BUFFER', 'B',
385 qw(getgrent getgrgid getgrnam));
388 qw(getgrent getgrgid getgrnam));
390 qw(getpwent getpwnam getpwuid));
392 qw(getspent getspnam));
395 qw(getgrent getgrgid getgrnam setgrent endgrent));
397 qw(getpwent getpwnam getpwuid setpwent endpwent));
399 define('BUFFER', 'B',
400 qw(getpwent getpwgid getpwnam));
403 qw(gethostent gethostbyaddr gethostbyname));
405 qw(getnetent getnetbyaddr getnetbyname));
407 qw(getprotoent getprotobyname getprotobynumber));
409 qw(getservent getservbyname getservbyport));
411 define('BUFFER', 'B',
412 qw(gethostent gethostbyaddr gethostbyname));
413 define('BUFFER', 'B',
414 qw(getnetent getnetbyaddr getnetbyname));
415 define('BUFFER', 'B',
416 qw(getprotoent getprotobyname getprotobynumber));
417 define('BUFFER', 'B',
418 qw(getservent getservbyname getservbyport));
421 qw(gethostent gethostbyaddr gethostbyname));
423 qw(getnetent getnetbyaddr getnetbyname));
425 # The following loop accumulates the "ssif" (struct, size, init, free)
426 # sections that declare the struct members (in reentr.h), and the buffer
427 # size initialization, buffer initialization (malloc), and buffer
428 # release (free) code (in reentr.c).
430 # The loop also contains a lot of intrinsic logic about groups of
431 # functions (since functions of certain kind operate the same way).
433 for my $func (@seenf) {
435 my $ifdef = "#ifdef HAS_${FUNC}_R\n";
436 my $endif = "#endif /* HAS_${FUNC}_R */\n";
437 if (exists $seena{$func}) {
438 my @p = @{$seena{$func}};
439 if ($func =~ /^(asctime|ctime|getlogin|setlocale|strerror|ttyname)$/) {
442 char* _${func}_buffer;
443 size_t _${func}_size;
446 PL_reentrant_buffer->_${func}_size = REENTRANTSMALLSIZE;
451 elsif ($func =~ /^(crypt)$/) {
454 #if CRYPT_R_PROTO == REENTRANT_PROTO_B_CCD
455 $seend{$func} _${func}_data;
457 $seent{$func} *_${func}_struct_buffer;
461 #if CRYPT_R_PROTO != REENTRANT_PROTO_B_CCD
462 PL_reentrant_buffer->_${func}_struct_buffer = 0;
466 #if CRYPT_R_PROTO != REENTRANT_PROTO_B_CCD
467 Safefree(PL_reentrant_buffer->_${func}_struct_buffer);
472 elsif ($func =~ /^(drand48|gmtime|localtime|random)$/) {
475 $seent{$func} _${func}_struct;
477 if ($1 eq 'drand48') {
479 double _${func}_double;
481 } elsif ($1 eq 'random') {
483 # if RANDOM_R_PROTO == REENTRANT_PROTO_iS
486 # if RANDOM_R_PROTO == REENTRANT_PROTO_lS
487 long _${func}_retval;
489 # if RANDOM_R_PROTO == REENTRANT_PROTO_tS
490 int32_t _${func}_retval;
496 elsif ($func =~ /^(getgrnam|getpwnam|getspnam)$/) {
498 # 'genfunc' can be read either as 'generic' or 'genre',
499 # it represents a group of functions.
501 $genfunc =~ s/nam/ent/g;
502 $genfunc =~ s/^get//;
503 my $GENFUNC = uc $genfunc;
505 $seent{$func} _${genfunc}_struct;
506 char* _${genfunc}_buffer;
507 size_t _${genfunc}_size;
510 # ifdef USE_${GENFUNC}_PTR
511 $seent{$func}* _${genfunc}_ptr;
515 # ifdef USE_${GENFUNC}_FPTR
516 FILE* _${genfunc}_fptr;
520 # ifdef USE_${GENFUNC}_FPTR
521 PL_reentrant_buffer->_${genfunc}_fptr = NULL;
524 my $sc = $genfunc eq 'grent' ?
525 '_SC_GETGR_R_SIZE_MAX' : '_SC_GETPW_R_SIZE_MAX';
526 my $sz = "_${genfunc}_size";
528 # if defined(HAS_SYSCONF) && defined($sc) && !defined(__GLIBC__)
529 PL_reentrant_buffer->$sz = sysconf($sc);
530 if (PL_reentrant_buffer->$sz == -1)
531 PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE;
533 # if defined(__osf__) && defined(__alpha) && defined(SIABUFSIZ)
534 PL_reentrant_buffer->$sz = SIABUFSIZ;
537 PL_reentrant_buffer->$sz = BUFSIZ;
539 PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE;
544 pushinitfree $genfunc;
547 elsif ($func =~ /^(gethostbyname|getnetbyname|getservbyname|getprotobyname)$/) {
550 $genfunc =~ s/byname/ent/;
551 $genfunc =~ s/^get//;
552 my $GENFUNC = uc $genfunc;
553 my $D = ifprotomatch($FUNC, grep {/D/} @p);
554 my $d = $seend{$func};
555 $d =~ s/\*$//; # snip: we need need the base type.
557 $seent{$func} _${genfunc}_struct;
561 char* _${genfunc}_buffer;
562 size_t _${genfunc}_size;
564 # ifdef USE_${GENFUNC}_PTR
565 $seent{$func}* _${genfunc}_ptr;
569 # ifdef USE_${GENFUNC}_ERRNO
570 int _${genfunc}_errno;
575 PL_reentrant_buffer->_${genfunc}_size = REENTRANTUSUALSIZE;
580 New(31338, PL_reentrant_buffer->_${genfunc}_buffer, PL_reentrant_buffer->_${genfunc}_size, char);
585 Safefree(PL_reentrant_buffer->_${genfunc}_buffer);
590 elsif ($func =~ /^(readdir|readdir64)$/) {
592 my $R = ifprotomatch($FUNC, grep {/R/} @p);
594 $seent{$func}* _${func}_struct;
595 size_t _${func}_size;
597 $seent{$func}* _${func}_ptr;
601 /* This is the size Solaris recommends.
602 * (though we go static, should use pathconf() instead) */
603 PL_reentrant_buffer->_${func}_size = sizeof($seent{$func}) + MAXPATHLEN + 1;
606 PL_reentrant_buffer->_${func}_struct = ($seent{$func}*)safemalloc(PL_reentrant_buffer->_${func}_size);
609 Safefree(PL_reentrant_buffer->_${func}_struct);
620 # Write out what we have learned.
623 my $v = join(", ", @v[0..$seenu{$func}-1]);
625 my ($r, $a) = split '_', $p;
626 my $test = $r eq 'I' ? ' == 0' : '';
629 if ($genfunc =~ /^(?:get|set|end)(pw|gr|host|net|proto|serv|sp)/) {
630 $genfunc = "${1}ent";
631 } elsif ($genfunc eq 'srand48') {
632 $genfunc = "drand48";
636 substr($b, 0, $seenu{$func}) = '';
637 if ($func =~ /^random$/) {
638 $true = "PL_reentrant_buffer->_random_retval";
639 } elsif ($b =~ /R/) {
640 $true = "PL_reentrant_buffer->_${genfunc}_ptr";
641 } elsif ($b =~ /T/ && $func eq 'drand48') {
642 $true = "PL_reentrant_buffer->_${genfunc}_double";
643 } elsif ($b =~ /S/) {
644 if ($func =~ /^readdir/) {
645 $true = "PL_reentrant_buffer->_${genfunc}_struct";
647 $true = "&PL_reentrant_buffer->_${genfunc}_struct";
649 } elsif ($b =~ /B/) {
650 $true = "PL_reentrant_buffer->_${genfunc}_buffer";
656 "&PL_reentrant_buffer->_${genfunc}_ptr" :
658 "&PL_reentrant_buffer->_${genfunc}_errno" :
660 "PL_reentrant_buffer->_${genfunc}_buffer" :
662 "PL_reentrant_buffer->_${genfunc}_size" :
664 "&PL_reentrant_buffer->_${genfunc}_fptr" :
666 "&PL_reentrant_buffer->_${genfunc}_data" :
668 ($func =~ /^readdir\d*$/ ?
669 "PL_reentrant_buffer->_${genfunc}_struct" :
671 "PL_reentrant_buffer->_${genfunc}_struct_buffer" :
672 "&PL_reentrant_buffer->_${genfunc}_struct") :
673 $_ eq 'T' && $func eq 'drand48' ?
674 "&PL_reentrant_buffer->_${genfunc}_double" :
675 $_ =~ /^[ilt]$/ && $func eq 'random' ?
676 "&PL_reentrant_buffer->_random_retval" :
679 $w = ", $w" if length $v;
681 my $call = "${func}_r($v$w)";
682 $call = "((PL_reentrant_retint = $call))" if $r eq 'I' && $func ne 'random';
684 # if !defined($func) && ${FUNC}_R_PROTO == REENTRANT_PROTO_$p
686 if ($r eq 'V' || $r eq 'B') {
688 # define $func($v) $call
691 if ($func =~ /^get/) {
692 my $rv = $v ? ", $v" : "";
695 # define $func($v) ($call$test ? $true : (((PL_reentrant_retint > 0 && PL_reentrant_retint == ERANGE) || (errno == ERANGE)) ? Perl_reentrant_retry("$func"$rv) : 0))
699 # define $func($v) ($call$test ? $true : ((errno == ERANGE) ? Perl_reentrant_retry("$func"$rv) : 0))
704 # define $func($v) ($call$test ? $true : 0)
713 push @wrap, $endif, "\n";
721 /* Defines for indicating which special features are supported. */
726 int dummy; /* cannot have empty structs */
733 #endif /* USE_REENTRANT_API */
741 # Prepare to write the reentr.c.
743 die "reentr.c: $!" unless open(C, ">reentr.c");
749 * Copyright (C) 2002, 2003, by Larry Wall and others
751 * You may distribute under the terms of either the GNU General Public
752 * License or the Artistic License, as specified in the README file.
754 * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
755 * This file is built by reentrl.pl from data in reentr.pl.
757 * "Saruman," I said, standing away from him, "only one hand at a time can
758 * wield the One, and you know that well, so do not trouble to say we!"
763 #define PERL_IN_REENTR_C
768 Perl_reentrant_size(pTHX) {
769 #ifdef USE_REENTRANT_API
770 #define REENTRANTSMALLSIZE 256 /* Make something up. */
771 #define REENTRANTUSUALSIZE 4096 /* Make something up. */
773 #endif /* USE_REENTRANT_API */
777 Perl_reentrant_init(pTHX) {
778 #ifdef USE_REENTRANT_API
779 New(31337, PL_reentrant_buffer, 1, REENTR);
780 Perl_reentrant_size(aTHX);
782 #endif /* USE_REENTRANT_API */
786 Perl_reentrant_free(pTHX) {
787 #ifdef USE_REENTRANT_API
789 Safefree(PL_reentrant_buffer);
790 #endif /* USE_REENTRANT_API */
794 Perl_reentrant_retry(const char *f, ...)
798 #ifdef USE_REENTRANT_API
799 # 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)
802 # if defined(USE_SERVENT_BUFFER)
805 # if defined(USE_HOSTENT_BUFFER)
808 # if defined(USE_HOSTENT_BUFFER) || defined(USE_NETENT_BUFFER) || defined(USE_PROTOENT_BUFFER) || defined(USE_SERVENT_BUFFER)
815 switch (PL_op->op_type) {
816 #ifdef USE_HOSTENT_BUFFER
821 #ifdef PERL_REENTRANT_MAXSIZE
822 if (PL_reentrant_buffer->_hostent_size <=
823 PERL_REENTRANT_MAXSIZE / 2)
826 PL_reentrant_buffer->_hostent_size *= 2;
827 Renew(PL_reentrant_buffer->_hostent_buffer,
828 PL_reentrant_buffer->_hostent_size, char);
829 switch (PL_op->op_type) {
831 p0 = va_arg(ap, void *);
832 asize = va_arg(ap, size_t);
833 anint = va_arg(ap, int);
834 retptr = gethostbyaddr(p0, asize, anint); break;
836 p0 = va_arg(ap, void *);
837 retptr = gethostbyname(p0); break;
839 retptr = gethostent(); break;
841 SETERRNO(ERANGE, LIB_INVARG);
848 #ifdef USE_GRENT_BUFFER
853 #ifdef PERL_REENTRANT_MAXSIZE
854 if (PL_reentrant_buffer->_grent_size <=
855 PERL_REENTRANT_MAXSIZE / 2)
859 PL_reentrant_buffer->_grent_size *= 2;
860 Renew(PL_reentrant_buffer->_grent_buffer,
861 PL_reentrant_buffer->_grent_size, char);
862 switch (PL_op->op_type) {
864 p0 = va_arg(ap, void *);
865 retptr = getgrnam(p0); break;
867 #if Gid_t_size < INTSIZE
868 gid = (Gid_t)va_arg(ap, int);
870 gid = va_arg(ap, Gid_t);
872 retptr = getgrgid(gid); break;
874 retptr = getgrent(); break;
876 SETERRNO(ERANGE, LIB_INVARG);
883 #ifdef USE_NETENT_BUFFER
888 #ifdef PERL_REENTRANT_MAXSIZE
889 if (PL_reentrant_buffer->_netent_size <=
890 PERL_REENTRANT_MAXSIZE / 2)
894 PL_reentrant_buffer->_netent_size *= 2;
895 Renew(PL_reentrant_buffer->_netent_buffer,
896 PL_reentrant_buffer->_netent_size, char);
897 switch (PL_op->op_type) {
899 net = va_arg(ap, Netdb_net_t);
900 anint = va_arg(ap, int);
901 retptr = getnetbyaddr(net, anint); break;
903 p0 = va_arg(ap, void *);
904 retptr = getnetbyname(p0); break;
906 retptr = getnetent(); break;
908 SETERRNO(ERANGE, LIB_INVARG);
915 #ifdef USE_PWENT_BUFFER
920 #ifdef PERL_REENTRANT_MAXSIZE
921 if (PL_reentrant_buffer->_pwent_size <=
922 PERL_REENTRANT_MAXSIZE / 2)
926 PL_reentrant_buffer->_pwent_size *= 2;
927 Renew(PL_reentrant_buffer->_pwent_buffer,
928 PL_reentrant_buffer->_pwent_size, char);
929 switch (PL_op->op_type) {
931 p0 = va_arg(ap, void *);
932 retptr = getpwnam(p0); break;
934 #if Uid_t_size < INTSIZE
935 uid = (Uid_t)va_arg(ap, int);
937 uid = va_arg(ap, Uid_t);
939 retptr = getpwuid(uid); break;
941 retptr = getpwent(); break;
943 SETERRNO(ERANGE, LIB_INVARG);
950 #ifdef USE_PROTOENT_BUFFER
955 #ifdef PERL_REENTRANT_MAXSIZE
956 if (PL_reentrant_buffer->_protoent_size <=
957 PERL_REENTRANT_MAXSIZE / 2)
960 PL_reentrant_buffer->_protoent_size *= 2;
961 Renew(PL_reentrant_buffer->_protoent_buffer,
962 PL_reentrant_buffer->_protoent_size, char);
963 switch (PL_op->op_type) {
965 p0 = va_arg(ap, void *);
966 retptr = getprotobyname(p0); break;
968 anint = va_arg(ap, int);
969 retptr = getprotobynumber(anint); break;
971 retptr = getprotoent(); break;
973 SETERRNO(ERANGE, LIB_INVARG);
980 #ifdef USE_SERVENT_BUFFER
985 #ifdef PERL_REENTRANT_MAXSIZE
986 if (PL_reentrant_buffer->_servent_size <=
987 PERL_REENTRANT_MAXSIZE / 2)
990 PL_reentrant_buffer->_servent_size *= 2;
991 Renew(PL_reentrant_buffer->_servent_buffer,
992 PL_reentrant_buffer->_servent_size, char);
993 switch (PL_op->op_type) {
995 p0 = va_arg(ap, void *);
996 p1 = va_arg(ap, void *);
997 retptr = getservbyname(p0, p1); break;
999 anint = va_arg(ap, int);
1000 p0 = va_arg(ap, void *);
1001 retptr = getservbyport(anint, p0); break;
1003 retptr = getservent(); break;
1005 SETERRNO(ERANGE, LIB_INVARG);
1013 /* Not known how to retry, so just fail. */
1025 asctime S |time |const struct tm|B_SB|B_SBI|I_SB|I_SBI
1026 crypt CC |crypt |struct crypt_data|B_CCS|B_CCD|D=CRYPTD*
1027 ctermid B |stdio | |B_B
1028 ctime S |time |const time_t |B_SB|B_SBI|I_SB|I_SBI
1029 drand48 |stdlib |struct drand48_data |I_ST|T=double*
1030 endgrent |grp | |I_H|V_H
1031 endhostent |netdb | |I_D|V_D|D=struct hostent_data*
1032 endnetent |netdb | |I_D|V_D|D=struct netent_data*
1033 endprotoent |netdb | |I_D|V_D|D=struct protoent_data*
1034 endpwent |pwd | |I_H|V_H
1035 endservent |netdb | |I_D|V_D|D=struct servent_data*
1036 getgrent |grp |struct group |I_SBWR|I_SBIR|S_SBW|S_SBI|I_SBI|I_SBIH
1037 getgrgid T |grp |struct group |I_TSBWR|I_TSBIR|I_TSBI|S_TSBI|T=gid_t
1038 getgrnam C |grp |struct group |I_CSBWR|I_CSBIR|S_CBI|I_CSBI|S_CSBI
1039 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
1040 gethostbyname C |netdb |struct hostent |I_CSBWRE|S_CSBIE|I_CSD|D=struct hostent_data*
1041 gethostent |netdb |struct hostent |I_SBWRE|I_SBIE|S_SBIE|S_SBI|I_SBI|I_SD|D=struct hostent_data*
1042 getlogin |unistd | |I_BW|I_BI|B_BW|B_BI
1043 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
1044 getnetbyname C |netdb |struct netent |I_CSBWRE|I_CSBI|S_CSBI|I_CSD|D=struct netent_data*
1045 getnetent |netdb |struct netent |I_SBWRE|I_SBIE|S_SBIE|S_SBI|I_SBI|I_SD|D=struct netent_data*
1046 getprotobyname C|netdb |struct protoent|I_CSBWR|S_CSBI|I_CSD|D=struct protoent_data*
1047 getprotobynumber I |netdb |struct protoent|I_ISBWR|S_ISBI|I_ISD|D=struct protoent_data*
1048 getprotoent |netdb |struct protoent|I_SBWR|I_SBI|S_SBI|I_SD|D=struct protoent_data*
1049 getpwent |pwd |struct passwd |I_SBWR|I_SBIR|S_SBW|S_SBI|I_SBI|I_SBIH
1050 getpwnam C |pwd |struct passwd |I_CSBWR|I_CSBIR|S_CSBI|I_CSBI
1051 getpwuid T |pwd |struct passwd |I_TSBWR|I_TSBIR|I_TSBI|S_TSBI|T=uid_t
1052 getservbyname CC|netdb |struct servent |I_CCSBWR|S_CCSBI|I_CCSD|D=struct servent_data*
1053 getservbyport IC|netdb |struct servent |I_ICSBWR|S_ICSBI|I_ICSD|D=struct servent_data*
1054 getservent |netdb |struct servent |I_SBWR|I_SBI|S_SBI|I_SD|D=struct servent_data*
1055 getspnam C |shadow |struct spwd |I_CSBWR|S_CSBI
1056 gmtime T |time |struct tm |S_TS|I_TS|T=const time_t*
1057 localtime T |time |struct tm |S_TS|I_TS|T=const time_t*
1058 random |stdlib |struct random_data|I_iS|I_lS|I_St|i=int*|l=long*|t=int32_t*
1059 readdir T |dirent |struct dirent |I_TSR|I_TS|T=DIR*
1060 readdir64 T |dirent |struct dirent64|I_TSR|I_TS|T=DIR*
1061 setgrent |grp | |I_H|V_H
1062 sethostent I |netdb | |I_ID|V_ID|D=struct hostent_data*
1063 setlocale IC |locale | |I_ICBI
1064 setnetent I |netdb | |I_ID|V_ID|D=struct netent_data*
1065 setprotoent I |netdb | |I_ID|V_ID|D=struct protoent_data*
1066 setpwent |pwd | |I_H|V_H
1067 setservent I |netdb | |I_ID|V_ID|D=struct servent_data*
1068 srand48 L |stdlib |struct drand48_data |I_LS
1069 srandom T |stdlib |struct random_data|I_TS|T=unsigned int
1070 strerror I |string | |I_IBW|I_IBI|B_IBW
1071 tmpnam B |stdio | |B_B
1072 ttyname I |unistd | |I_IBW|I_IBI|B_IBI