LOG_SYS_ERROR
- Macro
- October 8, 2025
Table of Contents
LOG_SYS_ERROR
LOG_SYS_ERROR
Description
Writes an error-level log message with errno
explanation appended at the end of final string.
Info
Think of this as perror()
with LOG
Success
Error message written to log output
Failure
Logging fails silently (output not guaranteed)
Usage example (Cross-references)
- In
Io.c:680
:
can_rollback = true;
} else {
LOG_SYS_ERROR("Could not save file position for rollback");
}
}
- In
Log.c:43
:
LOG_ERROR("Failed to get localtime : {}", syserr);
});
LOG_SYS_ERROR("Failed to get localtime");
goto LOG_STREAM_FALLBACK;
}
- In
File.c:53
:
if (e || !file) {
free(buffer);
LOG_SYS_ERROR("fopen() failed");
return false;
}
- In
File.c:60
:
if (fsize != (i64)fread(buffer, 1, fsize, file)) {
fclose(file);
LOG_SYS_ERROR("Failed to read complete file");
return false;
}
- In
Dir.c:128
:
DIR *dir = opendir(path);
if (NULL == dir) {
LOG_SYS_ERROR("opendir(\"{}\") failed", path);
return (SysDirContents) {0};
}
- In
Dir.c:195
:
HANDLE file = CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if (file == INVALID_HANDLE_VALUE) {
LOG_SYS_ERROR("CreateFileA() failed");
return -1;
}
- In
Dir.c:201
:
LARGE_INTEGER file_size;
if (!GetFileSizeEx(file, &file_size)) {
LOG_SYS_ERROR("GetFileSizeEx() failed");
CloseHandle(file);
return -1;
- In
Dir.c:214
:
return (i64)file_stat.st_size;
} else {
LOG_SYS_ERROR("stat() failed");
return -1;
}
- In
Proc.c:76
:
if (pipe(stdin_pipe) == -1 || pipe(stdout_pipe) == -1 || pipe(stderr_pipe) == -1) {
LOG_SYS_ERROR("pipe() failed");
if (stdin_pipe[READ_END])
close(stdin_pipe[READ_END]);
- In
Proc.c:94
:
pid_t pid = fork();
if (pid < 0) {
LOG_SYS_ERROR("fork");
close(stdin_pipe[READ_END]);
- In
Proc.c:125
:
// if continues then this is bad, execve failed
LOG_SYS_ERROR("execve() failed");
close(stdin_pipe[READ_END]);
- In
Proc.c:160
:
if (!CreatePipe(&hStdinRead, &hStdinWrite, &sa, 0) || !CreatePipe(&hStdoutRead, &hStdoutWrite, &sa, 0) ||
!CreatePipe(&hStderrRead, &hStderrWrite, &sa, 0)) {
LOG_SYS_ERROR("CreatePipe failed");
// Clean up only those handles that were successfully created
- In
Proc.c:200
:
if (!CreateProcessA(NULL, cmdline.data, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) {
LOG_SYS_ERROR("CreateProcessA() failed");
StrDeinit(&cmdline);
- In
Proc.c:344
:
#if defined(__APPLE__) || defined(__linux__)
if (-1 == kill(proc->pid, SIGTERM)) {
LOG_SYS_ERROR("kill(pid, SIGTERM) failed");
}
- In
Proc.c:350
:
int status;
if (-1 == waitpid(proc->pid, &status, 0)) {
LOG_SYS_ERROR("waitpid after SIGTERM failed");
return;
}
- In
Proc.c:366
:
#else
if (!TerminateProcess(proc->pi.hProcess, 1)) {
LOG_SYS_ERROR("TerminateProcess failed");
return;
}
- In
Proc.c:372
:
// Wait for it to actually exit
if (WAIT_FAILED == WaitForSingleObject(proc->pi.hProcess, INFINITE)) {
LOG_SYS_ERROR("WaitForSingleObject after TerminateProcess failed");
return;
}
- In
Proc.c:459
:
if (errno == EINTR)
continue; // retry on signal
LOG_SYS_ERROR("read failed");
total_read = -1;
break;
- In
Proc.c:478
:
if (!PeekNamedPipe(rhandle, NULL, 0, NULL, &available, NULL)) {
LOG_SYS_ERROR("PeekNamedPipe failed");
return -1;
}
- In
Proc.c:490
:
if (!ReadFile(rhandle, tmpbuf, 1023, &bytes_read, NULL)) {
LOG_SYS_ERROR("ReadFile failed");
return -1;
}