0.8.15:
[sbcl.git] / src / code / unix.lisp
index 74f98be..7c1298d 100644 (file)
 ;;; implemented using SB!XC:DEFMACRO wrapped in EVAL-WHEN.
 
 (defmacro syscall ((name &rest arg-types) success-form &rest args)
-  `(let ((result (alien-funcall (extern-alien ,name (function int ,@arg-types))
+  `(locally
+    (declare (optimize (sb!c::float-accuracy 0)))
+    (let ((result (alien-funcall (extern-alien ,name (function int ,@arg-types))
                                ,@args)))
-     (if (minusp result)
-        (values nil (get-errno))
-        ,success-form)))
+      (if (minusp result)
+         (values nil (get-errno))
+         ,success-form))))
 
 ;;; This is like SYSCALL, but if it fails, signal an error instead of
 ;;; returning error codes. Should only be used for syscalls that will
 ;;; never really get an error.
 (defmacro syscall* ((name &rest arg-types) success-form &rest args)
-  `(let ((result (alien-funcall (extern-alien ,name (function int ,@arg-types))
-                               ,@args)))
-     (if (minusp result)
-        (error "Syscall ~A failed: ~A" ,name (strerror))
-        ,success-form)))
+  `(locally
+    (declare (optimize (sb!c::float-accuracy 0)))
+    (let ((result (alien-funcall (extern-alien ,name (function int ,@arg-types))
+                                ,@args)))
+      (if (minusp result)
+         (error "Syscall ~A failed: ~A" ,name (strerror))
+         ,success-form))))
 
 (/show0 "unix.lisp 109")
 
 
 ;;; UNIX-WRITE accepts a file descriptor, a buffer, an offset, and the
 ;;; length to write. It attempts to write len bytes to the device
-;;; associated with fd from the the buffer starting at offset. It returns
+;;; associated with fd from the buffer starting at offset. It returns
 ;;; the actual number of bytes written.
 (defun unix-write (fd buf offset len)
   (declare (type unix-fd fd)
             (cast buf c-string)
             (cast buf (* char)) 256)))
 
-;;; Write the core image of the file described by FD to disk.
-(defun unix-fsync (fd)
-  (declare (type unix-fd fd))
-  (void-syscall ("fsync" int) fd))
-\f
-
 (defun unix-setsid ()
   (int-syscall ("setsid")))
 
@@ -970,7 +968,9 @@ previous timer after the body has finished executing"
     `(multiple-value-bind (,word ,bit) (floor ,offset 32)
        (setf (deref (slot ,fd-set 'fds-bits) ,word)
             (logand (deref (slot ,fd-set 'fds-bits) ,word)
-                    (sb!kernel:32bit-logical-not
+                     ;; FIXME: This may not be quite right for 64-bit
+                     ;; ports of SBCL.  --njf, 2004-08-04
+                    (sb!kernel:word-logical-not
                      (truly-the (unsigned-byte 32) (ash 1 ,bit))))))))
 
 ;;; not checked for linux...