From e6584db26da34572fb13aa236e16e19f71c8e976 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 26 Aug 2022 14:16:16 +0200 Subject: user/libc: prepare for OpenED port --- src/user/lib/stdlib.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/user/lib/stdlib.c (limited to 'src/user/lib/stdlib.c') 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 +#include +#include +#include + +_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; +} -- cgit v1.2.3