summaryrefslogtreecommitdiff
path: root/src/nonstd/SYSCALL.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nonstd/SYSCALL.c')
-rw-r--r--src/nonstd/SYSCALL.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nonstd/SYSCALL.c b/src/nonstd/SYSCALL.c
new file mode 100644
index 00000000..4c04ab1b
--- /dev/null
+++ b/src/nonstd/SYSCALL.c
@@ -0,0 +1,11 @@
+#include <nonstd/syscall.h>
+
+#define SYSCALL(_name, _type, ...)
+ static int _scno = -2; \
+ if (_scno == -2) { _scno = ((syscall_lookup_t)__libc(SYSCALL_LOOKUP))(_name); } \
+ _type _ret = __syscall(_scno, __VA_ARGS__); \
+ if (_ret < 0) { \
+ errno = -_ret; \
+ return -1; \
+ } \
+ return _ret