summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ipcpd/CMakeLists.txt4
-rw-r--r--src/ipcpd/config.h.in2
-rw-r--r--src/ipcpd/ipcp.c4
3 files changed, 10 insertions, 0 deletions
diff --git a/src/ipcpd/CMakeLists.txt b/src/ipcpd/CMakeLists.txt
index fb6162c..1ce1bc0 100644
--- a/src/ipcpd/CMakeLists.txt
+++ b/src/ipcpd/CMakeLists.txt
@@ -16,6 +16,10 @@ set(IPCP_CONN_WAIT_DIR TRUE CACHE BOOL
"Check the running state of the directory when adding a dt connection")
set(DHT_ENROLL_SLACK 50 CACHE STRING
"DHT enrollment waiting time (0-999, ms)")
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(IPCP_LINUX_TIMERSLACK_NS 1000 CACHE STRING
+ "Slack value for high resolution timers on Linux systems.")
+endif ()
if ((IPCP_QOS_CUBE_BE_PRIO LESS 0) OR (IPCP_QOS_CUBE_BE_PRIO GREATER 99))
message(FATAL_ERROR "Invalid priority for best effort QoS cube")
diff --git a/src/ipcpd/config.h.in b/src/ipcpd/config.h.in
index ba4c326..0bf3ad6 100644
--- a/src/ipcpd/config.h.in
+++ b/src/ipcpd/config.h.in
@@ -39,6 +39,8 @@
#define IPCP_ADD_THREADS @IPCP_ADD_THREADS@
#cmakedefine HAVE_LIBGCRYPT
+#define IPCP_LINUX_SLACK_NS @IPCP_LINUX_TIMERSLACK_NS@
+
/* unicast IPCP */
#define QOS_PRIO_BE @IPCP_QOS_CUBE_BE_PRIO@
#define QOS_PRIO_VIDEO @IPCP_QOS_CUBE_VIDEO_PRIO@
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c
index 59fbdba..ab2f88f 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;