From d9b3e12dc6d5d94bcf6692f9359e377c8a7dcdd6 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Fri, 13 Aug 1999 22:48:40 +0000 Subject: [PATCH] Jumbo Configure and large file support update. Remove a lot of unneeded 64-bitness cruft; re-introduce BYTEORDER; update 64-bitness hints; lfs should now work in Solaris; long doubles in AIX. p4raw-id: //depot/cfgperl@3982 --- Configure | 373 ++++++++++++++------------------------------------------ config_h.SH | 171 +------------------------- doio.c | 4 +- hints/aix.sh | 18 ++- hints/hpux.sh | 2 +- hints/irix_6.sh | 12 +- iperlsys.h | 1 + perl.h | 209 ++++++++++++++----------------- perlio.c | 16 +-- perlsdio.h | 6 + pp.h | 8 ++ pp_sys.c | 4 +- 12 files changed, 229 insertions(+), 595 deletions(-) diff --git a/Configure b/Configure index 2bec164..d3163dc 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 Fri Aug 13 18:08:55 EET DST 1999 [metaconfig 3.0 PL70] +# Generated on Sat Aug 14 00:51:07 EET DST 1999 [metaconfig 3.0 PL70] # (with additional metaconfig patches by perlbug@perl.com) cat >/tmp/c1$$ <&4 - $cat >try.c < -#include -off64_t foo() { off64_t x; x = 7; return x; }' -EOCP - if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then - val="$define" - echo " Yup, it does." >&4 - else - val="$undef" - echo " Nope, it doesn't." >&4 - fi - $rm -f try.* - set d_off64_t - eval $setvar - - : check for offset_t - echo " " - echo $n "Checking to see if your system supports offset_t...$c" >&4 - $cat >try.c < -#include -offset_t foo() { offset_t x; x = 7; return x; }' -EOCP - if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then - val="$define" - echo " Yup, it does." >&4 - else - val="$undef" - echo " Nope, it doesn't." >&4 - fi - $rm -f try.* - set d_offset_t - eval $setvar - - : check for ino64_t - echo " " - echo $n "Checking to see if your system supports ino64_t...$c" >&4 - val="$undef" - case "$i_sysstat" in - "$define" ) - $cat >try.c < -#include -ino64_t foo() { ino64_t x; x = 7; return x; }' -EOCP - if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then - val="$define" - fi - $rm -f try.* - ;; - esac - if $test "X$val" = X"$define"; then - echo " Yup, it does." >&4 - else - echo " Nope, it doesn't." >&4 - fi - set d_ino64_t - eval $setvar - - : check for struct flock64 - echo " " - echo "Checking to see if your system supports struct flock64..." >&4 - if $h_fcntl; then - set d_flock64_s flock64 l_len define fcntl.h - eval $hasfield - else - val="$undef" - set d_flock64_s - eval $setvar - fi - case "$d_flock64_s" in - "$define") echo "Yup, it does." >&4 - ;; - *) echo "Nope, it doesn't." >&4 - ;; - esac - - : check for struct dirent64 - echo " " - echo "Checking to see if your system supports struct dirent64..." >&4 - set d_dirent64_s dirent64 d_off $i_dirent dirent.h - eval $hasfield - case "$d_dirent64_s" in - "$define") echo "Yup, it does." >&4 - ;; - *) echo "Nope, it doesn't." >&4 - ;; - esac - -else - val="$undef" - for xxx in d_fstat64 d_ftruncate64 d_lockf64 d_lseek64 d_lstat64 d_open64 d_opendir64 d_readdir64 d_seekdir64 d_stat64 d_telldir64 d_truncate64 d_off64_t d_offset_t d_ino64_t d_flock64_s d_dirent64_s - do - set $xxx - eval $setvar - done -fi - : see if dlerror exists xxx_runnm="$runnm" runnm=false @@ -8658,6 +8448,72 @@ $rm -f fd_set* set fgetpos d_fgetpos eval $inlibc +: see if flock exists +set flock d_flock +eval $inlibc + +: see if fork exists +set fork d_fork +eval $inlibc + +: see if pathconf exists +set pathconf d_pathconf +eval $inlibc + +: see if fpathconf exists +set fpathconf d_fpathconf +eval $inlibc + + +: see if llseek exists +set llseek d_llseek +eval $inlibc + +: check for off64_t +echo " " +echo $n "Checking to see if your system supports off64_t...$c" >&4 +$cat >try.c < +#include +off64_t foo() { off64_t x; x = 7; return x; }' +EOCP +if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then + val="$define" + echo " Yup, it does." >&4 +else + val="$undef" + echo " Nope, it doesn't." >&4 +fi +$rm -f try.* +set d_off64_t +eval $setvar + +: check for fpos64_t +echo " " +echo $n "Checking to see if your system supports fpos64_t...$c" >&4 +$cat >try.c < +fpos64_t foo() { fpos64_t x; x = 7; return x; }' +EOCP +if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then + val="$define" + echo " Yup, it does." >&4 +else + val="$undef" + echo " Nope, it doesn't." >&4 +fi +$rm -f try.* +set d_fpos64_t +eval $setvar + +: see if fseeko exists +set fseeko d_fseeko +eval $inlibc + +: see if fsetpos exists +set fsetpos d_fsetpos +eval $inlibc + if $test X"$use64bits" = X"$define"; then : see if fgetpos64 exists @@ -8704,30 +8560,6 @@ else done fi -: see if flock exists -set flock d_flock -eval $inlibc - -: see if fork exists -set fork d_fork -eval $inlibc - -: see if pathconf exists -set pathconf d_pathconf -eval $inlibc - -: see if fpathconf exists -set fpathconf d_fpathconf -eval $inlibc - -: see if fseeko exists -set fseeko d_fseeko -eval $inlibc - -: see if fsetpos exists -set fsetpos d_fsetpos -eval $inlibc - : see if this is a sys/param system set sys/param.h i_sysparam eval $inhdr @@ -10358,6 +10190,10 @@ set d_sigsetjmp eval $setvar $rm -f try.c try +: see if sys/stat.h is available +set sys/stat.h i_sysstat +eval $inhdr + : see if stat knows about block sizes echo " " set d_statblks stat st_blocks $i_sysstat sys/stat.h @@ -10978,7 +10814,7 @@ You seem to be either cross-compiling or doing a multiarchitecture build, skipping the byteorder check. EOM - byteorder='' + byteorder='0xffff' ;; *) case "$byteorder" in @@ -10987,8 +10823,9 @@ EOM In the following, larger digits indicate more significance. A big-endian machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other -machines may have weird orders like 3412. A Cray will report 87654321. If -the test program works the default is probably right. +machines may have weird orders like 3412. A Cray will report 87654321, +an Alpha will report 12345678. If the test program works the default is +probably right. I'm now running the test program... EOM $cat >try.c <<'EOCP' @@ -13525,11 +13362,7 @@ d_crypt='$d_crypt' d_csh='$d_csh' d_cuserid='$d_cuserid' d_dbl_dig='$d_dbl_dig' -d_dbmclose64='$d_dbmclose64' -d_dbminit64='$d_dbminit64' -d_delete64='$d_delete64' d_difftime='$d_difftime' -d_dirent64_s='$d_dirent64_s' d_dirnamlen='$d_dirnamlen' d_dlerror='$d_dlerror' d_dlopen='$d_dlopen' @@ -13553,30 +13386,26 @@ d_fcntl='$d_fcntl' d_fd_macros='$d_fd_macros' d_fd_set='$d_fd_set' d_fds_bits='$d_fds_bits' -d_fetch64='$d_fetch64' d_fgetpos64='$d_fgetpos64' d_fgetpos='$d_fgetpos' -d_firstkey64='$d_firstkey64' d_flexfnam='$d_flexfnam' -d_flock64_s='$d_flock64_s' d_flock='$d_flock' d_fopen64='$d_fopen64' d_fork='$d_fork' d_fpathconf='$d_fpathconf' +d_fpos64_t='$d_fpos64_t' d_freopen64='$d_freopen64' d_fseek64='$d_fseek64' d_fseeko64='$d_fseeko64' d_fseeko='$d_fseeko' d_fsetpos64='$d_fsetpos64' d_fsetpos='$d_fsetpos' -d_fstat64='$d_fstat64' d_fstatfs='$d_fstatfs' d_fstatvfs='$d_fstatvfs' d_ftell64='$d_ftell64' d_ftello64='$d_ftello64' d_ftello='$d_ftello' d_ftime='$d_ftime' -d_ftruncate64='$d_ftruncate64' d_getgrent='$d_getgrent' d_getgrps='$d_getgrps' d_gethbyaddr='$d_gethbyaddr' @@ -13613,7 +13442,6 @@ d_hasmntopt='$d_hasmntopt' d_htonl='$d_htonl' d_index='$d_index' d_inetaton='$d_inetaton' -d_ino64_t='$d_ino64_t' d_int64t='$d_int64t' d_iovec_s='$d_iovec_s' d_isascii='$d_isascii' @@ -13622,12 +13450,9 @@ d_lchown='$d_lchown' d_link='$d_link' d_llseek='$d_llseek' d_locconv='$d_locconv' -d_lockf64='$d_lockf64' d_lockf='$d_lockf' d_longdbl='$d_longdbl' d_longlong='$d_longlong' -d_lseek64='$d_lseek64' -d_lstat64='$d_lstat64' d_lstat='$d_lstat' d_madvise='$d_madvise' d_mblen='$d_mblen' @@ -13657,16 +13482,12 @@ d_msgsnd='$d_msgsnd' d_msync='$d_msync' d_munmap='$d_munmap' d_mymalloc='$d_mymalloc' -d_nextkey64='$d_nextkey64' d_nice='$d_nice' d_off64_t='$d_off64_t' -d_offset_t='$d_offset_t' d_old_pthread_create_joinable='$d_old_pthread_create_joinable' d_oldpthreads='$d_oldpthreads' d_oldsock='$d_oldsock' d_open3='$d_open3' -d_open64='$d_open64' -d_opendir64='$d_opendir64' d_pathconf='$d_pathconf' d_pause='$d_pause' d_phostname='$d_phostname' @@ -13682,7 +13503,6 @@ d_pwexpire='$d_pwexpire' d_pwgecos='$d_pwgecos' d_pwpasswd='$d_pwpasswd' d_pwquota='$d_pwquota' -d_readdir64='$d_readdir64' d_readdir='$d_readdir' d_readlink='$d_readlink' d_readv='$d_readv' @@ -13695,7 +13515,6 @@ d_safemcpy='$d_safemcpy' d_sanemcmp='$d_sanemcmp' d_sched_yield='$d_sched_yield' d_scm_rights='$d_scm_rights' -d_seekdir64='$d_seekdir64' d_seekdir='$d_seekdir' d_select='$d_select' d_sem='$d_sem' @@ -13740,7 +13559,6 @@ d_sigaction='$d_sigaction' d_sigsetjmp='$d_sigsetjmp' d_socket='$d_socket' d_sockpair='$d_sockpair' -d_stat64='$d_stat64' d_statblks='$d_statblks' d_statfs='$d_statfs' d_statfsflags='$d_statfsflags' @@ -13750,7 +13568,6 @@ d_stdio_ptr_lval='$d_stdio_ptr_lval' d_stdio_stream_array='$d_stdio_stream_array' d_stdiobase='$d_stdiobase' d_stdstdio='$d_stdstdio' -d_store64='$d_store64' d_strchr='$d_strchr' d_strcoll='$d_strcoll' d_strctcpy='$d_strctcpy' @@ -13770,13 +13587,11 @@ d_syserrlst='$d_syserrlst' d_system='$d_system' d_tcgetpgrp='$d_tcgetpgrp' d_tcsetpgrp='$d_tcsetpgrp' -d_telldir64='$d_telldir64' d_telldir='$d_telldir' d_telldirproto='$d_telldirproto' d_time='$d_time' d_times='$d_times' d_tmpfile64='$d_tmpfile64' -d_truncate64='$d_truncate64' d_truncate='$d_truncate' d_tzname='$d_tzname' d_umask='$d_umask' diff --git a/config_h.SH b/config_h.SH index d69c8b6..cf449b9 100644 --- a/config_h.SH +++ b/config_h.SH @@ -1092,32 +1092,7 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- * so the default case (for NeXT) is big endian to catch them. * This might matter for NeXT 3.0. */ -#if defined(CROSSCOMPILE) || defined(MULTIARCH) -# ifdef __LITTLE_ENDIAN__ -# if LONGSIZE == 4 -# define BYTEORDER 0x1234 -# else -# if LONGSIZE == 8 -# define BYTEORDER 0x12345678 -# endif -# endif -# else -# ifdef __BIG_ENDIAN__ -# if LONGSIZE == 4 -# define BYTEORDER 0x4321 -# else -# if LONGSIZE == 8 -# define BYTEORDER 0x87654321 -# endif -# endif -# endif -# endif -# if !defined(BYTEORDER) && (defined(NeXT) || defined(__NeXT__)) -# define BYTEORDER 0x4321 -# endif -#else #define BYTEORDER 0x$byteorder /* large digits for MSB */ -#endif /* NeXT */ /* CASTI32: * This symbol is defined if the C compiler can cast negative @@ -2278,42 +2253,6 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #$d_writev HAS_WRITEV /**/ -/* HAS_DBMINIT64: - * This symbol, if defined, indicates that the dbminit64 routine is - * available to open dbm files larger than 2 gigabytes. - */ -/* HAS_DBMCLOSE64: - * This symbol, if defined, indicates that the dbmclose64 routine is - * available to close dbm files larger than 2 gigabytes. - */ -/* HAS_FETCH64: - * This symbol, if defined, indicates that the fetch64 routine is - * available to fetch from dbm files larger than 2 gigabytes. - */ -/* HAS_STORE64: - * This symbol, if defined, indicates that the store64 routine is - * available to store to dbm files larger than 2 gigabytes. - */ -/* HAS_DELETE64: - * This symbol, if defined, indicates that the delete64 routine is - * available to delete from dbm files larger than 2 gigabytes. - */ -/* HAS_FIRSTKEY64: - * This symbol, if defined, indicates that the firstkey64 routine is - * available to firstkey in dbm files larger than 2 gigabytes. - */ -/* HAS_NEXTKEY64: - * This symbol, if defined, indicates that the nextkey64 routine is - * available to nextkey in dbm files larger than 2 gigabytes. - */ -#$d_dbminit64 HAS_DBMINIT64 /**/ -#$d_dbmclose64 HAS_DBMCLOSE64 /**/ -#$d_fetch64 HAS_FETCH64 /**/ -#$d_store64 HAS_STORE64 /**/ -#$d_delete64 HAS_DELETE64 /**/ -#$d_firstkey64 HAS_FIRSTKEY64 /**/ -#$d_nextkey64 HAS_NEXTKEY64 /**/ - /* USE_DYNAMIC_LOADING: * This symbol, if defined, indicates that dynamic loading of * some sort is available. @@ -2407,74 +2346,14 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #$i_sysstatvfs I_SYS_STATVFS /**/ -/* HAS_FSTAT64: - * This symbol, if defined, indicates that the fstat64 routine is - * available to stat files (fds) larger than 2 gigabytes. - */ -/* HAS_FTRUNCATE64: - * This symbol, if defined, indicates that the ftruncate64 routine is - * available to tell files larger than 2 gigabytes. - */ -/* HAS_LLSEEK: - * This symbol, if defined, indicates that the llseek routine is - * available to seek files larger than 2 gigabytes. - */ -/* HAS_LSEEK64: - * This symbol, if defined, indicates that the lseek64 routine is - * available to seek files larger than 2 gigabytes. - */ -/* HAS_LSTAT64: - * This symbol, if defined, indicates that the lstat64 routine is - * available to stat files (symlinks) larger than 2 gigabytes. - */ -/* HAS_OPEN64: - * This symbol, if defined, indicates that the open64 routine is - * available to open files larger than 2 gigabytes. - */ -/* HAS_OPENDIR64: - * This symbol, if defined, indicates that the opendir64 routine is - * available to opendir files larger than 2 gigabytes. - */ -/* HAS_READDIR64: - * This symbol, if defined, indicates that the readdir64 routine is - * available to readdir files larger than 2 gigabytes. - */ -/* HAS_SEEKDIR64: - * This symbol, if defined, indicates that the seekdir64 routine is - * available to seekdir files larger than 2 gigabytes. - */ -/* HAS_STAT64: - * This symbol, if defined, indicates that the stat64 routine is - * available to stat files larger than 2 gigabytes. - */ -/* HAS_TELLDIR64: - * This symbol, if defined, indicates that the telldir64 routine is - * available to telldir files larger than 2 gigabytes. - */ -/* HAS_TRUNCATE64: - * This symbol, if defined, indicates that the truncate64 routine is - * available to truncate files larger than 2 gigabytes. - */ /* HAS_OFF64_T: * This symbol will be defined if the C compiler supports off64_t. */ -/* HAS_STRUCT_DIRENT64: - * This symbol will be defined if the C compiler supports struct dirent64. - */ -#$d_fstat64 HAS_FSTAT64 /**/ -#$d_ftruncate64 HAS_FTRUNCATE64 /**/ -#$d_llseek HAS_LLSEEK /**/ -#$d_lseek64 HAS_LSEEK64 /**/ -#$d_lstat64 HAS_LSTAT64 /**/ -#$d_open64 HAS_OPEN64 /**/ -#$d_opendir64 HAS_OPENDIR64 /**/ -#$d_readdir64 HAS_READDIR64 /**/ -#$d_seekdir64 HAS_SEEKDIR64 /**/ -#$d_stat64 HAS_STAT64 /**/ -#$d_telldir64 HAS_TELLDIR64 /**/ -#$d_truncate64 HAS_TRUNCATE64 /**/ -#$d_off64_t HAS_OFF64_T /**/ -#$d_dirent64_s HAS_STRUCT_DIRENT64 /**/ +/* HAS_FPOS64_T: + * This symbol will be defined if the C compiler supports fpos64_t. + */ +#$d_off64_t HAS_OFF64_T /**/ +#$d_fpos64_t HAS_FPOS64_T /**/ /* PERL_PRIfldbl: * This symbol, if defined, contains the string used by stdio to @@ -2524,51 +2403,11 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #define STARTPERL "$startperl" /**/ -/* HAS_FGETPOS64: - * This symbol, if defined, indicates that the fgetpos64 routine is - * available to getpos files larger than 2 gigabytes. - */ -/* HAS_FOPEN64: - * This symbol, if defined, indicates that the fopen64 routine is - * available to open files larger than 2 gigabytes. - */ -/* HAS_FREOPEN64: - * This symbol, if defined, indicates that the freopen64 routine is - * available to reopen files larger than 2 gigabytes. - */ -/* HAS_FSEEK64: - * This symbol, if defined, indicates that the fseek64 routine is - * available to seek files larger than 2 gigabytes. - */ -/* HAS_FSEEKO64: - * This symbol, if defined, indicates that the fseeko64 routine is - * available to seek files larger than 2 gigabytes. - */ /* HAS_FSETPOS64: * This symbol, if defined, indicates that the fsetpos64 routine is * available to setpos files larger than 2 gigabytes. */ -/* HAS_FTELL64: - * This symbol, if defined, indicates that the ftell64 routine is - * available to tell files larger than 2 gigabytes. - */ -/* HAS_FTELLO64: - * This symbol, if defined, indicates that the ftello64 routine is - * available to tell files larger than 2 gigabytes. - */ -/* HAS_TMPFILE64: - * This symbol, if defined, indicates that the tmpfile64 routine is - * available to tmpfile files larger than 2 gigabytes. - */ -#$d_fgetpos64 HAS_FGETPOS64 /**/ -#$d_fopen64 HAS_FOPEN64 /**/ -#$d_freopen64 HAS_FREOPEN64 /**/ -#$d_fseek64 HAS_FSEEK64 /**/ -#$d_fseeko64 HAS_FSEEKO64 /**/ #$d_fsetpos64 HAS_FSETPOS64 /**/ -#$d_ftell64 HAS_FTELL64 /**/ -#$d_ftello64 HAS_FTELLO64 /**/ -#$d_tmpfile64 HAS_TMPFILE64 /**/ /* HAS_STDIO_STREAM_ARRAY: * This symbol, if defined, tells that there is an array diff --git a/doio.c b/doio.c index a953d54..73f9429 100644 --- a/doio.c +++ b/doio.c @@ -141,7 +141,7 @@ Perl_do_open9(pTHX_ GV *gv, register char *name, I32 len, int as_raw, } if (as_raw) { -#if defined(O_LARGEFILE) +#if defined(USE_64_BIT_OFFSETS) && defined(O_LARGEFILE) rawmode |= O_LARGEFILE; #endif @@ -876,7 +876,7 @@ Perl_do_sysseek(pTHX_ GV *gv, Off_t pos, int whence) Perl_warner(aTHX_ WARN_UNOPENED, "sysseek() on unopened file"); } SETERRNO(EBADF,RMS$_IFI); - return -1L; + return (Off_t)-1; } int diff --git a/hints/aix.sh b/hints/aix.sh index 0f9553a..0bf75ad 100644 --- a/hints/aix.sh +++ b/hints/aix.sh @@ -183,14 +183,10 @@ EOM exit 1 ;; esac - ccflags="$ccflags `getconf XBS5_LPBIG_OFFBIG_CFLAGS 2>/dev/null`" ccflags="$ccflags -DUSE_LONG_LONG" - case "$cc" in - *c89) ccflags="$ccflags -qlonglong" ;; - # Plus AIX also requires LL prefixes for all long long constants. - esac + ccflags="$ccflags `getconf XBS5_ILP32_OFFBIG_CFLAGS 2>/dev/null`" - ldflags="$ldflags `getconf XBS5_LPBIG_OFFBIG_LDFLAGS 2>/dev/null`" + ldflags="$ldflags `getconf XBS5_ILP32_OFFBIG_LDFLAGS 2>/dev/null`" # _Somehow_ in AIX 4.3.1.0 the above getconf call manages to # insert(?) *something* to $ldflags so that later (in Configure) evaluating # $ldflags causes a newline after the '-b64' (the result of the getconf). @@ -208,4 +204,14 @@ EOM esac EOCBU +# This script UU/uselongdouble.cbu will get 'called-back' by Configure +# after it has prompted the user for whether to use 64 bits. +cat > UU/uselongdouble.cbu <<'EOCBU' +case "$uselongdouble" in +$define|true|[yY]*) + ccflags="$ccflags -qlongdouble" + ;; +esac +EOCBU + # EOF diff --git a/hints/hpux.sh b/hints/hpux.sh index 8240b3e..13b09cf 100644 --- a/hints/hpux.sh +++ b/hints/hpux.sh @@ -275,7 +275,7 @@ Cannot continue, aborting. EOM exit 1 fi - ccflags="$ccflags +DD64 -D_FILE_OFFSET_BITS=64" + ccflags="$ccflags +DD64 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" ldflags="$ldflags +DD64" ld=/usr/bin/ld set `echo " $libswanted " | sed -e 's@ dl @ @'` diff --git a/hints/irix_6.sh b/hints/irix_6.sh index 15f1cbd..cab48b4 100644 --- a/hints/irix_6.sh +++ b/hints/irix_6.sh @@ -243,19 +243,9 @@ EOM *-n32*) ccflags="$ccflags -DUSE_LONG_LONG" archname64="-n32" - d_open64="$undef" - # In -n32 mode (ILP32LL64) we use the standard open(). - # In -64 we will use the open64(). - cat << 'EOM' >&2 - -You may see a *** WHOA THERE!!! *** message from Configure for -d_open64. Keep the recommended value. See hints/irix6.sh -for more information. - -EOM ;; esac - ccflags="$ccflags -DUSE_64_BIT_FILES" + ccflags="$ccflags -DUSE_64_BITS" ;; esac EOCBU diff --git a/iperlsys.h b/iperlsys.h index f6e19ac..3ecea42 100644 --- a/iperlsys.h +++ b/iperlsys.h @@ -283,6 +283,7 @@ struct IPerlStdIOInfo #else /* PERL_IMPLICIT_SYS */ #include "perlsdio.h" +#include "perl.h" #endif /* PERL_IMPLICIT_SYS */ diff --git a/perl.h b/perl.h index 6f07c7c..5a1c84a 100644 --- a/perl.h +++ b/perl.h @@ -1342,129 +1342,98 @@ typedef union any ANY; #include "handy.h" -/* Some day when we have more 64-bit experience under our belts we may - * be able to merge some of the USE_64_BIT_{FILES,OFFSETS,STDIO,DBM}. At - * the moment (Oct 1998), though, keep them separate. --jhi - */ #ifdef USE_64_BITS -# ifdef USE_64_BIT_FILES -# ifndef USE_64_BIT_OFFSETS -# define USE_64_BIT_OFFSETS -# endif -# ifndef USE_64_BIT_STDIO -# define USE_64_BIT_STDIO -# endif -# ifndef USE_64_BIT_DBM -# define USE_64_BIT_DBM -# endif +# define USE_64_BIT_FILES +#endif + +#if defined(USE_64_BIT_FILES) || defined(USE_LARGE_FILES) +# define USE_64_BIT_OFFSETS +# define USE_64_BIT_STDIO +#endif + +#ifdef __sgi /* UGLY. See below. */ +#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_OFFSETS +# ifdef HAS_OFF64_T +# undef Off_t +# define Off_t off64_t +# undef LSEEKSIZE +# define LSEEKSIZE 8 # endif -/* Mention LSEEKSIZE here to get it included in %Config. */ -# ifdef USE_64_BIT_OFFSETS -# ifdef HAS_FSTAT64 -# define fstat fstat64 -# endif -# ifdef HAS_FTRUNCATE64 -# define ftruncate ftruncate64 -# endif -# ifdef HAS_LSEEK64 -# define lseek lseek64 -# ifdef HAS_OFF64_T -# undef Off_t -# define Off_t off64_t -# endif -# else -# ifdef HAS_LLSEEK -# define lseek llseek -# endif -# endif -# ifdef HAS_LSTAT64 -# define lstat lstat64 -# endif - /* Some systems have open64() in libc but use that only - * for true LP64 mode, in mixed mode (ILP32LL64, for example) - * they use the vanilla open(). Such systems should undefine - * d_open64 in their hints files. --jhi */ -# if defined(HAS_OPEN64) -# define open open64 -# endif -# ifdef HAS_OPENDIR64 -# define opendir opendir64 -# endif -# ifdef HAS_READDIR64 -# define readdir readdir64 -# ifdef HAS_STRUCT_DIRENT64 -# define dirent dirent64 -# endif -# endif -# ifdef HAS_SEEKDIR64 -# define seekdir seekdir64 -# endif -# ifdef HAS_STAT64 -# define stat stat64 /* Affects also struct stat, hopefully okay. */ -# endif -# ifdef HAS_TELLDIR64 -# define telldir telldir64 -# endif -# ifdef HAS_TRUNCATE64 -# define truncate truncate64 -# endif - /* flock is not #defined here to be flock64 because it seems - that a system may have struct flock64 but still use flock() - and not flock64(). The actual flocking code in pp_sys.c - must be changed. Also lockf and lockf64 must be dealt - with in pp_sys.c. --jhi */ -# endif -# ifdef USE_64_BIT_STDIO -# ifdef HAS_FGETPOS64 -# define fgetpos fgetpos64 -# endif -# ifdef HAS_FOPEN64 -# define fopen fopen64 -# endif -# ifdef HAS_FREOPEN64 -# define freopen freopen64 -# endif -# ifdef HAS_FSEEK64 -# define fseek fseek64 -# endif -# ifdef HAS_FSEEKO64 -# define fseeko fseeko64 -# endif -# ifdef HAS_FSETPOS64 -# define fsetpos fsetpos64 -# endif -# ifdef HAS_FTELL64 -# define ftell ftell64 -# endif -# ifdef HAS_FTELLO64 -# define ftello ftello64 -# endif -# ifdef HAS_TMPFILE64 -# define tmpfile tmpfile64 -# endif +/* Most 64-bit environments have defines like _LARGEFILE_SOURCE that + * will trigger defines like the ones below. Some 64-bit environments, + * however, do not. */ +# if defined(USE_OPEN64) +# define open open64 # endif -# ifdef USE_64_BIT_DBM -# ifdef HAS_DBMINIT64 -# define dbminit dbminit64 -# endif -# ifdef HAS_DBMCLOSE64 -# define dbmclose dbmclose64 -# endif -# ifdef HAS_FETCH64 -# define fetch fetch64 -# endif -# ifdef HAS_DELETE64 -# define delete delete64 -# endif -# ifdef HAS_STORE64 -# define store store64 -# endif -# ifdef HAS_FIRSTKEY64 -# define firstkey firstkey64 -# endif -# ifdef HAS_NEXTKEY64 -# define nextkey nextkey64 -# endif +# if defined(USE_LSEEK64) +# define lseek lseek64 +# endif +# if defined(USE_LLSEEK) +# define lseek llseek +# endif +# if defined(USE_STAT64) +# define stat stat64 +# endif +# if defined(USE_FSTAT64) +# define fstat fstat64 +# endif +# if defined(USE_LSTAT64) +# define lstat lstat64 +# endif +# if defined(USE_FLOCK64) +# define flock flock64 +# endif +# if defined(USE_LOCKF64) +# define lockf lockf64 +# endif +# if defined(USE_FCNTL64) +# define fcntl fcntl64 +# endif +# if defined(USE_TRUNCATE64) +# define truncate truncate64 +# endif +# if defined(USE_FTRUNCATE64) +# define ftruncate ftruncate64 +# endif +#endif + +#ifdef USE_64_BIT_STDIO +# ifdef HAS_FPOS64_T +# undef Fpos_t +# define Fpos_t fpos64_t +# endif +/* Most 64-bit environments have defines like _LARGEFILE_SOURCE that + * will trigger defines like the ones below. Some 64-bit environments, + * however, do not. */ +# if defined(USE_FOPEN64) +# define fopen fopen64 +# endif +# if defined(USE_FSEEK64) +# define fseek fseek64 +# endif +# if defined(USE_FTELL64) +# define ftell ftell64 +# endif +# if defined(USE_FSETPOS64) +# define fsetpos fsetpos64 +# endif +# if defined(USE_FGETPOS64) +# define fgetpos fgetpos64 +# endif +# if defined(USE_TMPFILE64) +# define tmpfile tmpfile64 +# endif +# if defined(USE_FREOPEN64) +# define freopen freopen64 # endif #endif diff --git a/perlio.c b/perlio.c index 565498e..5f9ed6b 100644 --- a/perlio.c +++ b/perlio.c @@ -385,22 +385,14 @@ PerlIO_vprintf(PerlIO *f, const char *fmt, va_list ap) Off_t PerlIO_tell(PerlIO *f) { -#ifdef HAS_FTELLO - return ftello(f); -#else return ftell(f); -#endif } #undef PerlIO_seek int PerlIO_seek(PerlIO *f, Off_t offset, int whence) { -#ifdef HAS_FSEEKO - return fseeko(f,offset,whence); -#else return fseek(f,offset,whence); -#endif } #undef PerlIO_rewind @@ -494,7 +486,11 @@ PerlIO_setpos(PerlIO *f, const Fpos_t *pos) int PerlIO_setpos(PerlIO *f, const Fpos_t *pos) { +#if defined(USE_64_BIT_STDIO) && defined(HAS_FSETPOS64) + return fsetpos64(f, pos); +#else return fsetpos(f, pos); +#endif } #endif #endif @@ -513,7 +509,11 @@ PerlIO_getpos(PerlIO *f, Fpos_t *pos) int PerlIO_getpos(PerlIO *f, Fpos_t *pos) { +#if defined(USE_64_BIT_STDIO) && defined(HAS_FSETPOS64) + return fgetpos64(f, pos); +#else return fgetpos(f, pos); +#endif } #endif #endif diff --git a/perlsdio.h b/perlsdio.h index 46a15de..71a9e75 100644 --- a/perlsdio.h +++ b/perlsdio.h @@ -55,12 +55,18 @@ #define PerlIO_clearerr(f) clearerr(f) #define PerlIO_flush(f) Fflush(f) #define PerlIO_tell(f) ftell(f) +#if defined(USE_64_BIT_STDIO) && defined(HAS_FTELLO) && !defined(USE_FTELL64) +#define ftell ftello +#endif #if defined(VMS) && !defined(__DECC) /* Old VAXC RTL doesn't reset EOF on seek; Perl folk seem to expect this */ # define PerlIO_seek(f,o,w) (((f) && (*f) && ((*f)->_flag &= ~_IOEOF)),fseek(f,o,w)) #else # define PerlIO_seek(f,o,w) fseek(f,o,w) #endif +#if defined(USE_64_BIT_STDIO) && defined(HAS_FSEEKO) && !defined(USE_FSEEK64) +#define fseek fseeko +#endif #ifdef HAS_FGETPOS #define PerlIO_getpos(f,p) fgetpos(f,p) #endif diff --git a/pp.h b/pp.h index 0eac5a5..0e6383c 100644 --- a/pp.h +++ b/pp.h @@ -64,6 +64,10 @@ #define POPi ((IV)SvIVx(POPs)) #define POPu ((UV)SvUVx(POPs)) #define POPl ((long)SvIVx(POPs)) +#define POPul ((unsigned long)SvIVx(POPs)) +#ifdef HAS_QUAD +#define POPq ((Quad_t)SvIVx(POPs)) +#endif #define TOPs (*sp) #define TOPp (SvPV(TOPs, PL_na)) /* deprecated */ @@ -72,6 +76,10 @@ #define TOPi ((IV)SvIV(TOPs)) #define TOPu ((UV)SvUV(TOPs)) #define TOPl ((long)SvIV(TOPs)) +#define TOPul ((unsigned long)SvIV(TOPs)) +#ifdef HAS_QUAD +#define TOPq ((Quad_t)SvIV(TOPs)) +#endif /* Go to some pains in the rare event that we must extend the stack. */ #define EXTEND(p,n) STMT_START { if (PL_stack_max - p < (n)) { \ diff --git a/pp_sys.c b/pp_sys.c index 33eddca..ecaebe3 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -1764,7 +1764,7 @@ PP(pp_sysseek) djSP; GV *gv; int whence = POPi; - Off_t offset = POPl; + Off_t offset = (Off_t)SvIVx(POPs); MAGIC *mg; gv = PL_last_in_gv = (GV*)POPs; @@ -5000,7 +5000,7 @@ fcntl_emulate_flock(int fd, int operation) return -1; } flock.l_whence = SEEK_SET; - flock.l_start = flock.l_len = 0L; + flock.l_start = flock.l_len = (Off_t)0; return fcntl(fd, (operation & LOCK_NB) ? F_SETLK : F_SETLKW, &flock); } -- 1.8.3.1