summaryrefslogtreecommitdiff
path: root/src/user/lib/stdlib.c
blob: 6018d169eea4dac9f320755aa11ffb2ca04712c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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;
}