summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-02-23 15:21:37 -0500
committerJakob Kaivo <jkk@ung.org>2019-02-23 15:21:37 -0500
commit78aa2fc7871a4f79613d38122dc6d5ac7454f57c (patch)
tree80afa3bbe1517f0ac6be475756d68a2739159edc /src
parent1626e67cc4e19935d89fbb6f8fb202f9c5a92dd3 (diff)
merge SYSCALL macros into one
Diffstat (limited to 'src')
-rw-r--r--src/nonstd/SYSCALL.c8
-rw-r--r--src/nonstd/SYSCALL0.c11
-rw-r--r--src/nonstd/SYSCALL_NOFAIL.c6
3 files changed, 4 insertions, 21 deletions
diff --git a/src/nonstd/SYSCALL.c b/src/nonstd/SYSCALL.c
index 8f91d870..b5cab01c 100644
--- a/src/nonstd/SYSCALL.c
+++ b/src/nonstd/SYSCALL.c
@@ -1,11 +1,11 @@
#include <nonstd/syscall.h>
-#define SYSCALL(_name, _type, _args) \
+#define SYSCALL(_name, _type, _err, _a1, _a2, _a3, _a4, _a5, _a6) \
static int _scno = -2; \
if (_scno == -2) { _scno = ((syscall_lookup_t)__libc(SYSCALL_LOOKUP))(_name); } \
- _type _ret = __syscall(_scno, _args); \
+ long _ret = __syscall(_scno, _a1, _a2, _a3, _a4, _a5, _a6); \
if (_ret < 0) { \
errno = -_ret; \
- return -1; \
+ return _err; \
} \
- return _ret
+ return (_type)_ret
diff --git a/src/nonstd/SYSCALL0.c b/src/nonstd/SYSCALL0.c
deleted file mode 100644
index c9359035..00000000
--- a/src/nonstd/SYSCALL0.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <nonstd/syscall.h>
-
-#define SYSCALL0(_name, _type) \
- static int _scno = -2; \
- if (_scno == -2) { _scno = ((sycall_lookup_t)__libc(LOOKUP))(_name); } \
- _type _ret = __syscall(_scno); \
- if (_ret < 0) { \
- errno = -_ret; \
- return -1; \
- } \
- return _ret
diff --git a/src/nonstd/SYSCALL_NOFAIL.c b/src/nonstd/SYSCALL_NOFAIL.c
deleted file mode 100644
index e609e76d..00000000
--- a/src/nonstd/SYSCALL_NOFAIL.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <nonstd/syscall.h>
-
-#define SYSCALL_NOFAIL(_name) \
- static int _scno = -2; \
- if (_scno == -2) { _scno = __libc(SYSCALL_LOOKUP)(_name); } \
- return __libc(SYSCALL)(_scno)