Try to fix largefileness so that it "works" without a quad IV.
authorJarkko Hietaniemi <jhi@iki.fi>
Sat, 13 Nov 1999 13:46:38 +0000 (13:46 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Sat, 13 Nov 1999 13:46:38 +0000 (13:46 +0000)
p4raw-id: //depot/cfgperl@4559

Configure
Porting/Glossary
Porting/config.sh
Porting/config_H
config_h.SH
perl.h
pp_sys.c
t/lib/syslfs.t
t/op/lfs.t

index 9cad345..0a0523e 100755 (executable)
--- 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 Fri Nov 12 01:02:11 EET 1999 [metaconfig 3.0 PL70]
+# Generated on Sat Nov 13 15:36:41 EET 1999 [metaconfig 3.0 PL70]
 # (with additional metaconfig patches by perlbug@perl.com)
 
 cat >/tmp/c1$$ <<EOF
@@ -829,7 +829,6 @@ sitelib=''
 sitelibexp=''
 siteprefix=''
 siteprefixexp=''
-sizesize=''
 sizetype=''
 so=''
 sharpbang=''
@@ -8582,7 +8581,7 @@ else
        val="$undef"
        echo "No, it doesn't."
        case "$lseeksize" in
-       8) echo "(This is okay because your off_t is 64 bits wide.)" ;;
+       8) echo "(This is okay because your off_t is 64 bits wide.)" >&4 ;;
        esac
 fi
 $rm -f try.* try
@@ -13003,37 +13002,6 @@ echo $sig_name | $awk \
 }'
 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
 
-echo " "
-case "$sizetype" in
-*_t) zzz="$sizetype"   ;;
-*)   zzz="filesize"    ;;
-esac
-echo "Checking the size of $zzz..." >&4 
-cat > try.c <<EOCP
-#include <sys/types.h>
-#include <stdio.h>
-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
-
-
 : see what type is used for signed size_t
 set ssize_t ssizetype int stdio.h sys/types.h
 eval $typedef
@@ -14708,7 +14676,6 @@ sitelib='$sitelib'
 sitelibexp='$sitelibexp'
 siteprefix='$siteprefix'
 siteprefixexp='$siteprefixexp'
-sizesize='$sizesize'
 sizetype='$sizetype'
 sleep='$sleep'
 smail='$smail'
index 3d29644..371a2a1 100644 (file)
@@ -828,7 +828,7 @@ d_inetaton (d_inetaton.U):
        indicates to the C program that the inet_aton() function is available
        to parse IP address "dotted-quad" strings.
 
-d_int64t (i_inttypes.U):
+d_int64t (d_int64t.U):
        This symbol will be defined if the C compiler supports int64_t.
 
 d_isascii (d_isascii.U):
@@ -2676,7 +2676,7 @@ ptrsize (ptrsize.U):
        This variable contains the value of the PTRSIZE symbol, which
        indicates to the C program how many bytes there are in a pointer.
 
-quadcase (quadtype.U):
+quadkind (quadtype.U):
        This variable, if defined, encodes the type of a quad:
        1 = int, 2 = long, 3 = long long, 4 = int64_t.
 
index b8ac069..b730743 100644 (file)
@@ -8,7 +8,7 @@
 
 # Package name      : perl5
 # Source directory  : .
-# Configuration time: Thu Nov 11 21:42:49 EET 1999
+# Configuration time: Sat Nov 13 15:28:21 EET 1999
 # Configured by     : jhi
 # Target system     : osf1 alpha.hut.fi v4.0 878 alpha 
 
@@ -56,7 +56,7 @@ ccflags='-pthread -std -DLANGUAGE_C'
 ccsymbols='LANGUAGE_C=1 SYSTYPE_BSD=1 _LONGLONG=1 __LANGUAGE_C__=1'
 cf_by='jhi'
 cf_email='yourname@yourhost.yourplace.com'
-cf_time='Thu Nov 11 21:42:49 EET 1999'
+cf_time='Sat Nov 13 15:28:21 EET 1999'
 charsize='1'
 chgrp=''
 chmod=''
@@ -591,7 +591,7 @@ privlib='/opt/perl/lib/5.00563'
 privlibexp='/opt/perl/lib/5.00563'
 prototype='define'
 ptrsize='8'
-quadcase='2'
+quadkind='2'
 quadtype='long'
 randbits='48'
 randfunc='drand48'
index d31265d..3130075 100644 (file)
@@ -17,7 +17,7 @@
 /*
  * Package name      : perl5
  * Source directory  : .
- * Configuration time: Thu Nov 11 21:42:49 EET 1999
+ * Configuration time: Sat Nov 13 15:28:21 EET 1999
  * Configured by     : jhi
  * Target system     : osf1 alpha.hut.fi v4.0 878 alpha 
  */
  *     This symbol holds the type used for 64-bit integers.
  *     It can be int, long, long long, int64_t etc...
  */
-/* QUADCASE:
- *     This symbol, if defined, encodes the type of a quad:
- *     1 = int, 2 = long, 3 = long long, 4 = int64_t.
- */
 /* Uquad_t:
  *     This symbol holds the type used for unsigned 64-bit integers.
  *     It can be unsigned int, unsigned long, unsigned long long,
 #define HAS_QUAD       /**/
 #define Quad_t long    /**/
 #define Uquad_t unsigned long  /**/
-#define QUADCASE 2     /**/
+#ifdef HAS_QUAD
+#   define QUADKIND 2  /**/
+#   define QUAD_IS_INT 1
+#   define QUAD_IS_LONG        2
+#   define QUAD_IS_LONG_LONG   3
+#   define QUAD_IS_INT64_T     4
+#endif
 
 /* HAS_ACCESSX:
  *     This symbol, if defined, indicates that the accessx routine is
  */
 /*#define HAS_HASMNTOPT                / **/
 
+/* HAS_INT64_T:
+ *     This symbol will defined if the C compiler supports int64_t.
+ *     Usually the <inttypes.h> needs to be included, but sometimes
+ *     <sys/types.h> is enough.
+ */
+/*#define     HAS_INT64_T               / **/
+
 /* HAS_LDBL_DIG:
  *     This symbol, if defined, indicates that this system's <float.h>
  *     or <limits.h> defines the symbol LDBL_DIG, which is the number
  *     This symbol, if defined, indicates to the C program that it should
  *     include <inttypes.h>.
  */
-/* HAS_INT64_T:
- *     This symbol will defined if the C compiler supports int64_t.
- *     Usually the <inttypes.h> needs to be included, but sometimes
- *     <sys/types.h> is enough.
- */
 /*#define   I_INTTYPES                / **/
-/*#define     HAS_INT64_T               / **/
 
 /* I_MNTENT:
  *     This symbol, if defined, indicates that <mntent.h> exists and
 /* LSEEKSIZE:
  *     This symbol holds the number of bytes used by the Off_t.
  */
+/* Off_t_size:
+ *     This symbol holds the number of bytes used by the Off_t.
+ */
 #define Off_t off_t            /* <offset> type */
 #define LSEEKSIZE 8            /* <offset> size */
+#define Off_t_size 8   /* <offset> size */
 
 /* Mode_t:
  *     This symbol holds the type used to declare file modes 
index 0d0d2cb..fb35932 100644 (file)
@@ -2834,8 +2834,12 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un-
 /* LSEEKSIZE:
  *     This symbol holds the number of bytes used by the Off_t.
  */
+/* Off_t_size:
+ *     This symbol holds the number of bytes used by the Off_t.
+ */
 #define Off_t $lseektype               /* <offset> type */
 #define LSEEKSIZE $lseeksize           /* <offset> size */
+#define Off_t_size $lseeksize  /* <offset> size */
 
 /* Mode_t:
  *     This symbol holds the type used to declare file modes 
@@ -2852,11 +2856,6 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un-
  */
 #define Pid_t $pidtype         /* PID type */
 
-/* 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/perl.h b/perl.h
index f00566f..8ef429c 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -1356,18 +1356,6 @@ typedef struct svtbl SVTBL;
 #   endif
 #endif
 
-/* I couldn't find any -Ddefine or -flags in IRIX 6.5 that would
- * have done the necessary symbol renaming using cpp. --jhi */
-#ifdef __sgi
-#define USE_FOPEN64
-#define USE_FSEEK64
-#define USE_FTELL64
-#define USE_FSETPOS64
-#define USE_FGETPOS64
-#define USE_TMPFILE64
-#define USE_FREOPEN64
-#endif
-
 #ifdef USE_64_BIT_RAWIO
 #   ifdef HAS_OFF64_T
 #       undef Off_t
index b82771b..2dc9ebf 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1592,10 +1592,10 @@ PP(pp_send)
     djSP; dMARK; dORIGMARK; dTARGET;
     GV *gv;
     IO *io;
-    int offset;
+    STRLEN offset;
     SV *bufsv;
     char *buffer;
-    int length;
+    STRLEN length;
     STRLEN blen;
     MAGIC *mg;
 
@@ -1737,7 +1737,11 @@ PP(pp_tell)
        RETURN;
     }
 
+#if LSEEKSIZE > IVSIZE
+    PUSHn( do_tell(gv) );
+#else
     PUSHi( do_tell(gv) );
+#endif
     RETURN;
 }
 
@@ -1751,7 +1755,11 @@ PP(pp_sysseek)
     djSP;
     GV *gv;
     int whence = POPi;
+#if LSEEKSIZE > IVSIZE
+    Off_t offset = (Off_t)SvNVx(POPs);
+#else
     Off_t offset = (Off_t)SvIVx(POPs);
+#endif
     MAGIC *mg;
 
     gv = PL_last_in_gv = (GV*)POPs;
@@ -1773,9 +1781,18 @@ PP(pp_sysseek)
        PUSHs(boolSV(do_seek(gv, offset, whence)));
     else {
        Off_t n = do_sysseek(gv, offset, whence);
-       PUSHs((n < 0) ? &PL_sv_undef
-             : sv_2mortal(n ? newSViv((IV)n)
-                          : newSVpvn(zero_but_true, ZBTLEN)));
+        if (n < 0)
+            PUSHs(&PL_sv_undef);
+        else {
+            SV* sv = n ?
+#if LSEEKSIZE > IVSIZE
+                newSVnv((NV)n)
+#else
+                newSViv((IV)n)
+#endif
+                : newSVpvn(zero_but_true, ZBTLEN);
+            PUSHs(sv_2mortal(sv));
+        }
     }
     RETURN;
 }
@@ -2478,7 +2495,7 @@ PP(pp_stat)
 #else
        PUSHs(sv_2mortal(newSVpvn("", 0)));
 #endif
-#if Size_t_size > IVSIZE
+#if Off_t_size > IVSIZE
        PUSHs(sv_2mortal(newSVnv(PL_statcache.st_size)));
 #else
        PUSHs(sv_2mortal(newSViv(PL_statcache.st_size)));
@@ -2708,7 +2725,7 @@ PP(pp_ftsize)
     djSP; dTARGET;
     if (result < 0)
        RETPUSHUNDEF;
-#if Size_t_size > IVSISE
+#if Off_t_size > IVSIZE
     PUSHn(PL_statcache.st_size);
 #else
     PUSHi(PL_statcache.st_size);
index ce91db6..942bb4d 100644 (file)
@@ -37,20 +37,22 @@ sub explain {
 EOM
 }
 
+print "# checking whether we have sparse files...\n";
+
 # Known have-nots.
 if ($^O eq 'win32' || $^O eq 'vms') {
-    print "1..0\n# no sparse files\n";
+    print "1..0\n# no sparse files (because this is $^O) \n";
     bye();
 }
 
 # Known haves that have problems running this test
 # (for example because they do not support sparse files, like UNICOS)
 if ($^O eq 'unicos') {
-    print "1..0\n# large files known to work but unable to test them here\n";
+    print "1..0\n# large files known to work but unable to test them here ($^O)\n";
     bye();
 }
 
-# Then try to deduce whether we have sparse files.
+# Then try heuristically to deduce whether we have sparse files.
 
 # We'll start off by creating a one megabyte file which has
 # only three "true" bytes.  If we have sparseness, we should
@@ -79,24 +81,31 @@ unless (@s == 13 &&
     bye();
 }
 
+print "# we seem to have sparse files...\n";
+
 # By now we better be sure that we do have sparse files:
 # if we are not, the following will hog 5 gigabytes of disk.  Ooops.
 
 $ENV{LC_ALL} = "C";
 
 sysopen(BIG, "big", O_WRONLY|O_CREAT|O_TRUNC) or
-       do { warn "sysopen failed: $!\n"; bye };
-sysseek(BIG, 5_000_000_000, SEEK_SET);
+       do { warn "sysopen 'big' failed: $!\n"; bye };
+my $sysseek = sysseek(BIG, 5_000_000_000, SEEK_SET);
+unless (defined $sysseek && $sysseek == 5_000_000_000) {
+    print "1..0\n# seeking past 2GB failed: $! (sysseek returned ",
+          defined $sysseek ? $sysseek : 'undef', ")\n";
+    explain();
+    bye();
+}
 
 # The syswrite will fail if there are are filesize limitations (process or fs).
-my $syswrite = syswrite(BIG, "big") == 3;
-my $close   = close BIG if $syswrite;
+my $syswrite = syswrite(BIG, "big");
+print "# syswrite failed: $! (syswrite returned ",
+      defined $syswrite ? $syswrite : 'undef', ")\n"
+    unless defined $syswrite && $syswrite == 3;
+my $close     = close BIG;
+print "# close failed: $!\n" unless $close;
 unless($syswrite && $close) {
-    unless ($syswrite) {
-        print "# syswrite failed: $!\n"
-    } else {
-        print "# close failed: $!\n"
-    }
     if ($! =~/too large/i) {
        print "1..0\n# writing past 2GB failed: process limits?\n";
     } elsif ($! =~ /quota/i) {
index 140846f..0d6d027 100644 (file)
@@ -36,20 +36,22 @@ sub explain {
 EOM
 }
 
+print "# checking whether we have sparse files...\n";
+
 # Known have-nots.
 if ($^O eq 'win32' || $^O eq 'vms') {
-    print "1..0\n# no sparse files\n";
+    print "1..0\n# no sparse files (because this is $^O) \n";
     bye();
 }
 
 # Known haves that have problems running this test
 # (for example because they do not support sparse files, like UNICOS)
 if ($^O eq 'unicos') {
-    print "1..0\n# large files known to work but unable to test them here\n";
+    print "1..0\n# large files known to work but unable to test them here ($^O)\n";
     bye();
 }
 
-# Then try to deduce whether we have sparse files.
+# Then try to heuristically deduce whether we have sparse files.
 
 # Let's not depend on Fcntl or any other extension.
 
@@ -82,6 +84,8 @@ unless (@s == 13 &&
     bye();
 }
 
+print "# we seem to have sparse files...\n";
+
 # By now we better be sure that we do have sparse files:
 # if we are not, the following will hog 5 gigabytes of disk.  Ooops.
 
@@ -89,18 +93,19 @@ $ENV{LC_ALL} = "C";
 
 open(BIG, ">big") or do { warn "open failed: $!\n"; bye };
 binmode BIG;
-seek(BIG, 5_000_000_000, $SEEK_SET);
+unless (seek(BIG, 5_000_000_000, $SEEK_SET)) {
+    print "1..0\n# seeking past 2GB failed: $!\n";
+    explain();
+    bye();
+}
 
 # Either the print or (more likely, thanks to buffering) the close will
 # fail if there are are filesize limitations (process or fs).
 my $print = print BIG "big";
-my $close = close BIG if $print;
+print "# print failed: $!\n" unless $print;
+my $close = close BIG;
+print "# close failed: $!\n" unless $close;
 unless ($print && $close) {
-    unless ($print) {
-        print "# print failed: $!\n"
-    } else {
-        print "# close failed: $!\n"
-    }
     if ($! =~/too large/i) {
        print "1..0\n# writing past 2GB failed: process limits?\n";
     } elsif ($! =~ /quota/i) {