summaryrefslogtreecommitdiff
path: root/include/unistd.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/unistd.h')
-rw-r--r--include/unistd.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/include/unistd.h b/include/unistd.h
index 746c829..ef6d059 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -3,6 +3,11 @@
#include <stdint.h>
+#ifndef _SSIZE_T
+#define _SSIZE_T
+typedef int32_t ssize_t;
+#endif
+
typedef uint16_t pid_t;
#define __SYS_puts 0
@@ -13,6 +18,7 @@ typedef uint16_t pid_t;
#define __SYS_alarm 5
#define __SYS_pause 6
#define __SYS_ctty 7
+#define __SYS_read 8
#define _syscall0(type, name) \
type name(void) { \
@@ -21,7 +27,7 @@ typedef uint16_t pid_t;
"int $0x80" \
: "=a" (__res) \
: "a" (__SYS_##name) \
- :); \
+ ); \
return __res; \
}
@@ -32,7 +38,18 @@ typedef uint16_t pid_t;
"int $0x80" \
: "=a" (__res) \
: "a" (__SYS_##name), "b" (a) \
- :); \
+ ); \
+ return __res; \
+ }
+
+#define _syscall2(type, name, atype, a, btype, b) \
+ type name(atype a, btype b) { \
+ type __res; \
+ __asm__ volatile ( \
+ "int $0x80" \
+ : "=a" (__res) \
+ : "a" (__SYS_##name), "b" (a), "c" (b) \
+ ); \
return __res; \
}