Skip to content

Commit d51b195

Browse files
authored
Clarify getppid documentation: explain how None can occur (#1209)
The `getppid` syscall can never fail, but rustix returns PID 0 as `None`.
1 parent be89cb7 commit d51b195

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/process/id.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ pub fn getpid() -> Pid {
113113

114114
/// `getppid()`—Returns the parent process' ID.
115115
///
116+
/// This will return `None` if the current process has no parent (or no parent accessible in the
117+
/// current PID namespace), such as if the current process is an init process (PID 1).
118+
///
116119
/// # References
117120
/// - [POSIX]
118121
/// - [Linux]

0 commit comments

Comments
 (0)