diff --git a/.github/workflows/linux-arm.yml b/.github/workflows/linux-arm.yml index e54dbcf31..f8c21797b 100644 --- a/.github/workflows/linux-arm.yml +++ b/.github/workflows/linux-arm.yml @@ -23,9 +23,9 @@ jobs: CC: arm-linux-gnueabihf-gcc run: ./make.sh --xc-host='sbcl --dynamic-space-size 700MB --lose-on-corruption --disable-ldb --disable-debugger' --arch=arm - # - name: test - # env: - # CC: arm-linux-gnueabihf-gcc - # run: cd tests; ./run-tests.sh + - name: test + env: + CC: arm-linux-gnueabihf-gcc + run: cd tests; ./run-tests.sh - name: ansi-test run: cd tests; ./ansi-tests.sh diff --git a/contrib/sb-grovel/def-to-lisp.lisp b/contrib/sb-grovel/def-to-lisp.lisp index 878a4bd0e..6cca9b094 100644 --- a/contrib/sb-grovel/def-to-lisp.lisp +++ b/contrib/sb-grovel/def-to-lisp.lisp @@ -197,6 +197,8 @@ code: (split-cflags (sb-ext:posix-getenv "EXTRA_CFLAGS")) #+(and linux largefile) '("-D_LARGEFILE_SOURCE" "-D_LARGEFILE64_SOURCE" "-D_FILE_OFFSET_BITS=64") + #+64-bit-time + '("-D_TIME_BITS=64") #+(and (or x86 ppc sparc) (or linux freebsd)) '("-m32") #+(and x86-64 darwin inode64) `("-arch" "x86_64" ,(format nil "-mmacosx-version-min=~A" diff --git a/contrib/sb-posix/constants.lisp b/contrib/sb-posix/constants.lisp index 9883757ff..ff566fc5e 100644 --- a/contrib/sb-posix/constants.lisp +++ b/contrib/sb-posix/constants.lisp @@ -424,7 +424,8 @@ ;; utime(), utimes() #-win32 (:type suseconds-t ; OAOOM warning: similar kludge in tools-for-build - #+os-provides-suseconds-t "suseconds_t" + #+(and os-provides-suseconds-t 64-bit-time) "__suseconds64_t" + #+(and os-provides-suseconds-t (not 64-bit-time)) "suseconds_t" #-os-provides-suseconds-t "long") #-win32 @@ -436,7 +437,9 @@ (:structure alien-timeval ("struct timeval" (time-t sec "time_t" "tv_sec") - (suseconds-t usec "suseconds_t" "tv_usec"))) + (suseconds-t usec #+64-bit-time "__suseconds64_t" + #-64-bit-time "suseconds_t" + "tv_usec"))) (:integer veof "VEOF" nil t) (:integer veol "VEOL" nil t) diff --git a/contrib/sb-posix/interface.lisp b/contrib/sb-posix/interface.lisp index a56b19761..9e808873c 100644 --- a/contrib/sb-posix/interface.lisp +++ b/contrib/sb-posix/interface.lisp @@ -908,7 +908,8 @@ not supported." (progn (export 'time :sb-posix) (defun time () - (let ((result (alien-funcall (extern-alien "time" + (let ((result (alien-funcall (extern-alien #-64-bit-time "time" + #+64-bit-time "__time64" (function time-t (* time-t))) nil))) (if (minusp result) @@ -916,18 +917,19 @@ not supported." result))) (export 'utime :sb-posix) (defun utime (filename &optional access-time modification-time) - (with-alien ((fun (function int (c-string :not-null t) (* alien-utimbuf)) - :extern #-netbsd "utime" #+netbsd "_utime")) - (let ((name (filename filename))) - (if (not (and access-time modification-time)) - (alien-funcall fun name nil) - (with-alien ((utimbuf (struct alien-utimbuf))) - (setf (slot utimbuf 'actime) (or access-time 0) - (slot utimbuf 'modtime) (or modification-time 0)) - (let ((result (alien-funcall fun name (alien-sap utimbuf)))) - (if (minusp result) - (syscall-error 'utime) - result))))))) + (with-alien ((fun (function int (c-string :not-null t) (* alien-utimbuf)) + :extern #-(or 64-bit-time netbsd) "utime" #+netbsd "_utime" + #+64-bit-time "__utime64")) + (let ((name (filename filename))) + (if (not (and access-time modification-time)) + (alien-funcall fun name nil) + (with-alien ((utimbuf (struct alien-utimbuf))) + (setf (slot utimbuf 'actime) (or access-time 0) + (slot utimbuf 'modtime) (or modification-time 0)) + (let ((result (alien-funcall fun name (alien-sap utimbuf)))) + (if (minusp result) + (syscall-error 'utime) + result))))))) (export 'utimes :sb-posix) (defun utimes (filename &optional access-time modification-time) (flet ((seconds-and-useconds (time) @@ -938,22 +940,22 @@ not supported." (if (minusp value) (syscall-error 'utimes) value))) - (with-alien ((fun (function int (c-string :not-null t) (* (array alien-timeval 2))) - :extern #-netbsd "utimes" #+netbsd "sb_utimes")) - (let ((name (filename filename))) - (if (not (and access-time modification-time)) - (maybe-syscall-error (alien-funcall fun name nil)) - (with-alien ((buf (array alien-timeval 2))) - (let ((actime (deref buf 0)) - (modtime (deref buf 1))) - (setf (values (slot actime 'sec) - (slot actime 'usec)) - (seconds-and-useconds (or access-time 0)) - (values (slot modtime 'sec) - (slot modtime 'usec)) - (seconds-and-useconds (or modification-time 0))) - (maybe-syscall-error (alien-funcall fun name - (alien-sap buf))))))))))) + (with-alien ((fun (function int (c-string :not-null t) (* (array alien-timeval 2))) + :extern #-(or netbsd 64-bit-time) "utimes" #+(or netbsd 64-bit-time) "sb_utimes")) + (let ((name (filename filename))) + (if (not (and access-time modification-time)) + (maybe-syscall-error (alien-funcall fun name nil)) + (with-alien ((buf (array alien-timeval 2))) + (let ((actime (deref buf 0)) + (modtime (deref buf 1))) + (setf (values (slot actime 'sec) + (slot actime 'usec)) + (seconds-and-useconds (or access-time 0)) + (values (slot modtime 'sec) + (slot modtime 'usec)) + (seconds-and-useconds (or modification-time 0))) + (maybe-syscall-error (alien-funcall fun name + (alien-sap buf))))))))))) ;;; environment diff --git a/tests/gc.impure.lisp b/tests/gc.impure.lisp index 78ee907e5..085025ff6 100644 --- a/tests/gc.impure.lisp +++ b/tests/gc.impure.lisp @@ -422,7 +422,7 @@ #+win32 (alien-funcall (extern-alien "Sleep" (function void int)) 300) #-win32 - (alien-funcall (extern-alien "sb_nanosleep" (function void int int)) 0 300000000) + (alien-funcall (extern-alien "sb_nanosleep" (function void sb-unix:time-t int)) 0 300000000) (values a b c d e f g h i j k l m)))) (thr (sb-thread:make-thread (lambda () (let ((args #1=(list (LIST 'A) (LIST 'B) (LIST 'C) diff --git a/tests/sleepytests.pure.lisp b/tests/sleepytests.pure.lisp index 48d52ebcf..76fe6215a 100644 --- a/tests/sleepytests.pure.lisp +++ b/tests/sleepytests.pure.lisp @@ -8,7 +8,8 @@ ;;; SLEEP should not cons except on 32-bit platforms when ;;; (> (mod seconds 1) (* most-positive-fixnum 1e-9)) (with-test (:name (sleep :non-consing) - :serial t :skipped-on :interpreter) + :serial t :skipped-on :interpreter + :fails-on (and :arm :64-bit-time)) (handler-case (sb-ext:with-timeout 5 (ctu:assert-no-consing (sleep 0.00001s0)) (locally (declare (notinline sleep)) diff --git a/tools-for-build/64-bit-time-test.c b/tools-for-build/64-bit-time-test.c new file mode 100644 index 000000000..edf5147f7 --- /dev/null +++ b/tools-for-build/64-bit-time-test.c @@ -0,0 +1,8 @@ +#include + +int main () +{ + if (sizeof( time_t) == 8) + return 104; + return 1; +} diff --git a/tools-for-build/grovel-features.sh b/tools-for-build/grovel-features.sh index 522ebc58c..6265439b6 100644 --- a/tools-for-build/grovel-features.sh +++ b/tools-for-build/grovel-features.sh @@ -52,6 +52,13 @@ featurep os-provides-close-range-wrapper featurep os-provides-posix-spawn +if [ "$sbcl_os" = linux ] ; then + case "$sbcl_arch" in + arm | x86 | ppc | mips | sparc | riscv32) + featurep 64-bit-time + esac +fi + if [ "$sbcl_arch" = arm ] ; then featurep arm-softfp fi diff --git a/tools-for-build/os-provides-suseconds-t-test.c b/tools-for-build/os-provides-suseconds-t-test.c index 5fcd72572..d4d5874fb 100644 --- a/tools-for-build/os-provides-suseconds-t-test.c +++ b/tools-for-build/os-provides-suseconds-t-test.c @@ -1,4 +1,3 @@ -/* test to build and run so that we know if we have blksize_t */ #include