Actions
Bug #861
closed1.4.3: src/tm-threads.c: cpu sets not supported on Solaris
Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Affected Versions:
Effort:
Difficulty:
Label:
Description
Solaris 10 & 11 with Sun Studio 12.3 compiler:
"tm-threads.c", line 539: warning: implicit function declaration: __builtin_expect "tm-threads.c", line 1123: syntax error before or at: * "tm-threads.c", line 1131: undefined symbol: SYS_gettid "tm-threads.c", line 1132: warning: implicit function declaration: sched_setaffinity "tm-threads.c", line 1132: undefined symbol: cs "tm-threads.c", line 1175: undefined symbol: cpu_set_t "tm-threads.c", line 1175: syntax error before or at: cs "tm-threads.c", line 1177: warning: implicit function declaration: CPU_ZERO "tm-threads.c", line 1177: undefined symbol: cs "tm-threads.c", line 1178: warning: implicit function declaration: CPU_SET "tm-threads.c", line 1282: undefined symbol: SYS_gettid "tm-threads.c", line 1297: warning: implicit function declaration: CPU_ISSET "tm-threads.c", line 1297: undefined struct/union member: lowprio_cpu "tm-threads.c", line 1299: undefined struct/union member: medprio_cpu "tm-threads.c", line 1301: undefined struct/union member: hiprio_cpu "tm-threads.c", line 1306: undefined symbol: SYS_gettid "tm-threads.c", line 1310: undefined struct/union member: cpu_set "tm-threads.c", line 1312: undefined symbol: SYS_gettid cc: acomp failed for tm-threads.c
Diff to fix is here:
--- suricata-1.4.3/src/tm-threads.c.orig Mon Jul 8 12:05:13 2013 +++ suricata-1.4.3/src/tm-threads.c Mon Jul 8 12:11:35 2013 @@ -1119,7 +1119,7 @@ return NULL; } -#if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__ +#if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__ && !defined __sun static int SetCPUAffinitySet(cpu_set_t *cs) { #if defined OS_FREEBSD int r = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, @@ -1152,7 +1152,7 @@ */ static int SetCPUAffinity(uint16_t cpuid) { -#if defined __OpenBSD__ +#if defined __OpenBSD__ || defined __sun return 0; #else int cpu = (int)cpuid; @@ -1278,6 +1278,7 @@ */ TmEcode TmThreadSetupOptions(ThreadVars *tv) { +#if ! defined(__sun) if (tv->thread_setup_flags & THREAD_SET_AFFINITY) { SCLogInfo("Setting affinity for \"%s\" Module to cpu/core " "%"PRIu16", thread id %lu", tv->name, tv->cpu_affinity, @@ -1284,8 +1285,9 @@ SCGetThreadIdLong()); SetCPUAffinity(tv->cpu_affinity); } +#endif -#if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__ +#if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__ && !defined __sun if (tv->thread_setup_flags & THREAD_SET_PRIORITY) TmThreadSetPrio(tv); if (tv->thread_setup_flags & THREAD_SET_AFFTYPE) {
Updated by Mark Solaris over 10 years ago
Here's a better diff which allows the SCLogInfo() to happen:
--- suricata-1.4.3/src/tm-threads.c.orig Mon Jul 8 15:45:34 2013 +++ suricata-1.4.3/src/tm-threads.c Mon Jul 8 15:50:00 2013 @@ -25,6 +25,10 @@ * Thread management functions. */ +#if defined(__sun) +#include <pthread.h> +#endif + #include "suricata-common.h" #include "suricata.h" #include "stream.h" @@ -1119,7 +1123,7 @@ return NULL; } -#if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__ +#if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__ && !defined __sun static int SetCPUAffinitySet(cpu_set_t *cs) { #if defined OS_FREEBSD int r = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, @@ -1152,7 +1156,7 @@ */ static int SetCPUAffinity(uint16_t cpuid) { -#if defined __OpenBSD__ +#if defined __OpenBSD__ || defined __sun return 0; #else int cpu = (int)cpuid; @@ -1281,11 +1285,15 @@ if (tv->thread_setup_flags & THREAD_SET_AFFINITY) { SCLogInfo("Setting affinity for \"%s\" Module to cpu/core " "%"PRIu16", thread id %lu", tv->name, tv->cpu_affinity, +#if defined(__sun) + pthread_self()); +#else SCGetThreadIdLong()); +#endif SetCPUAffinity(tv->cpu_affinity); } -#if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__ +#if !defined __CYGWIN__ && !defined OS_WIN32 && !defined __OpenBSD__ && !defined __sun if (tv->thread_setup_flags & THREAD_SET_PRIORITY) TmThreadSetPrio(tv); if (tv->thread_setup_flags & THREAD_SET_AFFTYPE) {
Updated by Mark Solaris over 10 years ago
Please close this bug as the fix is rolled into an update to:
https://redmine.openinfosecfoundation.org/issues/852
Actions