diff options
author | Martin Willi <martin@strongswan.org> | 2008-12-12 09:10:52 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2008-12-12 09:10:52 +0000 |
commit | 7a485e90bded80ffde894dcc438873a2daec127d (patch) | |
tree | 6e623616089135a9afa96b2e7ecfa9cb5c36cb7c /src | |
parent | f2bd424c899892ba7ccc040c00b8000311f40057 (diff) | |
download | strongswan-7a485e90bded80ffde894dcc438873a2daec127d.tar.bz2 strongswan-7a485e90bded80ffde894dcc438873a2daec127d.tar.xz |
leak detective binds execution to a signle core, avoids corruption on SMP machines
Diffstat (limited to 'src')
-rw-r--r-- | src/libstrongswan/utils/leak_detective.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstrongswan/utils/leak_detective.c b/src/libstrongswan/utils/leak_detective.c index abb470f46..63d1635f6 100644 --- a/src/libstrongswan/utils/leak_detective.c +++ b/src/libstrongswan/utils/leak_detective.c @@ -15,6 +15,8 @@ * $Id$ */ +#define _GNU_SOURCE +#include <sched.h> #include <stddef.h> #include <string.h> #include <stdio.h> @@ -473,6 +475,16 @@ leak_detective_t *leak_detective_create() if (getenv("LEAK_DETECTIVE_DISABLE") == NULL) { + cpu_set_t mask; + + CPU_ZERO(&mask); + CPU_SET(0, &mask); + + if (sched_setaffinity(0, sizeof(cpu_set_t), &mask) != 0) + { + fprintf(stderr, "setting CPU affinity failed: %m"); + } + lib->leak_detective = TRUE; install_hooks(); } |