X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Funix.lisp;h=9199ccb9daa06cf83d7e2eeafa22f64d749e3b47;hb=1b650be8b800cf96e2c268ae317fb26d0bf36827;hp=d96189e8ba3815162643424ea6f7d4fab4f7c846;hpb=0677c33068646b6ec33d5f622771673f3de38504;p=sbcl.git diff --git a/src/code/unix.lisp b/src/code/unix.lisp index d96189e..9199ccb 100644 --- a/src/code/unix.lisp +++ b/src/code/unix.lisp @@ -68,7 +68,7 @@ ,@args))) (if (minusp result) (values nil (get-errno)) - ,success-form))) + ,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 @@ -219,7 +219,11 @@ " (declare (type unix-fd fd) (type (integer 0 2) whence)) - (int-syscall ("lseek" int off-t int) fd offset whence)) + (let ((result (alien-funcall (extern-alien "lseek" (function off-t int off-t int)) + fd offset whence))) + (if (minusp result ) + (values nil (get-errno)) + (values result 0)))) ;;; UNIX-READ accepts a file descriptor, a buffer, and the length to read. ;;; It attempts to read len bytes from the device associated with fd @@ -289,14 +293,14 @@ ;; a constant. Going the grovel_headers route doesn't seem to be ;; helpful, either, as Solaris doesn't export PATH_MAX from ;; unistd.h. - #!-(or linux openbsd freebsd sunos osf1) (,stub,) - #!+(or linux openbsd freebsd sunos osf1) + #!-(or linux openbsd freebsd sunos osf1 darwin) (,stub,) + #!+(or linux openbsd freebsd sunos osf1 darwin) (or (newcharstar-string (alien-funcall (extern-alien "getcwd" (function (* char) (* char) size-t)) nil - #!+(or linux openbsd freebsd) 0 + #!+(or linux openbsd freebsd darwin) 0 #!+(or sunos osf1) 1025)) (simple-perror "getcwd"))) @@ -755,7 +759,7 @@ (slot (slot itvo 'it-value) 'tv-usec)) which (alien-sap (addr itvn))(alien-sap (addr itvo)))))) -(defmacro sb!ext::with-timeout (expires &body body) +(defmacro sb!ext:with-timeout (expires &body body) "Execute the body, interrupting it with a SIGALRM after at least EXPIRES seconds have passed. Uses Unix setitimer(), restoring any previous timer after the body has finished executing" @@ -775,8 +779,8 @@ previous timer after the body has finished executing" (unix-setitimer :real 0 0 ,s ,u) ,@body) (unix-setitimer :real 0 0 ,saved-seconds ,saved-useconds)) - ,@body))))) - + (progn + ,@body)))))) (defconstant ENOENT 2) ; Unix error code, "No such file or directory"