;;; synthesize a nice consistent structure for us.
;;;
;;; Note that st-dev is a long, not a dev-t. This is because dev-t on
-;;; linux 32 bit archs is a 64 bit quantity, but alien doesn's support
+;;; linux 32 bit archs is a 64 bit quantity, but alien doesn't support
;;; those. We don't actually access that field anywhere, though, so
;;; until we can get 64 bit alien support it'll do. Also note that
;;; st_size is a long, not an off-t, because off-t is a 64-bit
;;; 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-ino ino-t)
(st-mode mode-t)
- (st-nlink nlink-t)
- (st-uid uid-t)
- (st-gid gid-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-blksize unsigned-long)
(st-blocks unsigned-long)
(st-atime time-t)
(slot (slot itvo 'it-value) 'tv-usec))
which (alien-sap (addr itvn))(alien-sap (addr itvo))))))
-(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"
- (with-unique-names (saved-seconds saved-useconds s u)
- `(let (- ,saved-seconds ,saved-useconds)
- (multiple-value-setq (- - - ,saved-seconds ,saved-useconds)
- (unix-getitimer :real))
- (multiple-value-bind (,s ,u) (floor ,expires)
- (setf ,u (floor (* ,u 1000000)))
- (if (and (> ,expires 0)
- (or (and (zerop ,saved-seconds) (zerop ,saved-useconds))
- (> ,saved-seconds ,s)
- (and (= ,saved-seconds ,s)
- (> ,saved-useconds ,u))))
- (unwind-protect
- (progn
- (unix-setitimer :real 0 0 ,s ,u)
- ,@body)
- (unix-setitimer :real 0 0 ,saved-seconds ,saved-useconds))
- (progn
- ,@body))))))
\f
;;; FIXME: Many Unix error code definitions were deleted from the old
;;; CMU CL source code here, but not in the exports of SB-UNIX. I
`(progn
,@(loop for index upfrom 0 below (/ fd-setsize sb!vm:n-machine-word-bits)
collect `(setf (deref (slot ,fd-set 'fds-bits) ,index) 0))))
-
-