1.0.3.21: suseconds_t -> long on win32
[sbcl.git] / src / code / unix.lisp
index 09146ab..be0e228 100644 (file)
@@ -167,7 +167,12 @@ SYSCALL-FORM. Repeat evaluation of SYSCALL-FORM if it is interrupted."
   (declare (type unix-pathname path)
            (type fixnum flags)
            (type unix-file-mode mode))
-  (int-syscall ("open" c-string int int) path (logior #!+win32 o_binary flags) mode))
+  (int-syscall ("open" c-string int int)
+               path
+               (logior #!+win32 o_binary
+                       #!+largefile o_largefile
+                       flags)
+               mode))
 
 ;;; UNIX-CLOSE accepts a file descriptor and attempts to close the file
 ;;; associated with it.
@@ -180,10 +185,19 @@ SYSCALL-FORM. Repeat evaluation of SYSCALL-FORM if it is interrupted."
 
 ;; A time value that is accurate to the nearest
 ;; microsecond but also has a range of years.
+;; CLH: Note that tv-usec used to be a time-t, but that this seems
+;; problematic on Darwin x86-64 (and wrong). Trying suseconds-t.
+#!-win32
+(define-alien-type nil
+    (struct timeval
+            (tv-sec time-t)             ; seconds
+            (tv-usec suseconds-t))) ; and microseconds
+
+#!+win32
 (define-alien-type nil
-  (struct timeval
-          (tv-sec time-t)               ; seconds
-          (tv-usec time-t)))            ; and microseconds
+    (struct timeval
+            (tv-sec time-t)             ; seconds
+            (tv-usec long)))          ; and microseconds
 \f
 ;;;; resourcebits.h
 
@@ -257,7 +271,9 @@ SYSCALL-FORM. Repeat evaluation of SYSCALL-FORM if it is interrupted."
   "
   (declare (type unix-fd fd)
            (type (integer 0 2) whence))
-  (let ((result (alien-funcall (extern-alien "lseek" (function off-t int off-t int))
+  (let ((result (alien-funcall (extern-alien #!-largefile "lseek"
+                                             #!+largefile "lseek_largefile"
+                                             (function off-t int off-t int))
                  fd offset whence)))
     (if (minusp result )
         (values nil (get-errno))
@@ -614,23 +630,19 @@ SYSCALL-FORM. Repeat evaluation of SYSCALL-FORM if it is interrupted."
 ;;; longer than 32 bits anyway, right?":-|
 (define-alien-type nil
   (struct wrapped_stat
-    #!-mips
-    (st-dev unsigned-int)              ; would be dev-t in a real stat
-    #!+mips
-    (st-dev unsigned-long)             ; this is _not_ a dev-t on mips
+    (st-dev #!-(or mips largefile) unsigned-int
+            #!+mips unsigned-long
+            #!+largefile dev-t)
     (st-ino ino-t)
     (st-mode mode-t)
     (st-nlink nlink-t)
     (st-uid uid-t)
     (st-gid gid-t)
-    #!-mips
-    (st-rdev unsigned-int)             ; would be dev-t in a real stat
-    #!+mips
-    (st-rdev unsigned-long)             ; this is _not_ a dev-t on mips
-    #!-mips
-    (st-size unsigned-int)              ; would be off-t in a real stat
-    #!+mips
-    (st-size off-t)
+    (st-rdev #!-(or mips largefile) unsigned-int
+             #!+mips unsigned-long
+             #!+largefile dev-t)
+    (st-size #!-(or mips largefile) unsigned-int
+             #!+(or mips largefile) off-t)
     (st-blksize unsigned-long)
     (st-blocks unsigned-long)
     (st-atime time-t)