#include <sys/types.h> #include <unistd.h> pid_t getppid(void);
getppid
determines the process ID of the parent process.
getppid
returns the process ID of the parent
process.
Under
unusual conditions (for instance, if OpenEdition is not running)
getppid
can fail. In this case, getppid
issues an MVS user ABEND 1230
to indicate the error.
getppid
to
determine the process ID of a parent process:
#include <sys/types.h> #include <unistd.h> #include <signal.h> #include <sdtlib.h> . . . if (fork() == 0) { printf("Child process is sending SIGUSR2 to pid %d\n", (int) getppid()); kill(getppid(), SIGUSR2); exit(0); } . . .
Note:
Also see the setpgid
example.
getpid
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.