SysGetCurrentProcessId

Table of Contents

SysGetCurrentProcessId

Description

Platform independent method to get current process Id.

Success

Returns current process ID.

Failure

Function cannot fail - always returns valid ID.

Usage example (Cross-references)

    // generate log file name
    Str file_name = StrInit();
    StrWriteFmt(&file_name, "{}/misra-{}-{}", log_dir, SysGetCurrentProcessId(), &time_buffer[0]);
    FWriteFmtLn(stderr, "storing logs in {}", file_name.data);
    }
    
    SysProcId SysGetCurrentProcessId(void) {
    #ifdef _WIN32
    return (SysProcId)GetCurrentProcessId(); // Windows API

Share :

Related Posts

LogDeinit

LogDeinit Description Shut down logging subsystem and release resources

Read More

LOG_SYS_FATAL

LOG_SYS_FATAL Description Writes a fatal log message and aborts the program, with errno explanation appended at the end of final string.

Read More

LOG_SYS_ERROR

LOG_SYS_ERROR Description Writes an error-level log message with errno explanation appended at the end of final string.

Read More