From a8b2282eb88f24c3c5f461e1557fa2cf76ebc251 Mon Sep 17 00:00:00 2001 From: turret Date: Sun, 19 Nov 2023 18:57:55 -0600 Subject: Initial commit - create subsystem system using clone syscall, shared memory, shared file descriptors - printk-like logging facility (TODO: console loglevel) - initcall system (like linux kernel) TODO: determine license factors: linker.ld, linux kernel licensing (some ideas are more liberally taken rather than paraphrased) --- init/util.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 init/util.c (limited to 'init/util.c') diff --git a/init/util.c b/init/util.c new file mode 100644 index 0000000..1a08234 --- /dev/null +++ b/init/util.c @@ -0,0 +1,22 @@ +#include +#include +#include +#include + +void die(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + + if(fmt[0] && fmt[strlen(fmt)-1] == ':') { + fputc(' ', stderr); + perror(NULL); + } else { + fputc('\n', stderr); + } + + exit(1); +} -- cgit v1.2.3