diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-12-30 19:23:13 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-12-30 19:23:13 +0100 |
commit | 610f3ad12fc023dee0e71bead17cf6ebd4eba09a (patch) | |
tree | 96c343455878f120d481d9c557100585908e2eb5 /Libraries | |
parent | 50677bf806e73d6b2bf940e0192f170b7bbaf3e4 (diff) | |
download | serenity-610f3ad12fc023dee0e71bead17cf6ebd4eba09a.zip |
Kernel: Add a basic thread boosting mechanism
This patch introduces a syscall:
int set_thread_boost(int tid, int amount)
You can use this to add a permanent boost value to the effective thread
priority of any thread with your UID (or any thread in the system if
you are the superuser.)
This is quite crude, but opens up some interesting opportunities. :^)
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibC/serenity.cpp | 7 | ||||
-rw-r--r-- | Libraries/LibC/serenity.h | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/Libraries/LibC/serenity.cpp b/Libraries/LibC/serenity.cpp index 59564ecfdb..379036f919 100644 --- a/Libraries/LibC/serenity.cpp +++ b/Libraries/LibC/serenity.cpp @@ -28,6 +28,13 @@ int profiling_disable(pid_t 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 }; diff --git a/Libraries/LibC/serenity.h b/Libraries/LibC/serenity.h index 08dbe96a8e..fbc2750787 100644 --- a/Libraries/LibC/serenity.h +++ b/Libraries/LibC/serenity.h @@ -50,6 +50,8 @@ int profiling_disable(pid_t); #define THREAD_PRIORITY_HIGH 50 #define THREAD_PRIORITY_MAX 99 +int set_thread_boost(int tid, int amount); + #define FUTEX_WAIT 1 #define FUTEX_WAKE 2 |