From e6816bb0bd2db83c64b10468bbc0cdf50c0cf1c5 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Tue, 24 Apr 2012 20:44:25 +0200 Subject: [PATCH] add test case for the system call "getpid" --- newlib/examples/tests.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/newlib/examples/tests.c b/newlib/examples/tests.c index 3f5252d3..5d510389 100644 --- a/newlib/examples/tests.c +++ b/newlib/examples/tests.c @@ -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); }