From 799261f0f0ada509bb3c82be49a6e55e62590799 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Fri, 8 Nov 2024 06:49:02 -0800 Subject: [PATCH] Clarify `getppid` documentation: explain how `None` can occur The `getppid` syscall can never fail, but rustix returns PID 0 as `None`. --- src/process/id.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/process/id.rs b/src/process/id.rs index 0df14a8c4..16f16b126 100644 --- a/src/process/id.rs +++ b/src/process/id.rs @@ -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]