Merge branch 'master' of git://factorcode.org/git/factor

db4
Slava Pestov 2008-02-04 20:44:04 -06:00
commit f09b78e766
3 changed files with 24 additions and 16 deletions

View File

@ -111,7 +111,7 @@ M: unix-io process-stream*
2drop t 2drop t
] [ ] [
find-process dup [ find-process dup [
>r *uint r> notify-exit f >r *int WEXITSTATUS r> notify-exit f
] [ ] [
2drop f 2drop f
] if ] if

View File

@ -32,4 +32,4 @@ IN: unix.process
fork dup zero? -roll swap curry if ; inline fork dup zero? -roll swap curry if ; inline
: wait-for-pid ( pid -- status ) : wait-for-pid ( pid -- status )
0 <int> [ 0 waitpid drop ] keep *int ; 0 <int> [ 0 waitpid drop ] keep *int WEXITSTATUS ;

View File

@ -177,31 +177,39 @@ FUNCTION: int kill ( pid_t pid, int sig ) ;
! Flags for waitpid ! Flags for waitpid
: WNOHANG 1 ; : WNOHANG 1 ; inline
: WUNTRACED 2 ; : WUNTRACED 2 ; inline
: WSTOPPED 2 ; : WSTOPPED 2 ; inline
: WEXITED 4 ; : WEXITED 4 ; inline
: WCONTINUED 8 ; : WCONTINUED 8 ; inline
: WNOWAIT HEX: 1000000 ; : WNOWAIT HEX: 1000000 ; inline
! Examining status ! Examining status
: WTERMSIG ( status -- value ) HEX: 7f bitand ; : WTERMSIG ( status -- value )
HEX: 7f bitand ; inline
: WIFEXITED ( status -- ? ) WTERMSIG zero? ; : WIFEXITED ( status -- ? )
WTERMSIG zero? ; inline
: WEXITSTATUS ( status -- value ) HEX: ff00 bitand -8 shift ; : WEXITSTATUS ( status -- value )
HEX: ff00 bitand -8 shift ; inline
: WIFSIGNALED ( status -- ? ) HEX: 7f bitand 1+ -1 shift 0 > ; : WIFSIGNALED ( status -- ? )
HEX: 7f bitand 1+ -1 shift 0 > ; inline
: WCOREFLAG ( -- value ) HEX: 80 ; : WCOREFLAG ( -- value )
HEX: 80 ; inline
: WCOREDUMP ( status -- ? ) WCOREFLAG bitand zero? not ; : WCOREDUMP ( status -- ? )
WCOREFLAG bitand zero? not ; inline
: WIFSTOPPED ( status -- ? ) HEX: ff bitand HEX: 7f = ; : WIFSTOPPED ( status -- ? )
HEX: ff bitand HEX: 7f = ; inline
: WSTOPSIG ( status -- value ) WEXITSTATUS ; : WSTOPSIG ( status -- value )
WEXITSTATUS ; inline
FUNCTION: pid_t wait ( int* status ) ; FUNCTION: pid_t wait ( int* status ) ;
FUNCTION: pid_t waitpid ( pid_t wpid, int* status, int options ) ; FUNCTION: pid_t waitpid ( pid_t wpid, int* status, int options ) ;