Skip to content

Commit

Permalink
Clarify getppid documentation: explain how None can occur
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 committed Nov 9, 2024
1 parent be89cb7 commit 799261f
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 799261f

Please sign in to comment.