summaryrefslogtreecommitdiff
path: root/lib/mlibc/sysdeps/keyronex/generic/linux.cpp
blob: 9b4a4c7d0c6b69320eeb91e769d464270d712ad5 (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
#include <sys/types.h>

#include <keyronex/syscall.h>
#include <mlibc/ansi-sysdeps.hpp>
#include <mlibc/debug.hpp>
#include <mlibc/posix-sysdeps.hpp>
#include <mlibc/linux-sysdeps.hpp>

namespace mlibc {

int
sys_epoll_pwait(int epfd, struct epoll_event *ev, int n, int timeout,
    const sigset_t *sigmask, int *raised)
{
	uintptr_t ret = syscall5(kPXSysEPollWait, epfd, (uintptr_t)ev, n,
	    timeout, (uintptr_t)sigmask, NULL);
	if (int e = sc_error(ret); e)
		return e;
	*raised = ret;
	return 0;
}

int
sys_epoll_create(int flags, int *fd)
{
	uintptr_t ret = syscall1(kPXSysEPollCreate, flags, NULL);
	if (int e = sc_error(ret); e)
		return e;
	*fd = ret;
	return 0;
}

int
sys_epoll_ctl(int epfd, int mode, int fd, struct epoll_event *ev)
{
	uintptr_t ret = syscall4(kPXSysEPollCtl, epfd, mode, fd, (uintptr_t)ev,
	    NULL);
	return sc_error(ret);
}

}