LOG_SYS_ERROR
Description
Writes an error-level log message with the caller-supplied system error code explained. See LOG_SYS_FATAL for the errno-passing rationale.
Parameters
| Name | Direction | Description |
|---|---|---|
eno |
in | System error code. |
Success
Message + decoded error description written to fd 2.
Failure
Formatter / FileWrite errors are dropped silently.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Page.c:578:
long ret = direct_sys3(MISRA_SYS_mprotect, (long)(u64)ptr, (long)bytes, (long)posix_prot);
if (ret != 0) {
LOG_SYS_ERROR(ErrnoOf((i32)ret), "PageProtect: mprotect failed");
return false;
}- In
Page.c:586:
// off): mprotect returns -1 and the system error is recovered
// through ErrnoOf below.
LOG_SYS_ERROR(ErrnoOf(-1), "PageProtect: mprotect failed");
return false;
}- In
Socket.c:119:
// syscall it carries -errno directly; on libSystem (macOS) the value
// is -1 and errno is set. ErrnoOf papers over the difference.
# define LOG_SOCK_ERROR(ret, msg) LOG_SYS_ERROR(ErrnoOf(ret), msg)
#endif // PLATFORM_WINDOWS
- In
Proc.c:127:
pipe_ret = proc_pipe(stderr_pipe);
if (pipe_ret < 0) {
LOG_SYS_ERROR(ErrnoOf(pipe_ret), "proc_pipe() failed");
if (stdin_pipe[READ_END] >= 0)
direct_sys1(MISRA_SYS_close, (long)(stdin_pipe[READ_END]));- In
Proc.c:145:
pid_t pid = proc_fork();
if (pid < 0) {
LOG_SYS_ERROR(ErrnoOf(pid), "fork");
direct_sys1(MISRA_SYS_close, (long)(stdin_pipe[READ_END]));
direct_sys1(MISRA_SYS_close, (long)(stdout_pipe[READ_END]));- In
Proc.c:171:
// immediately via SYS_exit_group (127 is the conventional shell
// "command not found" / exec-failed status).
LOG_SYS_ERROR(ErrnoOf(exec_ret), "execve() failed");
(void)direct_sys1(MISRA_SYS_exit_group, 127);
// exit_group does not return; the unreachable proc return is
- In
Proc.c:274:
long wait_ret = direct_sys4(MISRA_SYS_wait4, (long)(proc->_pid), (long)(u64)(&status), (long)(0), 0);
if (wait_ret < 0) {
LOG_SYS_ERROR(ErrnoOf(wait_ret), "Failed to wait for child process");
return PROC_STATUS_ERROR;
}- In
Proc.c:398:
long kill_ret = direct_sys2(MISRA_SYS_kill, (long)(proc->_pid), (long)(SIGTERM));
if (kill_ret < 0) {
LOG_SYS_ERROR(ErrnoOf(kill_ret), "direct_sys2(MISRA_SYS_kill, (long)(pid), (long)(SIGTERM)) failed");
}- In
Proc.c:405:
long wait_ret = direct_sys4(MISRA_SYS_wait4, (long)(proc->_pid), (long)(u64)(&status), (long)(0), 0);
if (wait_ret < 0) {
LOG_SYS_ERROR(ErrnoOf(wait_ret), "waitpid after SIGTERM failed");
return;
}- In
Proc.c:517:
continue;
# endif
LOG_SYS_ERROR(ErrnoOf(n), "read failed");
total_read = -1;
break;- In
Dir.c:226:
# endif
if (fd < 0) {
LOG_SYS_ERROR(ErrnoOf(fd), "DirGetContents: open(\"{}\")", path);
return dc;
}- In
Dir.c:246:
}
if (n < 0) {
LOG_SYS_ERROR(ErrnoOf(n), "DirGetContents: getdents64");
break;
}- In
Dir.c:317:
# endif
if (fd < 0) {
LOG_SYS_ERROR(ErrnoOf(fd), "FileGetSize: open(\"{}\")", filename);
return -1;
}- In
Dir.c:323:
(void)direct_sys1(MISRA_SYS_close, fd);
if (sz < 0) {
LOG_SYS_ERROR(ErrnoOf(sz), "FileGetSize: lseek on \"{}\"", filename);
return -1;
}- In
Dir.c:360:
# endif
if (ret < 0) {
LOG_SYS_ERROR(ErrnoOf(ret), "FileRemove(\"{}\")", path);
return 0;
}- In
Dir.c:389:
# endif
if (ret < 0) {
LOG_SYS_ERROR(ErrnoOf(ret), "DirRemove(\"{}\")", path);
return 0;
}- In
Dir.c:428:
# endif
if (ret < 0) {
LOG_SYS_ERROR(ErrnoOf(ret), "DirCreate(\"{}\")", path);
return 0;
}
Last updated on