Also fix docstring of SB-EXT:EXIT, which referred to exit as being section 2.
(lp#936304)
* enhancement: backtraces show the correct number of arguments for frames
called with too many arguments.
+ * enhancement: support for abort(3), exit(3), and _exit(2) has been added to
+ SB-POSIX.
* optimization: fewer uses of full calls to signed modular functions.
(lp#903821)
* optimization: typechecking alien values is typically 5 x faster.
(defpackage :sb-posix (:use #:sb-alien #:cl)
- (:shadow close open ftruncate truncate time read write)
+ (:shadow abort close open ftruncate truncate time read write)
(:export #:syscall-error #:syscall-errno #:syscall-name
;; types and type conversion
;; uid, gid
(define-call "geteuid" uid-t never-fails) ; "always successful", it says
-#-sunos (define-call "getresuid" uid-t never-fails)
+ #-sunos
+ (define-call "getresuid" uid-t never-fails)
(define-call "getuid" uid-t never-fails)
(define-call "seteuid" int minusp (uid uid-t))
-#-sunos (define-call "setfsuid" int minusp (uid uid-t))
+ #-sunos
+ (define-call "setfsuid" int minusp (uid uid-t))
(define-call "setreuid" int minusp (ruid uid-t) (euid uid-t))
-#-sunos (define-call "setresuid" int minusp (ruid uid-t) (euid uid-t) (suid uid-t))
+ #-sunos
+ (define-call "setresuid" int minusp (ruid uid-t) (euid uid-t) (suid uid-t))
(define-call "setuid" int minusp (uid uid-t))
(define-call "getegid" gid-t never-fails)
(define-call "getgid" gid-t never-fails)
-#-sunos (define-call "getresgid" gid-t never-fails)
+ #-sunos
+ (define-call "getresgid" gid-t never-fails)
(define-call "setegid" int minusp (gid gid-t))
-#-sunos (define-call "setfsgid" int minusp (gid gid-t))
+ #-sunos
+ (define-call "setfsgid" int minusp (gid gid-t))
(define-call "setgid" int minusp (gid gid-t))
(define-call "setregid" int minusp (rgid gid-t) (egid gid-t))
-#-sunos (define-call "setresgid" int minusp (rgid gid-t) (egid gid-t) (sgid gid-t))
+ #-sunos
+ (define-call "setresgid" int minusp (rgid gid-t) (egid gid-t) (sgid gid-t))
;; processes, signals
(define-call "alarm" int never-fails (seconds unsigned))
-
+ ;; exit and abort, not much point inlining these
+ (define-simple-call abort void)
+ (define-simple-call exit void (status int))
+ (define-simple-call _exit void (status int))
;; FIXME this is a lie, of course this can fail, but there's no
;; error handling here yet!
(declaim (inline ,lisp-name))
(defun ,lisp-name ,arglist
,@body))))
+
+(defmacro define-simple-call (name return-type &rest arguments)
+ (multiple-value-bind (lisp-name c-name)
+ (values name (substitute #\_ #\- (string-downcase name)))
+ `(progn
+ (export ',lisp-name :sb-posix)
+ (defun ,lisp-name ,(mapcar #'first arguments)
+ (alien-funcall (extern-alien ,c-name (function ,return-type
+ ,@(mapcar #'second arguments)))
+ ,@(mapcar #'first arguments))))))
\ No newline at end of file
When ABORT is false (the default), current thread is first unwound,
*EXIT-HOOKS* are run, other threads are terminated, and standard
-output streams are flushed before SBCL calls exit(2) -- at which point
+output streams are flushed before SBCL calls exit(3) -- at which point
atexit(3) functions will run. If multiple threads call EXIT with ABORT
being false, the first one to call it will complete the protocol.
When ABORT is true, SBCL exits immediately by calling _exit(2) without
unwinding stack, or calling exit hooks. Note that _exit(2) does not
-call atexit(3) functions unlike exit(2).
+call atexit(3) functions unlike exit(3).
Recursive calls to EXIT cause EXIT to behave as it ABORT was true.