~ chicken-core (chicken-5) c6acc1650e9f79367ce7fa054486f7fe35dc67b6
commit c6acc1650e9f79367ce7fa054486f7fe35dc67b6
Author: Evan Hanson <evhan@foldling.org>
AuthorDate: Fri Jan 22 14:59:10 2016 +1300
Commit: Evan Hanson <evhan@foldling.org>
CommitDate: Tue Mar 8 22:52:34 2016 +1300
Rename "_exit" to "emergency-exit" and move to posix-common
The implementations in posixunix.scm and posixwin.scm were identical.
diff --git a/manual/Unit posix b/manual/Unit posix
index b0a04ff7..6d1d6fb8 100644
--- a/manual/Unit posix
+++ b/manual/Unit posix
@@ -1119,14 +1119,14 @@ The {{FORMAT}} string follows the rules for the C library procedure {{strptime}}
=== Raw exit
-==== _exit
+==== emergency-exit
-<procedure>(_exit [CODE])</procedure>
+<procedure>(emergency-exit [CODE])</procedure>
Exits the current process without flushing any buffered output (using
-the C function {{_exit}}). Note that the {{exit-handler}}
-is not called when this procedure is invoked. The optional return-code
-{{CODE}} defaults to {{0}}.
+the C function {{_exit}}). Note that the {{exit-handler}} is not called
+when this procedure is invoked. The optional exit status code {{CODE}}
+defaults to {{0}}.
=== ERRNO values
@@ -1281,7 +1281,7 @@ not be obtained. On Windows, this procedure always returns {{0}},
; {{current-user-id}} : {{getuid}}
; {{delete-directory}} : {{rmdir}}
; {{duplicate-fileno}} : {{dup/dup2}}
-; {{_exit}} : {{_exit}}
+; {{emergency-exit}} : {{_exit}}
; {{file-close}} : {{close}}
; {{file-access-time}} : {{stat}}
; {{file-change-time}} : {{stat}}
diff --git a/posix-common.scm b/posix-common.scm
index c3a9bfe6..a6f8105f 100644
--- a/posix-common.scm
+++ b/posix-common.scm
@@ -185,6 +185,14 @@ EOF
(define ##sys#posix-error posix-error)
+;;; Exit
+
+(define emergency-exit
+ (let ((_exit (foreign-lambda void "_exit" int)))
+ (lambda (#!optional (code 0))
+ (_exit code))))
+
+
;;; File properties
(define-foreign-variable _stat_st_ino unsigned-int "C_statbuf.st_ino")
diff --git a/posixunix.scm b/posixunix.scm
index 058b8c2a..362e40f3 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -37,7 +37,7 @@
(define-foreign-variable _stat_st_blocks unsigned-int "C_statbuf.st_blocks")
(module chicken.posix
- (_exit call-with-input-pipe call-with-output-pipe change-directory
+ (emergency-exit call-with-input-pipe call-with-output-pipe change-directory
change-directory* change-file-mode change-file-owner close-input-pipe
close-output-pipe create-directory create-fifo create-pipe
create-session create-symbolic-link current-directory
@@ -1510,11 +1510,6 @@ EOF
;;; Other things:
-(define _exit
- (let ([ex0 (foreign-lambda void "_exit" int)])
- (lambda code
- (ex0 (if (pair? code) (car code) 0)) ) ) )
-
(define set-alarm! (foreign-lambda int "C_alarm" int))
(define-foreign-variable _iofbf int "_IOFBF")
diff --git a/posixwin.scm b/posixwin.scm
index 4e46662e..ef95d03a 100644
--- a/posixwin.scm
+++ b/posixwin.scm
@@ -662,7 +662,7 @@ EOF
(define-foreign-variable _stat_st_blocks scheme-object "C_SCHEME_UNDEFINED")
(module chicken.posix
- (_exit call-with-input-pipe call-with-output-pipe change-directory
+ (emergency-exit call-with-input-pipe call-with-output-pipe change-directory
change-directory* change-file-mode change-file-owner close-input-pipe
close-output-pipe create-directory create-fifo create-pipe
create-session create-symbolic-link current-directory
@@ -1168,11 +1168,6 @@ EOF
;;; Other things:
-(define _exit
- (let ([ex0 (foreign-lambda void "_exit" int)])
- (lambda code
- (ex0 (if (pair? code) (car code) 0)) ) ) )
-
(define (terminal-port? port)
(##sys#check-open-port port 'terminal-port?)
(let ([fp (##sys#peek-unsigned-integer port 0)])
diff --git a/types.db b/types.db
index b1a6e60d..732cf11f 100644
--- a/types.db
+++ b/types.db
@@ -1843,7 +1843,7 @@
;; posix
-(chicken.posix#_exit (procedure chicken.posix#_exit (#!optional fixnum) noreturn))
+(chicken.posix#emergency-exit (procedure chicken.posix#emergency-exit (#!optional fixnum) noreturn))
(chicken.posix#call-with-input-pipe (#(procedure #:enforce) chicken.posix#call-with-input-pipe (string (procedure (input-port) . *) #!optional symbol) . *))
(chicken.posix#call-with-output-pipe (#(procedure #:enforce) chicken.posix#call-with-output-pipe (string (procedure (input-port) . *) #!optional symbol) . *))
(chicken.posix#change-directory (#(procedure #:clean #:enforce) chicken.posix#change-directory (string) string))
Trap