Does getppid Refers to Parent OR Real Parent?



I’m confused about the getppid syscall in linux.

Does it return the pid of the process that spawned it or the current parent (which could be different if the original parent exited)?


getppid returns the pid of the parent process at the time of the call. If a process is reparented (eg: through an explicit syscall to do so or because the parent process exited), the value returned will change accordingly.

Answered By – Jeremy Huddleston Sequoia

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More