SYSFATAL(3)

πŸ“¦ version 0_git20260208, in alpine 3.24, arch rolling, nixos 26.05, nixpkgs unstable

πŸ’– SYSFATAL(3) β€” Library Functions Manual, bestie πŸ’–

Okay so this page is all about syslog and sysfatal, the system-error-message duo. No cap, every detail is here. ✨

🌸 NAME 🌸

  • syslog, sysfatal β€” system error messages, aka the little error-message besties you need to know about.

✨ SYNOPSIS ✨

#include <u.h>
#include <libc.h>

void syslog(int cons, char *logname, char *fmt, ...)

void sysfatal(char *fmt, ...)

πŸ¦‹ DESCRIPTION πŸ¦‹

πŸ’… sysfatal β€” the dramatic exit

sysfatal prints to standard error, in order: the name of the running program, a colon and a space, the message described by the print(3) format string fmt plus any following arguments, and a newline. Then it calls exits(3) with the formatted message as the argument. Iconic behavior, honestly. πŸ‘‘

The program's name is the value of argv0, and that gets set if the program uses the arg(3) interface to process its arguments. If argv0 is null, it is ignored and the following colon and space are suppressed. So no name, no colon-space situation β€” periodt.

πŸͺ΅ syslog β€” the lowkey logger

syslog logs messages in the file named by logname in the directory /log. The file must already exist and is opened append-only. logname must contain no slashes. This is not a suggestion, bestie β€” no slashes, fr fr. 🚫

Each message is a line with several fields:

  1. the name of the machine writing the message
  2. the date and time
  3. the message specified by the print(3) format fmt and any following arguments
  4. a final newline

If cons is set or the log file cannot be opened, the message is also printed on the system console. And good news: syslog can be used safely in multi-threaded programs. Slay for thread safety. 🧚✨

πŸ”₯ SOURCE πŸ”₯

  • /src/lib9/sysfatal.c
  • /src/lib9/syslog.c

🌈 SEE ALSO 🌈


Cute sign-off: footer says SYSFATAL(3) β€” that's the source/version/date line we got, and we're out. πŸ’–πŸ’…βœ¨