Unix launcher: use execvp instead of execve

release
Slava Pestov 2007-09-22 02:27:53 -04:00
parent 88c2d21416
commit 2589c69c04
2 changed files with 4 additions and 4 deletions

View File

@ -9,16 +9,15 @@ USE: unix
: with-fork ( quot -- pid )
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
#! after forking.
[ malloc-char-string ] map
[ first ] keep
f add >c-void*-array
f ;
f add >c-void*-array ;
: (spawn-process) ( args -- )
[ prepare-execve execve ] catch 1 exit ;
[ prepare-execvp execvp ] catch 1 exit ;
: spawn-process ( args -- pid )
[ (spawn-process) ] [ drop ] with-fork ;

View File

@ -107,6 +107,7 @@ FUNCTION: void close ( int fd ) ;
FUNCTION: int connect ( int s, void* name, socklen_t namelen ) ;
FUNCTION: int dup2 ( int oldd, int newd ) ;
! FUNCTION: int dup ( int oldd ) ;
FUNCTION: int execvp ( char* path, char** argv ) ;
FUNCTION: int execve ( char* path, char** argv, char** envp ) ;
FUNCTION: int fchdir ( int fd ) ;
FUNCTION: int fchmod ( int fd, mode_t mode ) ;