rajeshkb
rajeshkb

Reputation: 41

proc entry for a process

I have a piece of code to do execvp.

if (0 != child_pid) {
    /* Parent Process */
    printf("This is parent process: PID: %d\n",getpid());
    return child_pid;
} else {
    /* Child Process */
    printf("This is child process: PID: %d\n",getpid());
    printf("Parent process is: PPID: %d\n",getppid());
    execvp(program,arg_list);
    printf("Checking whether execvp fails/control reaches this line\n");
    fprintf(stderr,"An Error occurred during execvp\n");
    abort();
}

After getting the process id (printed via getpid()), i searched the /proc/$PID. But am not getting entry for this process. What does it mean?. Will /proc entries will get cleared once the process gets killed.?

Upvotes: 1

Views: 127

Answers (1)

Wyzard
Wyzard

Reputation: 34563

/proc only contains entries for processes that currently exist. It sounds like your process has terminated and no longer exists by the time you go looking for it in /proc.

Upvotes: 1

Related Questions