Skip to content

Commit

Permalink
Clarify getppid documentation: explain how None can occur (#1209)
Browse files Browse the repository at this point in the history
The `getppid` syscall can never fail, but rustix returns PID 0 as
`None`.
  • Loading branch information
joshtriplett authored Nov 9, 2024
1 parent be89cb7 commit d51b195
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/process/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ pub fn getpid() -> Pid {

/// `getppid()`—Returns the parent process' ID.
///
/// This will return `None` if the current process has no parent (or no parent accessible in the
/// current PID namespace), such as if the current process is an init process (PID 1).
///
/// # References
/// - [POSIX]
/// - [Linux]
Expand Down

0 comments on commit d51b195

Please sign in to comment.