summaryrefslogtreecommitdiff
path: root/Libraries/LibC/serenity.cpp
blob: 379036f9199bcdd700d3199dabb25f50cf7112f3 (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
#include <Kernel/Syscall.h>
#include <errno.h>
#include <serenity.h>

extern "C" {

int module_load(const char* path, size_t path_length)
{
    int rc = syscall(SC_module_load, path, path_length);
    __RETURN_WITH_ERRNO(rc, rc, -1);
}

int module_unload(const char* name, size_t name_length)
{
    int rc = syscall(SC_module_unload, name, name_length);
    __RETURN_WITH_ERRNO(rc, rc, -1);
}

int profiling_enable(pid_t pid)
{
    int rc = syscall(SC_profiling_enable, pid);
    __RETURN_WITH_ERRNO(rc, rc, -1);
}

int profiling_disable(pid_t pid)
{
    int rc = syscall(SC_profiling_disable, pid);
    __RETURN_WITH_ERRNO(rc, rc, -1);
}

int set_thread_boost(int tid, int amount)
{
    int rc = syscall(SC_set_thread_boost, tid, amount);
    __RETURN_WITH_ERRNO(rc, rc, -1);
}


int futex(int32_t* userspace_address, int futex_op, int32_t value, const struct timespec* timeout)
{
    Syscall::SC_futex_params params { userspace_address, futex_op, value, timeout };
    int rc = syscall(SC_futex, &params);
    __RETURN_WITH_ERRNO(rc, rc, -1);
}

}