summaryrefslogtreecommitdiff
path: root/src/user/lib/stdlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/lib/stdlib.c')
-rw-r--r--src/user/lib/stdlib.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/user/lib/stdlib.c b/src/user/lib/stdlib.c
new file mode 100644
index 0000000..6018d16
--- /dev/null
+++ b/src/user/lib/stdlib.c
@@ -0,0 +1,32 @@
+#include <camellia/syscalls.h>
+#include <camellia/flags.h>
+#include <errno.h>
+#include <string.h>
+
+_Noreturn void abort(void) {
+ _syscall_exit(1);
+}
+
+int mkstemp(char *template) {
+ // TODO randomize template
+ handle_t h = _syscall_open(template, strlen(template), OPEN_CREATE);
+ if (h < 0) {
+ errno = -h;
+ return -1;
+ }
+ // TODO truncate
+ return h;
+}
+
+// TODO process env
+char *getenv(const char *name) {
+ (void)name;
+ return NULL;
+}
+
+// TODO system()
+int system(const char *cmd) {
+ (void)cmd;
+ errno = ENOSYS;
+ return -1;
+}