1.0.34.9: darwin/x86-64 sb-posix:stat fixes from Kei Suzuki
authorCyrus Harmon <ch-sbcl@bobobeach.com>
Thu, 21 Jan 2010 05:09:43 +0000 (05:09 +0000)
committerCyrus Harmon <ch-sbcl@bobobeach.com>
Thu, 21 Jan 2010 05:09:43 +0000 (05:09 +0000)
* sb-unix:unix-stat/lstat/fstat return the 32bit inode with x86 and
  the 64bit inode with x86-64,

* sb-posix:stat/lstat/fstat get stat values using the old stat calls
  with x86 and the new ones with x86-64

* re-enable now-working sb-posix stat tests

contrib/sb-grovel/def-to-lisp.lisp
contrib/sb-posix/interface.lisp
contrib/sb-posix/posix-tests.lisp
make-config.sh
src/runtime/Config.x86-64-darwin9+ [new file with mode: 0644]
tools-for-build/ldso-stubs.lisp
version.lisp-expr

index fceabeb..56039a2 100644 (file)
@@ -205,10 +205,16 @@ code:
                       '("-D_LARGEFILE_SOURCE"
                         "-D_LARGEFILE64_SOURCE"
                         "-D_FILE_OFFSET_BITS=64")
-                      #+(and x86-64 darwin)
-                      '("-arch" "x86_64")
+                      #+(and x86-64 darwin inode64)
+                      '("-arch" "x86_64"
+                        "-mmacosx-version-min=10.5"
+                        "-D_DARWIN_USE_64_BIT_INODE")
+                      #+(and x86-64 darwin (not inode64))
+                      '("-arch" "x86_64"
+                        "-mmacosx-version-min=10.4")
                       #+(and x86 darwin)
-                      '("-arch" "i386")
+                      '("-arch" "i386"
+                        "-mmacosx-version-min=10.4")
                       #+(and x86-64 sunos) '("-m64")
                       (list "-o"
                             (namestring tmp-a-dot-out)
index c01f031..eff9ce7 100644 (file)
 
 (defmacro define-stat-call (name arg designator-fun type)
   ;; FIXME: this isn't the documented way of doing this, surely?
-  (let ((lisp-name (lisp-for-c-symbol name)))
+  (let ((lisp-name (lisp-for-c-symbol name))
+        (real-name #+inode64 (format nil "~A$INODE64" name)
+                   #-inode64 name))
     `(progn
       (export ',lisp-name :sb-posix)
       (declaim (inline ,lisp-name))
         (declare (type (or null stat) stat))
         (with-alien-stat a-stat ()
           (let ((r (alien-funcall
-                    (extern-alien ,(real-c-name (list name :options :largefile)) ,type)
+                    (extern-alien ,(real-c-name (list real-name :options :largefile)) ,type)
                     (,designator-fun ,arg)
                     a-stat)))
             (when (minusp r)
index 300b322..9739323 100644 (file)
         result)))
   #.sb-posix::eacces)
 \f
-#-darwin
 (deftest stat.1
   (let* ((stat (sb-posix:stat *test-directory*))
          (mode (sb-posix::stat-mode stat)))
     (logand mode (logior sb-posix::s-iread sb-posix::s-iwrite sb-posix::s-iexec)))
   #.(logior sb-posix::s-iread sb-posix::s-iwrite sb-posix::s-iexec))
 
-#-(or darwin win32)
+#-win32
 (deftest stat.2
   (let* ((stat (sb-posix:stat "/"))
          (mode (sb-posix::stat-mode stat)))
     (< (- atime unix-now) 10))
   t)
 
-#-(or darwin win32)
+#-win32
 (deftest stat.4
   (let* ((stat (sb-posix:stat (make-pathname :directory '(:absolute :up))))
          (mode (sb-posix::stat-mode stat)))
     (sb-posix:s-isreg mode))
   nil)
 
-#-darwin
 (deftest stat-mode.2
   (with-stat-mode (mode *test-directory*)
     (sb-posix:s-isdir mode))
     (sb-posix:s-issock mode))
   nil)
 
-#-(or win32 darwin)
+#-win32
 (deftest stat-mode.7
   (let ((link-pathname (make-pathname :name "stat-mode.7"
                                       :defaults *test-directory*)))
       (ignore-errors (sb-posix:unlink link-pathname))))
   t)
 
-#-darwin
 (deftest stat-mode.8
   (let ((pathname (make-pathname :name "stat-mode.8"
                                  :defaults *test-directory*)))
   t)
 
 
-#-(or darwin win32)
+#-win32
 (deftest time.1
     (plusp (sb-posix:time))
   t)
 
-#-(or darwin win32)
+#-win32
 (deftest utimes.1
     (let ((file (merge-pathnames #p"utimes.1" *test-directory*))
           (atime (random (1- (expt 2 31))))
index 6075913..c9dad1d 100644 (file)
@@ -143,6 +143,17 @@ fi
 printf ":%s" "$sbcl_arch" >> $ltf
 
 echo //setting up OS-dependent information
+
+# Under Darwin x86-64, guess whether Darwin 9+ or below.
+if [ "$sbcl_os" = "darwin" ] && [ "$sbcl_arch" = "x86-64" ]; then
+       darwin_version=`uname -r`
+       darwin_version_major=${DARWIN_VERSION_MAJOR:-${darwin_version%%.*}}
+       if (( 8 < $darwin_version_major )); then
+               ver9_or_above="9+"
+               printf ' :inode64' >> $ltf
+       fi
+fi
+
 original_dir=`pwd`
 cd ./src/runtime/
 rm -f Config target-arch-os.h target-arch.h target-os.h target-lispregs.h
@@ -236,7 +247,7 @@ case "$sbcl_os" in
         fi
         link_or_copy $sbcl_arch-darwin-os.h target-arch-os.h
         link_or_copy bsd-os.h target-os.h
-        link_or_copy Config.$sbcl_arch-darwin Config
+        link_or_copy Config.$sbcl_arch-darwin$ver9_or_above Config
         ;;
     sunos)
         printf ' :unix' >> $ltf
diff --git a/src/runtime/Config.x86-64-darwin9+ b/src/runtime/Config.x86-64-darwin9+
new file mode 100644 (file)
index 0000000..3da837d
--- /dev/null
@@ -0,0 +1,31 @@
+# -*- makefile -*- for the C-level run-time support for SBCL
+
+# This software is part of the SBCL system. See the README file for
+# more information.
+#
+# This software is derived from the CMU CL system, which was
+# written at Carnegie Mellon University and released into the
+# public domain. The software is in the public domain and is
+# provided with absolutely no warranty. See the COPYING and CREDITS
+# files for more information.
+
+CFLAGS = -g -Wall -O2 -fdollars-in-identifiers -mmacosx-version-min=10.5 -D_DARWIN_USE_64_BIT_INODE
+LINKFLAGS += -mmacosx-version-min=10.5
+OS_SRC = bsd-os.c x86-64-bsd-os.c darwin-os.c x86-64-darwin-os.c darwin-dlshim.c darwin-langinfo.c
+OS_LIBS = -lSystem -lc -ldl
+ifdef LISP_FEATURE_SB_THREAD
+  OS_LIBS += -lpthread
+endif
+
+ASSEM_SRC = x86-64-assem.S ldso-stubs.S
+ARCH_SRC = x86-64-arch.c
+
+LINKFLAGS += -arch x86_64 -dynamic -twolevel_namespace -bind_at_load -pagezero_size 0x100000
+
+CFLAGS += -arch x86_64 -fno-omit-frame-pointer -pagezero_size 0x100000
+
+GC_SRC = gencgc.c
+
+# Nothing to do for after-grovel-headers.
+.PHONY: after-grovel-headers
+after-grovel-headers:
index 8fa13b0..bbb7e9e 100644 (file)
@@ -220,6 +220,7 @@ ldso_stub__ ## fct: ;                  \\
                    "fork"
                    "free"
                    "fstat"
+                   #!+inode64 "fstat$INODE64"
                    "fsync"
                    "ftruncate"
                    "getcwd"
@@ -250,6 +251,7 @@ ldso_stub__ ## fct: ;                  \\
                    "log1p"
                    "lseek"
                    "lstat"
+                   #!+inode64 "lstat$INODE64"
                    "malloc"
                    "memmove"
                    "mkdir"
@@ -274,6 +276,7 @@ ldso_stub__ ## fct: ;                  \\
                    "sinh"
                    "socket"
                    "stat"
+                   #!+inode64 "stat$INODE64"
                    "strerror"
                    "strlen"
                    "symlink"
index 55ed714..056dd81 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.34.8"
+"1.0.34.9"