From a13ea748a87ffd2f0f8caa997bddc292033a30e1 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Thu, 16 Mar 2000 01:50:13 +0000 Subject: [PATCH] Fix pp_send() sizes (pass a Size_t, not an Off_t, and return a SSize_t, not an Off_t); add a note about a slightly similar situation in pp_truncate(); introduce $sizesize for Configure; update EPOC, VOS, Win32, and VMS for the sizesize; minor updates on the EPOC config file; reword socklen_t message slightly; fix fpossize (though unused currently) p4raw-id: //depot/cfgperl@5760 --- Configure | 37 +++++++++++++++++++++++++++++++++++-- Porting/Glossary | 3 +++ Porting/config.sh | 5 +++-- Porting/config_H | 7 ++++++- config_h.SH | 5 +++++ epoc/config.sh | 40 ++++++++++++++++++++-------------------- pp_sys.c | 42 ++++++++++++++++++++++++++++++------------ vms/subconfigure.com | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- vos/config.def | 1 + vos/config.h | 5 +++++ win32/config.bc | 1 + win32/config.gc | 1 + win32/config.vc | 1 + win32/config_H.bc | 5 +++++ win32/config_H.gc | 5 +++++ win32/config_H.vc | 5 +++++ 16 files changed, 173 insertions(+), 39 deletions(-) diff --git a/Configure b/Configure index 9803dc7..f1a76eb 100755 --- a/Configure +++ b/Configure @@ -20,7 +20,7 @@ # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $ # -# Generated on Thu Mar 16 00:41:53 EET 2000 [metaconfig 3.0 PL70] +# Generated on Thu Mar 16 03:04:33 EET 2000 [metaconfig 3.0 PL70] # (with additional metaconfig patches by perlbug@perl.com) cat >/tmp/c1$$ <&4 +cat > try.c < +#include +int main() { + printf("%d\n", (int)sizeof($sizetype)); + exit(0); +} +EOCP +set try +if eval $compile_ok; then + yyy=`./try` + case "$yyy" in + '') sizesize=4 + echo "(I can't execute the test program--guessing $sizesize.)" >&4 + ;; + *) sizesize=$yyy + echo "Your $zzz size is $sizesize bytes." + ;; + esac +else + sizesize=4 + echo "(I can't compile the test program--guessing $sizesize.)" >&4 +fi + + : check for socklen_t echo " " echo "Checking to see if you have socklen_t..." >&4 @@ -13807,7 +13839,7 @@ else val="$undef" echo "You do not have socklen_t." case "$sizetype" in - size_t) echo "(You do have size_t, that might work.)" ;; + size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;; esac fi $rm -f try try.* @@ -15674,6 +15706,7 @@ sitelib_stem='$sitelib_stem' sitelibexp='$sitelibexp' siteprefix='$siteprefix' siteprefixexp='$siteprefixexp' +sizesize='$sizesize' sizetype='$sizetype' sleep='$sleep' smail='$smail' diff --git a/Porting/Glossary b/Porting/Glossary index e54cc9a..2c948b8 100644 --- a/Porting/Glossary +++ b/Porting/Glossary @@ -3097,6 +3097,9 @@ siteprefixexp (siteprefix.U): This variable holds the full absolute path of the directory below which the user will install add-on packages. Derived from siteprefix. +sizesize (sizesize.U): + This variable contains the size of a sizetype in bytes. + sizetype (sizetype.U): This variable defines sizetype to be something like size_t, unsigned long, or whatever type is used to declare length diff --git a/Porting/config.sh b/Porting/config.sh index 924c7ae..c886987 100644 --- a/Porting/config.sh +++ b/Porting/config.sh @@ -8,7 +8,7 @@ # Package name : perl5 # Source directory : . -# Configuration time: Thu Mar 16 01:18:36 EET 2000 +# Configuration time: Thu Mar 16 03:30:28 EET 2000 # Configured by : jhi # Target system : osf1 alpha.hut.fi v4.0 878 alpha @@ -59,7 +59,7 @@ ccflags='-pthread -std -DLANGUAGE_C' ccsymbols='__alpha=1 __LANGUAGE_C__=1 __osf__=1 __unix__=1 _LONGLONG=1 _SYSTYPE_BSD=1 SYSTYPE_BSD=1 unix=1' cf_by='jhi' cf_email='yourname@yourhost.yourplace.com' -cf_time='Thu Mar 16 01:18:36 EET 2000' +cf_time='Thu Mar 16 03:30:28 EET 2000' charsize='1' chgrp='' chmod='' @@ -682,6 +682,7 @@ sitelib_stem='/opt/perl/lib/site_perl' sitelibexp='/opt/perl/lib/site_perl/5.6.0' siteprefix='/opt/perl' siteprefixexp='/opt/perl' +sizesize='8' sizetype='size_t' sleep='' smail='' diff --git a/Porting/config_H b/Porting/config_H index 88884c9..70bf2c0 100644 --- a/Porting/config_H +++ b/Porting/config_H @@ -17,7 +17,7 @@ /* * Package name : perl5 * Source directory : . - * Configuration time: Thu Mar 16 01:18:36 EET 2000 + * Configuration time: Thu Mar 16 03:30:28 EET 2000 * Configured by : jhi * Target system : osf1 alpha.hut.fi v4.0 878 alpha */ @@ -2812,6 +2812,11 @@ #define SITELIB_EXP "/opt/perl/lib/site_perl/5.6.0" /**/ #define SITELIB_STEM "/opt/perl/lib/site_perl" /**/ +/* Size_t_size: + * This symbol holds the size of a Size_t in bytes. + */ +#define Size_t_size 8 /* */ + /* Size_t: * This symbol holds the type used to declare length parameters * for string functions. It is usually size_t, but may be diff --git a/config_h.SH b/config_h.SH index df6801b..91adef3 100644 --- a/config_h.SH +++ b/config_h.SH @@ -2826,6 +2826,11 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- #define SITELIB_EXP "$sitelibexp" /**/ #define SITELIB_STEM "$sitelib_stem" /**/ +/* Size_t_size: + * This symbol holds the size of a Size_t in bytes. + */ +#define Size_t_size $sizesize /* */ + /* Size_t: * This symbol holds the type used to declare length parameters * for string functions. It is usually size_t, but may be diff --git a/epoc/config.sh b/epoc/config.sh index a3051d4..8b9f982 100644 --- a/epoc/config.sh +++ b/epoc/config.sh @@ -1,16 +1,15 @@ #!/bin/sh # -# This file was produced by running the Configure script. It holds all the -# definitions figured out by Configure. Should you modify one of these values, -# do not forget to propagate your changes by running "Configure -der". You may -# instead choose to run each of the .SH files by yourself, or "Configure -S". +# This file is manually maintained. +# +# It is NOT produced by running the Configure script. # # Package name : perl5 # Source directory : . -# Configuration time: Sun Oct 3 02:17:38 EET DST 1999 -# Configured by : jhi -# Target system : osf1 alpha.hut.fi v4.0 878 alpha +# Configuration time: +# Configured by : Olaf Flebbe +# Target system : EPOC Author='' Date='$Date' @@ -34,8 +33,8 @@ apirevision='' apisubversion='' apiversion='' ar='arm-pe-ar' -archlib='/perl/lib/5.5.670/epoc' -archlibexp='/perl/lib/5.5.670/epoc' +archlib='/perl/lib/5.6.0/epoc' +archlibexp='/perl/lib/5.6.0/epoc' archname64='' archname='epoc' archobjs='epoc.o epocish.o epoc_stubs.o' @@ -582,8 +581,8 @@ pmake='' pr='' prefix='' prefixexp='' -privlib='/perl/lib/5.5.670' -privlibexp='/perl/lib/5.5.670' +privlib='/perl/lib/5.6.0' +privlibexp='/perl/lib/5.6.0' prototype='define' ptrsize='4' randbits='31' @@ -627,13 +626,14 @@ sig_name_init='"ZERO", 0' sig_num='0' sig_num_init='0, 0' signal_t='void' -sitearch='/perl/lib/site_perl/5.5.670/epoc' -sitearchexp='/perl/lib/site_perl/5.5.670/epoc' -sitelib='/perl/lib/site_perl/5.5.670/' +sitearch='/perl/lib/site_perl/5.6.0/epoc' +sitearchexp='/perl/lib/site_perl/5.6.0/epoc' +sitelib='/perl/lib/site_perl/5.6.0/' sitelib_stem='/perl/lib/site_perl' -sitelibexp='/perl/lib/site_perl/5.5.670/' +sitelibexp='/perl/lib/site_perl/5.6.0/' siteprefix='' siteprefixexp='' +sizesize='4' sizetype='size_t' sleep='' smail='' @@ -702,7 +702,7 @@ vendorlib_stem='' vendorlibexp='' vendorprefix='' vendorprefixexp='' -version='5.5.670' +version='5.6.0' vi='' voidflags='15' xlibpth='' @@ -724,11 +724,11 @@ config_arg9='' config_arg10='' config_arg11='' PERL_REVISION=5 -PERL_VERSION=5 -PERL_SUBVERSION=670 +PERL_VERSION=6 +PERL_SUBVERSION=0 PERL_API_REVISION=5 -PERL_API_VERSION=5 -PERL_API_SUBVERSION=670 +PERL_API_VERSION=6 +PERL_API_SUBVERSION=0 CONFIGDOTSH=true # Variables propagated from previous config.sh file. pp_sys_cflags='' diff --git a/pp_sys.c b/pp_sys.c index 976f5a1..b13e809 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -1591,7 +1591,8 @@ PP(pp_send) Off_t offset; SV *bufsv; char *buffer; - Off_t length; + Size_t length; + SSize_t retval; STRLEN blen; MAGIC *mg; @@ -1614,7 +1615,7 @@ PP(pp_send) goto say_undef; bufsv = *++MARK; buffer = SvPV(bufsv, blen); -#if Off_t_SIZE > IVSIZE +#if Size_t_size > IVSIZE length = SvNVx(*++MARK); #else length = SvIVx(*++MARK); @@ -1624,7 +1625,7 @@ PP(pp_send) SETERRNO(0,0); io = GvIO(gv); if (!io || !IoIFP(io)) { - length = -1; + retval = -1; if (ckWARN(WARN_CLOSED)) { if (PL_op->op_type == OP_SYSWRITE) report_closed_fh(gv, io, "syswrite", "filehandle"); @@ -1634,7 +1635,7 @@ PP(pp_send) } else if (PL_op->op_type == OP_SYSWRITE) { if (MARK < SP) { -#if Off_t_SIZE > IVSIZE +#if Off_t_size > IVSIZE offset = SvNVx(*++MARK); #else offset = SvIVx(*++MARK); @@ -1651,14 +1652,14 @@ PP(pp_send) length = blen - offset; #ifdef PERL_SOCK_SYSWRITE_IS_SEND if (IoTYPE(io) == 's') { - length = PerlSock_send(PerlIO_fileno(IoIFP(io)), + retval = PerlSock_send(PerlIO_fileno(IoIFP(io)), buffer+offset, length, 0); } else #endif { /* See the note at doio.c:do_print about filesize limits. --jhi */ - length = PerlLIO_write(PerlIO_fileno(IoIFP(io)), + retval = PerlLIO_write(PerlIO_fileno(IoIFP(io)), buffer+offset, length); } } @@ -1667,20 +1668,24 @@ PP(pp_send) char *sockbuf; STRLEN mlen; sockbuf = SvPVx(*++MARK, mlen); - length = PerlSock_sendto(PerlIO_fileno(IoIFP(io)), buffer, blen, length, - (struct sockaddr *)sockbuf, mlen); + retval = PerlSock_sendto(PerlIO_fileno(IoIFP(io)), buffer, blen, + length, (struct sockaddr *)sockbuf, mlen); } else - length = PerlSock_send(PerlIO_fileno(IoIFP(io)), buffer, blen, length); + retval = PerlSock_send(PerlIO_fileno(IoIFP(io)), buffer, blen, length); #else else DIE(aTHX_ PL_no_sock_func, "send"); #endif - if (length < 0) + if (retval < 0) goto say_undef; SP = ORIGMARK; - PUSHi(length); +#if Size_t_size > IVSIZE + PUSHn(retval); +#else + PUSHi(retval); +#endif RETURN; say_undef: @@ -1826,11 +1831,24 @@ PP(pp_sysseek) PP(pp_truncate) { djSP; - Off_t len = (Off_t)POPn; + /* There seems to be no consensus on the length type of truncate() + * and ftruncate(), both off_t and size_t have supporters. In + * general one would think that when using large files, off_t is + * at least as wide as size_t, so using an off_t should be okay. */ + /* XXX Configure probe for the length type of *truncate() needed XXX */ + Off_t len; int result = 1; GV *tmpgv; STRLEN n_a; +#if Size_t_size > IVSIZE + length = (Off_t)POPn; +#else + length = (Off_t)POPi; +#endif + /* Checking for length < 0 is problematic as the type might or + * might not be signed: if it is not, clever compilers will moan. */ + /* XXX Configure probe for the signedness of the length type of *truncate() needed? XXX */ SETERRNO(0,0); #if defined(HAS_TRUNCATE) || defined(HAS_CHSIZE) || defined(F_FREESP) if (PL_op->op_flags & OPf_SPECIAL) { diff --git a/vms/subconfigure.com b/vms/subconfigure.com index af900a0..2ae3242 100644 --- a/vms/subconfigure.com +++ b/vms/subconfigure.com @@ -12,12 +12,12 @@ $! or something like that) are straightforward. Adding a new item for the $! ultimately created config.sh requires adding two lines to this file. $! $! First, a line in the format: -$! $ foo = "bar" +$! $ perl_foo = "bar" $! after the line tagged ##ADD NEW CONSTANTS HERE##. Replace foo with the $! variable name as it appears in config.sh. $! $! Second, add a line in the format: -$! $ WC "foo='" + foo + "'" +$! $ WC "foo='" + perl_foo + "'" $! after the line tagged ##WRITE NEW CONSTANTS HERE##. Careful of the $! quoting, as it can be tricky. $! @@ -69,6 +69,7 @@ $ myname = myhostname $ IF myname .EQS. "" THEN myname = F$TRNLNM("SYS$NODE") $! $! ##ADD NEW CONSTANTS HERE## +$ perl_sizesize = "4" $ perl_shmattype = "" $ perl_mmaptype = "" $ perl_gidformat = "lu" @@ -3205,6 +3206,49 @@ $ $ perl_ptrsize=line $ WRITE_RESULT "ptrsize is ''perl_ptrsize'" $! +$! Check for size_t size +$! +$ OS +$ WS "#ifdef __DECC +$ WS "#include +$ WS "#endif +$ WS "#include +$ WS "int main() +$ WS "{" +$ WS "int foo; +$ WS "foo = sizeof(size_t); +$ WS "printf(""%d\n"", foo); +$ WS "exit(0); +$ WS "}" +$ CS +$ DEFINE SYS$ERROR _NLA0: +$ DEFINE SYS$OUTPUT _NLA0: +$ ON ERROR THEN CONTINUE +$ ON WARNING THEN CONTINUE +$ 'Checkcc' temp.c +$ If Needs_Opt +$ THEN +$ link temp.obj,temp.opt/opt +$ else +$ link temp.obj +$ endif +$ OPEN/WRITE TEMPOUT [-.uu]tempout.lis +$ DEASSIGN SYS$OUTPUT +$ DEASSIGN SYS$ERROR +$ DEFINE SYS$ERROR TEMPOUT +$ DEFINE SYS$OUTPUT TEMPOUT +$ mcr []temp +$ CLOSE TEMPOUT +$ DEASSIGN SYS$OUTPUT +$ DEASSIGN SYS$ERROR +$ OPEN/READ TEMPOUT [-.uu]tempout.lis +$ READ TEMPOUT line +$ CLOSE TEMPOUT +$ DELETE/NOLOG [-.uu]tempout.lis; +$ +$ perl_sizesize=line +$ WRITE_RESULT "sizesize is ''perl_sizesize'" +$! $! Check rand48 and its ilk $! $ OS @@ -4195,6 +4239,7 @@ $ WC "uvuformat='" + perl_uvuformat + "'" $ WC "uvoformat='" + perl_uvoformat + "'" $ WC "uvxformat='" + perl_uvxformat + "'" $ WC "d_vms_case_sensitive_symbols='" + d_vms_be_case_sensitive + "'" +$ WC "sizesize='" + perl_sizesize + "'" $! $! ##WRITE NEW CONSTANTS HERE## $! diff --git a/vos/config.def b/vos/config.def index 34f5770..10d44a2 100644 --- a/vos/config.def +++ b/vos/config.def @@ -414,6 +414,7 @@ $sitearchexp='' $sitelib='/system/ported/perl/lib/site/5.005' $sitelibexp='/system/ported/perl/lib/site/5.005' $sitelib_stem='/system/ported/perl/lib/site' +$sizesize='4' $sizetype='size_t' $socksizetype='int' $sPRIfldbl='"Lf"' diff --git a/vos/config.h b/vos/config.h index 78e5c69..55bb25f 100644 --- a/vos/config.h +++ b/vos/config.h @@ -2801,6 +2801,11 @@ #define SITELIB_EXP "/system/ported/perl/lib/site/5.005" /**/ #define SITELIB_STEM "/system/ported/perl/lib/site" /**/ +/* Size_t_size: + * This symbol holds the size of a Size_t in bytes. + */ +#define Size_t_size 4 /* */ + /* Size_t: * This symbol holds the type used to declare length parameters * for string functions. It is usually size_t, but may be diff --git a/win32/config.bc b/win32/config.bc index 32fb9d8..1b984bb 100644 --- a/win32/config.bc +++ b/win32/config.bc @@ -673,6 +673,7 @@ sitelib_stem='' sitelibexp='~INST_TOP~\site~INST_VER~\lib' siteprefix='~INST_TOP~\site~INST_VER~' siteprefixexp='~INST_TOP~\site~INST_VER~' +sizesize='4' sizetype='size_t' sleep='' smail='' diff --git a/win32/config.gc b/win32/config.gc index 950a3d7..762e792 100644 --- a/win32/config.gc +++ b/win32/config.gc @@ -673,6 +673,7 @@ sitelib_stem='' sitelibexp='~INST_TOP~\site~INST_VER~\lib' siteprefix='~INST_TOP~\site~INST_VER~' siteprefixexp='~INST_TOP~\site~INST_VER~' +sizesize='4' sizetype='size_t' sleep='' smail='' diff --git a/win32/config.vc b/win32/config.vc index 007834e..f3dff46 100644 --- a/win32/config.vc +++ b/win32/config.vc @@ -673,6 +673,7 @@ sitelib_stem='' sitelibexp='~INST_TOP~\site~INST_VER~\lib' siteprefix='~INST_TOP~\site~INST_VER~' siteprefixexp='~INST_TOP~\site~INST_VER~' +sizesize='4' sizetype='size_t' sleep='' smail='' diff --git a/win32/config_H.bc b/win32/config_H.bc index 9e89acc..41e3a3c 100644 --- a/win32/config_H.bc +++ b/win32/config_H.bc @@ -2814,6 +2814,11 @@ #define SITELIB_EXP (win32_get_sitelib("5.6.0")) /**/ #define SITELIB_STEM "" /**/ +/* Size_t_size: + * This symbol holds the size of a Size_t in bytes. + */ +#define Size_t_size $sizesize /* */ + /* Size_t: * This symbol holds the type used to declare length parameters * for string functions. It is usually size_t, but may be diff --git a/win32/config_H.gc b/win32/config_H.gc index 062e7ec..baf02fe 100644 --- a/win32/config_H.gc +++ b/win32/config_H.gc @@ -2814,6 +2814,11 @@ #define SITELIB_EXP (win32_get_sitelib("5.6.0")) /**/ #define SITELIB_STEM "" /**/ +/* Size_t_size: + * This symbol holds the size of a Size_t in bytes. + */ +#define Size_t_size $sizesize /* */ + /* Size_t: * This symbol holds the type used to declare length parameters * for string functions. It is usually size_t, but may be diff --git a/win32/config_H.vc b/win32/config_H.vc index 2f278d9..028914d 100644 --- a/win32/config_H.vc +++ b/win32/config_H.vc @@ -2814,6 +2814,11 @@ #define SITELIB_EXP (win32_get_sitelib("5.6.0")) /**/ #define SITELIB_STEM "" /**/ +/* Size_t_size: + * This symbol holds the size of a Size_t in bytes. + */ +#define Size_t_size $sizesize /* */ + /* Size_t: * This symbol holds the type used to declare length parameters * for string functions. It is usually size_t, but may be -- 1.8.3.1