From: Eric Leblond Date: Wed, 5 Sep 2012 06:56:33 +0000 (+0200) Subject: affinity: drop capability after setting thread prio X-Git-Tag: suricata-1.4beta1~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=073b251df7e545f032724b9e8ef70ab216f4c5e5;p=thirdparty%2Fsuricata.git affinity: drop capability after setting thread prio Setting thread priority can require privilege if a low nice value has to be set up. --- diff --git a/src/tm-threads.c b/src/tm-threads.c index 5f32f12412..cae708054a 100644 --- a/src/tm-threads.c +++ b/src/tm-threads.c @@ -146,12 +146,12 @@ void *TmThreadsSlot1NoIn(void *td) SCLogWarning(SC_ERR_THREAD_INIT, "Unable to set thread name"); } - /* Drop the capabilities for this thread */ - SCDropCaps(tv); - if (tv->thread_setup_flags != 0) TmThreadSetupOptions(tv); + /* Drop the capabilities for this thread */ + SCDropCaps(tv); + if (s->SlotThreadInit != NULL) { void *slot_data = NULL; r = s->SlotThreadInit(tv, s->slot_initdata, &slot_data); @@ -245,12 +245,12 @@ void *TmThreadsSlot1NoOut(void *td) SCLogWarning(SC_ERR_THREAD_INIT, "Unable to set thread name"); } - /* Drop the capabilities for this thread */ - SCDropCaps(tv); - if (tv->thread_setup_flags != 0) TmThreadSetupOptions(tv); + /* Drop the capabilities for this thread */ + SCDropCaps(tv); + if (s->SlotThreadInit != NULL) { void *slot_data = NULL; r = s->SlotThreadInit(tv, s->slot_initdata, &slot_data); @@ -325,12 +325,12 @@ void *TmThreadsSlot1NoInOut(void *td) SCLogWarning(SC_ERR_THREAD_INIT, "Unable to set thread name"); } - /* Drop the capabilities for this thread */ - SCDropCaps(tv); - if (tv->thread_setup_flags != 0) TmThreadSetupOptions(tv); + /* Drop the capabilities for this thread */ + SCDropCaps(tv); + SCLogDebug("%s starting", tv->name); if (s->SlotThreadInit != NULL) { @@ -402,12 +402,12 @@ void *TmThreadsSlot1(void *td) SCLogWarning(SC_ERR_THREAD_INIT, "Unable to set thread name"); } - /* Drop the capabilities for this thread */ - SCDropCaps(tv); - if (tv->thread_setup_flags != 0) TmThreadSetupOptions(tv); + /* Drop the capabilities for this thread */ + SCDropCaps(tv); + SCLogDebug("%s starting", tv->name); if (s->SlotThreadInit != NULL) { @@ -609,12 +609,12 @@ void *TmThreadsSlotPktAcqLoop(void *td) { SCLogWarning(SC_ERR_THREAD_INIT, "Unable to set thread name"); } - /* Drop the capabilities for this thread */ - SCDropCaps(tv); - if (tv->thread_setup_flags != 0) TmThreadSetupOptions(tv); + /* Drop the capabilities for this thread */ + SCDropCaps(tv); + /* check if we are setup properly */ if (s == NULL || s->PktAcqLoop == NULL || tv->tmqh_in == NULL || tv->tmqh_out == NULL) { SCLogError(SC_ERR_FATAL, "TmSlot or ThreadVars badly setup: s=%p," @@ -702,12 +702,12 @@ void *TmThreadsSlotVar(void *td) SCLogWarning(SC_ERR_THREAD_INIT, "Unable to set thread name"); } - /* Drop the capabilities for this thread */ - SCDropCaps(tv); - if (tv->thread_setup_flags != 0) TmThreadSetupOptions(tv); + /* Drop the capabilities for this thread */ + SCDropCaps(tv); + /* check if we are setup properly */ if (s == NULL || tv->tmqh_in == NULL || tv->tmqh_out == NULL) { EngineKill();