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)
- In
Sys.c:97:
}
ProcId ProcGetCurrentId(void) {
#ifdef _WIN32
return (ProcId)GetCurrentProcessId();- In
Log.c:66:
if (GetEnv("TMP", &log_dir) || GetEnv("TEMP", &log_dir) || GetEnv("TMPDIR", &log_dir) ||
GetEnv("TEMPDIR", &log_dir) || GetEnv("PWD", &log_dir)) {
StrWriteFmt(&file_name, "{}/misra-{}-{}", log_dir, ProcGetCurrentId(), &time_buffer[0]);
FWriteFmtLn(stderr, "storing logs in {}", file_name.data);
Last updated on