extending of our test program
=> using of the system call "execve"
This commit is contained in:
parent
e9e2a0bd01
commit
8dd37885cb
2 changed files with 5 additions and 2 deletions
|
@ -36,8 +36,10 @@ int main(int argc, char** argv)
|
|||
|
||||
pid = fork();
|
||||
if (pid == 0) { // child
|
||||
char* args[] = {"/bin/hello", (char*) 0};
|
||||
|
||||
printf("Hello from child process!\n");
|
||||
exit(42);
|
||||
execve("/bin/hello", args, environ);
|
||||
} else {
|
||||
printf("Hello from parent process! pid = %u\n", pid);
|
||||
wait(&status);
|
||||
|
|
|
@ -17,5 +17,6 @@
|
|||
* This file is part of MetalSVM.
|
||||
*/
|
||||
|
||||
char *__env[1] = { 0 };
|
||||
/* default environment */
|
||||
char *__env[] = { "USER=root", "PATH=/bin:/sbin:/usr/bin", "PWD=/", (char *) 0 };
|
||||
char **environ = __env;
|
||||
|
|
Loading…
Add table
Reference in a new issue