Index: trunk/include/samhain.h
===================================================================
--- trunk/include/samhain.h	(revision 410)
+++ trunk/include/samhain.h	(revision 411)
@@ -331,4 +331,9 @@
   int    looptime;                 /* timing for main loop            */
   /*@null@*//*@out@*/ char   * timezone;
+
+#ifdef SCREW_IT_UP
+  int sigtrap_max_duration;
+#endif
+
 } sh_struct;
 
Index: trunk/include/sh_unix.h
===================================================================
--- trunk/include/sh_unix.h	(revision 410)
+++ trunk/include/sh_unix.h	(revision 411)
@@ -364,5 +364,4 @@
 
 void   sh_sigtrap_handler (int signum);
-extern volatile int sh_not_traced;
 
 #ifdef HAVE_GETTIMEOFDAY
@@ -377,8 +376,16 @@
 #endif
 #endif
-void sh_set_save_tv();
-void sh_set_untraced(int val);
-int  sh_get_untraced();
-#endif
+#endif
+
+struct sh_sigtrap_variables {
+  int not_traced;
+#ifdef HAVE_GETTIMEOFDAY
+  struct timeval save_tv;
+#endif
+};
+
+struct sh_sigtrap_variables * sh_sigtrap_variables_get();
+
+int sh_sigtrap_max_duration_set (const char * str);
 
 static inline
@@ -399,8 +406,16 @@
 int sh_derr(void)
 {
-  sh_set_untraced(0);
+  struct sh_sigtrap_variables * sigtrap_variables;
+  sigtrap_variables = sh_sigtrap_variables_get();
+  if (sigtrap_variables == NULL) {
+    /* Perhaps, its better to not die, and to continue using Samhain,
+       even if this part does not work. */
+    return (0);
+  }
+
+  sigtrap_variables->not_traced = 0;
 
 #ifdef HAVE_GETTIMEOFDAY
-  sh_set_save_tv();
+  gettimeofday(&sigtrap_variables->save_tv, NULL);
 #endif
 
@@ -409,8 +424,8 @@
   raise(SIGTRAP);
   
-  if (sh_get_untraced() == 0)
+  if (sigtrap_variables->not_traced == 0)
     _exit(5);
 
-  sh_set_untraced(0);
+  sigtrap_variables->not_traced = 0;
   return (0);
 }
