Chapter Contents

Previous

Next
getppid

getppid



Determine Parent Process ID

Portability: POSIX.1 conforming, UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
EXAMPLE
RELATED FUNCTIONS


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 USS is not running) getppid can fail. In this case, getppid issues an OS/390 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.  [cautionend]


RELATED FUNCTIONS

getpid


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.