overhaul syscall interface
[musl] / src / internal / syscall_ret.c
diff --git a/src/internal/syscall_ret.c b/src/internal/syscall_ret.c
new file mode 100644 (file)
index 0000000..4f159e0
--- /dev/null
@@ -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;
+}