summaryrefslogtreecommitdiff
path: root/src/user/lib/fcntl.c
blob: b2d86856ffac2670978028bcb1e7ad12373dbae0 (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
#include <bits/panic.h>
#include <camellia.h>
#include <camellia/syscalls.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>

#include <stdio.h>

int open(const char *path, int flags, ...) {
	(void)path; (void)flags;
	_klogf("failing open(\"%s\")", path);
	return errno = ENOSYS, -1;
}

int fcntl(int fd, int cmd, ...) {
	va_list argp;
	va_start(argp, cmd);
	if (cmd == F_DUPFD) {
		int to = va_arg(argp, int);
		va_end(argp);
		return _sys_dup(fd, to, DUP_SEARCH);
	} else {
		va_end(argp);
		_klogf("failing fcntl(%d)", cmd);
		return errno = ENOSYS, -1;
	}
}