aboutsummaryrefslogtreecommitdiffstats
path: root/trxcon/trxcon.c
diff options
context:
space:
mode:
Diffstat (limited to 'trxcon/trxcon.c')
-rw-r--r--trxcon/trxcon.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/trxcon/trxcon.c b/trxcon/trxcon.c
index 3005a93..d5fd6e1 100644
--- a/trxcon/trxcon.c
+++ b/trxcon/trxcon.c
@@ -21,6 +21,7 @@
*
*/
+#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
@@ -29,6 +30,7 @@
#include <unistd.h>
#include <signal.h>
#include <time.h>
+#include <pthread.h>
#include <arpa/inet.h>
@@ -277,6 +279,21 @@ int main(int argc, char **argv)
{
int rc = 0;
+ cpu_set_t cpuset;
+
+ CPU_ZERO(&cpuset);
+ CPU_SET(3, &cpuset);
+ pthread_setaffinity_np(pthread_self(), sizeof(cpuset), &cpuset);
+
+ int prio = sched_get_priority_max(SCHED_RR) - 5;
+ struct sched_param param;
+ param.sched_priority = prio;
+ int rv = sched_setscheduler(0, SCHED_RR, &param);
+ if (rv < 0) {
+ LOGP(DAPP, LOGL_ERROR, "Failed to set sched!\n");
+ exit(0);
+ }
+
printf("%s", COPYRIGHT);
init_defaults();
handle_options(argc, argv);