extending of our test program

=> using of the system call "execve"
This commit is contained in:
Stefan Lankes 2011-03-03 10:31:17 +01:00
parent e9e2a0bd01
commit 8dd37885cb
2 changed files with 5 additions and 2 deletions

View file

@ -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);

View file

@ -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;