if ($opts{U} && open(U, ">d_${f}_r.U")) {
select U;
}
- my $prereqh = $h eq 'stdio' ? '' : "i_$h"; # There's no i_stdio.
+ my $prereqs = '';
+ my $prereqh = '';
+ my $prereqsh = '';
+ if ($h ne 'stdio') { # There's no i_stdio.
+ $prereqs = "i_$h";
+ $prereqh = "$h.h";
+ $prereqsh = "\$$prereqs $prereqh";
+ }
print <<EOF if $opts{U};
?RCS: \$Id: d_${f}_r.U,v $
?RCS:
?RCS:
?RCS: Generated by the reentr.pl from the Perl 5.8 distribution.
?RCS:
-?MAKE:d_${f}_r ${f}_r_proto: Inlibc Protochk Hasproto i_systypes $prereqh usethreads
+?MAKE:d_${f}_r ${f}_r_proto: Inlibc Protochk Hasproto i_systypes i_systime $prereqs usethreads
?MAKE: -pick add \$@ %<
?S:d_${f}_r:
?S: This variable conditionally defines the HAS_${F}_R symbol,
eval \$inlibc
case "\$d_${f}_r" in
"\$define")
- hdrs="\$i_systypes sys/types.h define stdio.h \$i_${h} $h.h"
+ hdrs="\$i_systypes sys/types.h define stdio.h $prereqsh"
case "$h" in
time)
hdrs="\$hdrs \$i_systime sys/time.h"
size_t _${f}_size;
EOF
push @size, <<EOF;
- PL_reentrant_buffer->_${f}_size = 256; /* Make something up. */
+ PL_reentrant_buffer->_${f}_size = REENTRANTSMALLSIZE;
EOF
pushinitfree $f;
pushssif $endif;
EOF
my $sc = $g eq 'getgrent' ?
'_SC_GETGR_R_SIZE_MAX' : '_SC_GETPW_R_SIZE_MAX';
+ my $sz = $g eq 'getgrent' ?
+ '_getgrent_size' : '_getpwent_size';
push @size, <<EOF;
# if defined(HAS_SYSCONF) && defined($sc) && !defined(__GLIBC__)
PL_reentrant_buffer->_${g}_size = sysconf($sc);
+ if (PL_reentrant_buffer->$sz == -1)
+ PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE;
# else
# if defined(__osf__) && defined(__alpha) && defined(SIABUFSIZ)
PL_reentrant_buffer->_${g}_size = SIABUFSIZ;
# ifdef __sgi
PL_reentrant_buffer->_${g}_size = BUFSIZ;
# else
- PL_reentrant_buffer->_${g}_size = 256;
+ PL_reentrant_buffer->_${g}_size = REENTRANTUSUALSIZE;
# endif
# endif
# endif
my $G = uc $g;
my $D = ifprotomatch($F, grep {/D/} @p);
my $d = $seend{$f};
+ $d =~ s/\*$//; # snip: we need need the base type.
push @struct, <<EOF;
$seent{$f} _${g}_struct;
# if $D
EOF
push @size, <<EOF;
#if !($D)
- PL_reentrant_buffer->_${g}_size = 2048; /* Any better ideas? */
+ PL_reentrant_buffer->_${g}_size = REENTRANTUSUALSIZE;
#endif
EOF
push @init, <<EOF;
push @wrap, $ifdef;
-# Doesn't implement the buffer growth loop for glibc gethostby*().
push @wrap, <<EOF;
# undef $f
EOF
void
Perl_reentrant_size(pTHX) {
#ifdef USE_REENTRANT_API
+#define REENTRANTSMALLSIZE 256 /* Make something up. */
+#define REENTRANTUSUALSIZE 4096 /* Make something up. */
@size
#endif /* USE_REENTRANT_API */
}
dTHX;
void *retptr = NULL;
#ifdef USE_REENTRANT_API
- void *p0, *p1;
+# if defined(USE_GETHOSTENT_BUFFER) || defined(USE_GETGRENT_BUFFER) || defined(USE_GETNETENT_BUFFER) || defined(USE_GETPWENT_BUFFER) || defined(USE_GETPROTOENT_BUFFER) || defined(USE_GETSERVENT_BUFFER)
+ void *p0;
+# endif
+# if defined(USE_GETSERVENT_BUFFER)
+ void *p1;
+# endif
+# if defined(USE_GETHOSTENT_BUFFER)
size_t asize;
+# endif
+# if defined(USE_GETHOSTENT_BUFFER) || defined(USE_GETNETENT_BUFFER) || defined(USE_GETPROTOENT_BUFFER) || defined(USE_GETSERVENT_BUFFER)
int anint;
+# endif
va_list ap;
va_start(ap, f);
ctime S |time |const time_t |B_SB|B_SBI|I_SB|I_SBI
drand48 |stdlib |struct drand48_data |I_ST|T=double*
endgrent |grp | |I_H|V_H
-endhostent |netdb |struct hostent_data |I_S|V_S
-endnetent |netdb |struct netent_data |I_S|V_S
-endprotoent |netdb |struct protoent_data |I_S|V_S
+endhostent |netdb | |I_D|V_D|D=struct hostent_data*
+endnetent |netdb | |I_D|V_D|D=struct netent_data*
+endprotoent |netdb | |I_D|V_D|D=struct protoent_data*
endpwent |pwd | |I_H|V_H
-endservent |netdb |struct servent_data |I_S|V_S
+endservent |netdb | |I_D|V_D|D=struct servent_data*
getgrent |grp |struct group |I_SBWR|I_SBIR|S_SBW|S_SBI|I_SBI|I_SBIH
getgrgid T |grp |struct group |I_TSBWR|I_TSBIR|I_TSBI|S_TSBI|T=gid_t
getgrnam C |grp |struct group |I_CSBWR|I_CSBIR|S_CBI|I_CSBI|S_CSBI