getppid -- Determine Parent Process ID

SYNOPSIS

 #include <sys/types.h>
 #include <unistd.h>

 pid_t getppid(void);
 

DESCRIPTION

getppid determines the process ID of the parent process.

RETURN VALUE

If successful, 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.

EXAMPLE

The following code fragment illustrates the use of 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.

RELATED FUNCTIONS

getpid


Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.