Move some words from unix to unix.process
parent
d4172cca47
commit
09f4e4b032
|
@ -1,4 +1,4 @@
|
||||||
USING: kernel alien.c-types alien.strings sequences math unix
|
USING: kernel alien.c-types alien.strings sequences math alien.syntax unix
|
||||||
vectors kernel namespaces continuations threads assocs vectors
|
vectors kernel namespaces continuations threads assocs vectors
|
||||||
io.unix.backend io.encodings.utf8 ;
|
io.unix.backend io.encodings.utf8 ;
|
||||||
IN: unix.process
|
IN: unix.process
|
||||||
|
@ -7,6 +7,14 @@ IN: unix.process
|
||||||
! to implement io.launcher on Unix. User code should use
|
! to implement io.launcher on Unix. User code should use
|
||||||
! io.launcher instead.
|
! io.launcher instead.
|
||||||
|
|
||||||
|
FUNCTION: pid_t fork ( ) ;
|
||||||
|
|
||||||
|
: fork-process ( -- pid ) [ fork ] unix-system-call ;
|
||||||
|
|
||||||
|
FUNCTION: int execv ( char* path, char** argv ) ;
|
||||||
|
FUNCTION: int execvp ( char* path, char** argv ) ;
|
||||||
|
FUNCTION: int execve ( char* path, char** argv, char** envp ) ;
|
||||||
|
|
||||||
: >argv ( seq -- alien )
|
: >argv ( seq -- alien )
|
||||||
[ utf8 malloc-string ] map f suffix >c-void*-array ;
|
[ utf8 malloc-string ] map f suffix >c-void*-array ;
|
||||||
|
|
||||||
|
@ -29,7 +37,7 @@ IN: unix.process
|
||||||
>r [ first ] [ ] bi r> exec-with-env ;
|
>r [ first ] [ ] bi r> exec-with-env ;
|
||||||
|
|
||||||
: with-fork ( child parent -- )
|
: with-fork ( child parent -- )
|
||||||
fork dup io-error dup zero? -roll swap curry if ; inline
|
fork-process dup zero? -roll swap curry if ; inline
|
||||||
|
|
||||||
: wait-for-pid ( pid -- status )
|
: wait-for-pid ( pid -- status )
|
||||||
0 <int> [ 0 waitpid drop ] keep *int WEXITSTATUS ;
|
0 <int> [ 0 waitpid drop ] keep *int WEXITSTATUS ;
|
||||||
|
|
|
@ -77,9 +77,6 @@ FUNCTION: int close ( int fd ) ;
|
||||||
FUNCTION: int connect ( int s, void* name, socklen_t namelen ) ;
|
FUNCTION: int connect ( int s, void* name, socklen_t namelen ) ;
|
||||||
FUNCTION: int dup2 ( int oldd, int newd ) ;
|
FUNCTION: int dup2 ( int oldd, int newd ) ;
|
||||||
! FUNCTION: int dup ( int oldd ) ;
|
! FUNCTION: int dup ( int oldd ) ;
|
||||||
FUNCTION: int execv ( char* path, char** argv ) ;
|
|
||||||
FUNCTION: int execvp ( char* path, char** argv ) ;
|
|
||||||
FUNCTION: int execve ( char* path, char** argv, char** envp ) ;
|
|
||||||
: _exit ( status -- * )
|
: _exit ( status -- * )
|
||||||
#! We throw to give this a terminating stack effect.
|
#! We throw to give this a terminating stack effect.
|
||||||
"int" f "_exit" { "int" } alien-invoke "Exit failed" throw ;
|
"int" f "_exit" { "int" } alien-invoke "Exit failed" throw ;
|
||||||
|
@ -87,7 +84,6 @@ FUNCTION: int fchdir ( int fd ) ;
|
||||||
FUNCTION: int fchown ( int fd, uid_t owner, gid_t group ) ;
|
FUNCTION: int fchown ( int fd, uid_t owner, gid_t group ) ;
|
||||||
FUNCTION: int fcntl ( int fd, int cmd, int arg ) ;
|
FUNCTION: int fcntl ( int fd, int cmd, int arg ) ;
|
||||||
FUNCTION: int flock ( int fd, int operation ) ;
|
FUNCTION: int flock ( int fd, int operation ) ;
|
||||||
FUNCTION: pid_t fork ( ) ;
|
|
||||||
FUNCTION: void freeaddrinfo ( addrinfo* ai ) ;
|
FUNCTION: void freeaddrinfo ( addrinfo* ai ) ;
|
||||||
FUNCTION: int futimes ( int id, timeval[2] times ) ;
|
FUNCTION: int futimes ( int id, timeval[2] times ) ;
|
||||||
FUNCTION: char* gai_strerror ( int ecode ) ;
|
FUNCTION: char* gai_strerror ( int ecode ) ;
|
||||||
|
|
Loading…
Reference in New Issue