Skip to content
ProcGetCurrentId

ProcGetCurrentId

Description

Platform-independent method to get current process Id. Foundation API: provided by Sys.c (always built), unlike the rest of the process-spawning functions in Sys/Proc.h which live in the optional sys_proc feature.

Success

Returns current process ID.

Failure

Function cannot fail - always returns valid ID.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    ProcId ProcGetCurrentId(void) {
    #if PLATFORM_WINDOWS
        // kernel32.dll, not libc.
        return (ProcId)direct_sys0(MISRA_SYS_getpid);
    #else
    #    error "ProcGetCurrentId: unsupported platform/architecture (no direct-syscall path)"
    #endif
    }
Last updated on