add test case for the system call "getpid"

This commit is contained in:
Stefan Lankes 2012-04-24 20:44:25 +02:00
parent 21e113c53a
commit e6816bb0bd

View file

@ -28,7 +28,7 @@
int main(int argc, char** argv)
{
int status = 0;
pid_t pid;
pid_t pid, mypid = getpid();
printf("Create child process...\n");
@ -37,12 +37,14 @@ int main(int argc, char** argv)
char* newargs[] = {"/bin/hello", "one", "two", "three", NULL};
char* newenv[] = {"USER=root", "PATH=/bin:/sbin:/usr/bin", "PWD=/", "TEMP=/tmp", NULL};
printf("Hello from child process!\n");
mypid = getpid();
printf("Hello from child process! mypid = %u\n", mypid);
execve("/bin/hello", newargs, newenv);
return errno;
} else {
printf("Hello from parent process! pid = %u\n", pid);
mypid = getpid();
printf("Hello from parent process! pid = %u, mypid = %u\n", pid, mypid);
wait(&status);
printf("Child terminated with status %d\n", status);
}