diff options
Diffstat (limited to 'lib/include')
-rw-r--r-- | lib/include/common.h | 16 | ||||
-rw-r--r-- | lib/include/io.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/include/common.h b/lib/include/common.h new file mode 100644 index 0000000..5ea6050 --- /dev/null +++ b/lib/include/common.h @@ -0,0 +1,16 @@ +// Copyright (c) 2020 Johannes Stoelp + +#pragma once + +#include "io.h" +#include "syscall.h" + +#include <asm/unistd.h> + +#define ERROR_ON(cond, ...) \ + do { \ + if ((cond)) { \ + efmt(__VA_ARGS__); \ + syscall1(__NR_exit, 1); \ + } \ + } while (0) diff --git a/lib/include/io.h b/lib/include/io.h index 5ca78a3..0f8b900 100644 --- a/lib/include/io.h +++ b/lib/include/io.h @@ -3,3 +3,4 @@ #pragma once int pfmt(const char* fmt, ...); +int efmt(const char* fmt, ...); |