getpid/getppid

自分または親のプロセスID

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

#include 

int
main()
{
    pid_t pid, ppid;
    
    pid = getpid();
    ppid = getppid();
    
    printf("pid = %d, ppid = %d\n", (int)pid, (int)ppid);
    return 0;
}