⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

sys_getpid

Function sys_getpid 

Source
pub fn sys_getpid() -> u64
Expand description

Return the PID of the calling process.

Retrieves the unique process identifier for the currently executing process. This is a lightweight operation that always succeeds; the PID is read directly from the current process control block and requires no capability checks.

The PID is assigned at process creation time by sys_fork and remains constant for the lifetime of the process. PID 0 is reserved for the idle/swapper process and PID 1 is reserved for the init process.

§Returns

The process ID of the calling process as an unsigned 64-bit integer. This call always succeeds and never returns an error.

§Examples

use veridian_kernel::pkg::sdk::syscall_api::sys_getpid;

let my_pid = sys_getpid();
// my_pid is the unique identifier for this process