Unix launcher: use execvp instead of execve
parent
88c2d21416
commit
2589c69c04
|
@ -9,16 +9,15 @@ USE: unix
|
||||||
: with-fork ( quot -- pid )
|
: with-fork ( quot -- pid )
|
||||||
fork [ zero? -rot if ] keep ; inline
|
fork [ zero? -rot if ] keep ; inline
|
||||||
|
|
||||||
: prepare-execve ( args -- cmd args envp )
|
: prepare-execvp ( args -- cmd args )
|
||||||
#! Doesn't free any memory, so we only call this word
|
#! Doesn't free any memory, so we only call this word
|
||||||
#! after forking.
|
#! after forking.
|
||||||
[ malloc-char-string ] map
|
[ malloc-char-string ] map
|
||||||
[ first ] keep
|
[ first ] keep
|
||||||
f add >c-void*-array
|
f add >c-void*-array ;
|
||||||
f ;
|
|
||||||
|
|
||||||
: (spawn-process) ( args -- )
|
: (spawn-process) ( args -- )
|
||||||
[ prepare-execve execve ] catch 1 exit ;
|
[ prepare-execvp execvp ] catch 1 exit ;
|
||||||
|
|
||||||
: spawn-process ( args -- pid )
|
: spawn-process ( args -- pid )
|
||||||
[ (spawn-process) ] [ drop ] with-fork ;
|
[ (spawn-process) ] [ drop ] with-fork ;
|
||||||
|
|
|
@ -107,6 +107,7 @@ FUNCTION: void 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 execvp ( char* path, char** argv ) ;
|
||||||
FUNCTION: int execve ( char* path, char** argv, char** envp ) ;
|
FUNCTION: int execve ( char* path, char** argv, char** envp ) ;
|
||||||
FUNCTION: int fchdir ( int fd ) ;
|
FUNCTION: int fchdir ( int fd ) ;
|
||||||
FUNCTION: int fchmod ( int fd, mode_t mode ) ;
|
FUNCTION: int fchmod ( int fd, mode_t mode ) ;
|
||||||
|
|
Loading…
Reference in New Issue