UNIX process id trace

Joe Peterson peterson at Data-IO.COM
Wed Oct 10 09:59:47 AEST 1990


I have a simple question:

Is there a way to get the parent process id of any arbitrary
process id?  I know of getpid() and getppid(), but those only
operate on the current process.

I want to build a pid trace for the current process such as

        long pidtrace[REALLYBIG];
        long pid;
        int i;

        i=0;
        pid = getpid();

        while(pid != BOOTPROCESS)
        {
                pidtrace[i] = pid;

                ++i;
                pid = parentpid(pid);
        }

where parentpid() is the magic function that I can't find.

Any ideas?

Joe Peterson
peterson at Data-IO.COM



More information about the Comp.unix.questions mailing list