summaryrefslogtreecommitdiff
path: root/src/libc/syscall.c
blob: 2366a9f9b5c6fef0611fb4a24fe97fc266679735 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/* generated by syscall.c.awk
 * don't modify manually, instead run:
 *     make src/user/lib/syscall.c
 */
#include <camellia/syscalls.h>


_Noreturn void _sys_exit(long ret) {
	_syscall(_SYS_EXIT, ret, 0, 0, 0, 0);
	__builtin_unreachable();
}

long _sys_fork(int flags, hid_t __user *fs_front) {
	return _syscall(_SYS_FORK, (long)flags, (long)fs_front, 0, 0, 0);
}

hid_t _sys_open(const char __user *path, long len, int flags) {
	return (hid_t)_syscall(_SYS_OPEN, (long)path, len, (long)flags, 0, 0);
}

long _sys_mount(hid_t h, const char __user *path, long len) {
	return _syscall(_SYS_MOUNT, (long)h, (long)path, len, 0, 0);
}

hid_t _sys_dup(hid_t from, hid_t to, int flags) {
	return (hid_t)_syscall(_SYS_DUP, (long)from, (long)to, (long)flags, 0, 0);
}

long _sys_read(hid_t h, void __user *buf, size_t len, long offset) {
	return _syscall(_SYS_READ, (long)h, (long)buf, (long)len, offset, 0);
}

long _sys_write(hid_t h, const void __user *buf, size_t len, long offset, int flags) {
	return _syscall(_SYS_WRITE, (long)h, (long)buf, (long)len, offset, (long)flags);
}

long _sys_getsize(hid_t h) {
	return _syscall(_SYS_GETSIZE, (long)h, 0, 0, 0, 0);
}

long _sys_remove(hid_t h) {
	return _syscall(_SYS_REMOVE, (long)h, 0, 0, 0, 0);
}

long _sys_close(hid_t h) {
	return _syscall(_SYS_CLOSE, (long)h, 0, 0, 0, 0);
}

hid_t _sys_fs_wait(char __user *buf, long max_len, struct ufs_request __user *res) {
	return (hid_t)_syscall(_SYS_FS_WAIT, (long)buf, max_len, (long)res, 0, 0);
}

long _sys_fs_respond(hid_t hid, const void __user *buf, long ret, int flags) {
	return _syscall(_SYS_FS_RESPOND, (long)hid, (long)buf, ret, (long)flags, 0);
}

void __user *_sys_memflag(void __user *addr, size_t len, int flags) {
	return (void __user *)_syscall(_SYS_MEMFLAG, (long)addr, (long)len, (long)flags, 0, 0);
}

long _sys_pipe(hid_t __user user_ends[2], int flags) {
	return _syscall(_SYS_PIPE, (long)user_ends, (long)flags, 0, 0, 0);
}

void _sys_sleep(long ms) {
	return (void)_syscall(_SYS_SLEEP, ms, 0, 0, 0, 0);
}

int _sys_intr(const char __user *msg, size_t len) {
	return (int)_syscall(_SYS_INTR, (long)msg, (long)len, 0, 0, 0);
}

void _sys_intr_set(void __user *ip) {
	return (void)_syscall(_SYS_INTR_SET, (long)ip, 0, 0, 0, 0);
}

uint32_t _sys_getpid(void) {
	return (uint32_t)_syscall(_SYS_GETPID, 0, 0, 0, 0, 0);
}

uint32_t _sys_getppid(void) {
	return (uint32_t)_syscall(_SYS_GETPPID, 0, 0, 0, 0, 0);
}

int _sys_wait2(int pid, int flags, struct sys_wait2 __user *out) {
	return (int)_syscall(_SYS_WAIT2, (long)pid, (long)flags, (long)out, 0, 0);
}

hid_t _sys_getprocfs(int flags) {
	return (hid_t)_syscall(_SYS_GETPROCFS, (long)flags, 0, 0, 0, 0);
}

uint64_t _sys_time(int flags) {
	return (uint64_t)_syscall(_SYS_TIME, (long)flags, 0, 0, 0, 0);
}

hid_t _sys_getnull(int flags) {
	return (hid_t)_syscall(_SYS_GETNULL, (long)flags, 0, 0, 0, 0);
}

long _sys_duplex(hid_t from, hid_t to, int flags) {
	return _syscall(_SYS_DUPLEX, (long)from, (long)to, (long)flags, 0, 0);
}

void _sys_intr_return(struct intr_data __user *intr, int flags) {
	return (void)_syscall(_SYS_INTR_RETURN, (long)intr, (long)flags, 0, 0, 0);
}

ssize_t _sys_getxattr(hid_t h, const char __user *name, void __user *buf, size_t len, int flags) {
	return (ssize_t)_syscall(_SYS_GETXATTR, (long)h, (long)name, (long)buf, (long)len, (long)flags);
}

ssize_t _sys_setxattr(hid_t h, const char __user *name, const void __user *buf, size_t len, int flags) {
	return (ssize_t)_syscall(_SYS_SETXATTR, (long)h, (long)name, (long)buf, (long)len, (long)flags);
}

long _sys_execbuf(void __user *buf, size_t len) {
	return _syscall(_SYS_EXECBUF, (long)buf, (long)len, 0, 0, 0);
}

void _sys_debug_klog(const void __user *buf, size_t len) {
	return (void)_syscall(_SYS_DEBUG_KLOG, (long)buf, (long)len, 0, 0, 0);
}