summaryrefslogtreecommitdiff
path: root/src/ipcpd/ipcp.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2021-07-11 14:01:15 +0200
committerSander Vrijders <sander@ouroboros.rocks>2021-07-12 09:09:44 +0200
commite33be771e4d9e5a88119f4e3af6259e01257c8a5 (patch)
tree7097dbed859814fb100e61c3af66b040e191f12d /src/ipcpd/ipcp.c
parentd064464945878df38127279233bc433fef529c90 (diff)
downloadouroboros-e33be771e4d9e5a88119f4e3af6259e01257c8a5.tar.gz
ouroboros-e33be771e4d9e5a88119f4e3af6259e01257c8a5.zip
ipcpd: Reduce Linux slack timer
This will reduce the linux high resolution slack timer in IPCPs. Linux default for userspace processes is 50us. It is configurable at build using IPCP_LINUX_SLACKTIMER_NS. Default is now 1us. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd/ipcp.c')
-rw-r--r--src/ipcpd/ipcp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c
index 59fbdba6..ab2f88f8 100644
--- a/src/ipcpd/ipcp.c
+++ b/src/ipcpd/ipcp.c
@@ -53,6 +53,7 @@
#include <signal.h>
#include <string.h>
#include <sys/socket.h>
+#include <sys/prctl.h>
#include <stdlib.h>
#if defined(__linux__) && !defined(DISABLE_CORE_LOCK)
#include <unistd.h>
@@ -710,6 +711,9 @@ int ipcp_init(int argc,
ipcpi.state = IPCP_NULL;
ipcpi.type = type;
+#if defined (__linux__)
+ prctl(PR_SET_TIMERSLACK, IPCP_LINUX_SLACK_NS, 0, 0, 0);
+#endif
ipcpi.sock_path = ipcp_sock_path(getpid());
if (ipcpi.sock_path == NULL)
goto fail_sock_path;