summaryrefslogtreecommitdiff
path: root/src/internal/syscall_ret.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal/syscall_ret.c')
-rw-r--r--src/internal/syscall_ret.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/internal/syscall_ret.c b/src/internal/syscall_ret.c
new file mode 100644
index 00000000..4f159e0b
--- /dev/null
+++ b/src/internal/syscall_ret.c
@@ -0,0 +1,11 @@
+#include <errno.h>
+#include <unistd.h>
+
+long __syscall_ret(unsigned long r)
+{
+ if (r >= (unsigned long)-1 - 4096) {
+ errno = -(long)r;
+ return -1;
+ }
+ return (long)r;
+}