]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
affinity: drop capability after setting thread prio
authorEric Leblond <eric@regit.org>
Wed, 5 Sep 2012 06:56:33 +0000 (08:56 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 6 Sep 2012 05:51:27 +0000 (07:51 +0200)
Setting thread priority can require privilege if a low nice value
has to be set up.

src/tm-threads.c

index 5f32f12412aff210f373489f1a4e62cf31493d53..cae708054a9255b3fb640c0b95c6dbd45274d268 100644 (file)
@@ -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();