sourcecode

Wednesday, July 11, 2012

EXECVE(2)

$man 2 execve

NAME
       execve - execute program

SYNOPSIS
       #include

       int execve(const char *filename, char *const argv[],
                  char *const envp[]);



Also the man page points out:
*  Any   outstanding   asynchronous   I/O   operations   are   canceled.



  • If the execution is unsuccessful, execve returns with -1 and its calling process continues.
  • If the execution is successful, execve overwrites its calling process (the rest of the code in the calling process is not reached) and the exit status is the same as defined in the process calling execve. (Either case the exit status code is the same).

The envp does not seem to work well in execve(). It is suggested to use execvp() instead.

/**********************END**********************/

No comments: