[Initng-svn] r2990 - in initng: plugins/daemon src

svn at initng.thinktux.net svn at initng.thinktux.net
Tue Feb 14 10:05:35 CET 2006


Author: jimmy
Date: Tue Feb 14 10:05:35 2006
New Revision: 2990

Modified:
   initng/plugins/daemon/initng_daemon.c
   initng/src/initng_handler.c
   initng/src/initng_handler.h
   initng/src/main.c
Log:
Remove initng_term_Stopping_services() shut be handled manually in initng_daemon and others.


Modified: initng/plugins/daemon/initng_daemon.c
==============================================================================
--- initng/plugins/daemon/initng_daemon.c	(original)
+++ initng/plugins/daemon/initng_daemon.c	Tue Feb 14 10:05:35 2006
@@ -725,7 +725,7 @@
 
     if(n-daemon->time_current_state.tv_sec>DEFAULT_KILL_TIMEOUT)
     {
-	F_("Service %s DEFAULT_KILL_TIMEOUT reached!\n");
+	F_("Service %s DEFAULT_KILL_TIMEOUT reached!\n", daemon->name);
 	return;
     }
 
@@ -744,7 +744,7 @@
 
     if(n-daemon->time_current_state.tv_sec>DEFAULT_TERM_TIMEOUT)
     {
-	F_("Service %s DEFAULT_KILL_TIMEOUT reached!\n");
+	F_("Service %s DEFAULT_KILL_TIMEOUT reached!\n", daemon->name);
 	return;
     }
 

Modified: initng/src/initng_handler.c
==============================================================================
--- initng/src/initng_handler.c	(original)
+++ initng/src/initng_handler.c	Tue Feb 14 10:05:35 2006
@@ -71,77 +71,6 @@
     }
 }
 
-/* this function will send term signal to a service if it was marked 30 seconds or more */
-void initng_handler_term_stopping_services(void)
-{
-    active_db_h *to_term, *q = NULL;
-    process_h *process, *safe = NULL;
-    int reactivate_alarm = FALSE;
-    int timeout = SECONDS_BEFORE_KILL;
-
-    S_;
-
-    while_active_db_safe(to_term, q)
-    {
-        timeout = SECONDS_BEFORE_KILL;
-        /* check if service is marked stopping */
-        if (!IS_STOPPING(to_term))
-            continue;
-
-        D_("Service %s is STOPPING\n", to_term->name);
-
-        if (initng_active_db_is(&STOP_TIMEOUT, to_term))
-        {
-            timeout = initng_active_db_get_int(&STOP_TIMEOUT, to_term);
-        }
-
-        /* make sure this service has timed out */
-        if ((g.now.tv_sec - to_term->time_current_state.tv_sec) < timeout)
-        {
-            D_("Have to wait a bit more before killing %s!\n", to_term->name);
-            reactivate_alarm = TRUE;
-            continue;
-        }
-
-        D_("Service %s has been STOPPING for %i, and it's more then %i seconds\n", to_term->name, (g.now.tv_sec - to_term->time_current_state.tv_sec), timeout);
-
-        /* ok, no go TERM all running processes */
-        process = safe = NULL;
-        while_processes_safe(process, safe, to_term)
-        {
-            if (process->pid < 0)
-            {
-                F_("There exists a process service:%s without a pid in the db!\n", to_term->name);
-                continue;
-            }
-
-
-            /* check if the process still exits! */
-            if (kill(process->pid, 0) < 0 && (errno == ESRCH))
-            {
-                /* This process is already dead */
-                F_("process %s pid %i service %s is already dead, cleaning up.\n", to_term->name, process->pid, to_term->name);
-
-                list_del(&process->list);
-                initng_process_db_free(process);
-
-                initng_common_mark_service(to_term, &STOPPED);
-                /*handle_killed_by_pid(to_term->start_process->pid, 1); */
-            }
-            else
-            {
-
-                W_("Warning, terminating %s on pid %i!\n", to_term->name,
-                   process->pid);
-                kill(process->pid, SIGKILL);
-            }
-        }
-    }
-
-    /* reactivate the alarm if set */
-    if (reactivate_alarm == TRUE)
-        initng_global_set_sleep(timeout);
-}
 
     /* M A R K    S T U F F */
 

Modified: initng/src/initng_handler.h
==============================================================================
--- initng/src/initng_handler.h	(original)
+++ initng/src/initng_handler.h	Tue Feb 14 10:05:35 2006
@@ -30,6 +30,5 @@
 int initng_handler_restart_service(active_db_h * service);
 active_db_h *initng_handler_start_new_service_named(const char *service);
 void initng_handler_run_interrupt_handlers(void);
-void initng_handler_term_stopping_services(void);
 int initng_handler_stop_all(void);
 #endif

Modified: initng/src/main.c
==============================================================================
--- initng/src/main.c	(original)
+++ initng/src/main.c	Tue Feb 14 10:05:35 2006
@@ -481,8 +481,6 @@
         {
             D_("Got alarm set, checking timers plugin ...\n");
             initng_signal_got_alarm = FALSE;
-            /* Check for timed out stopping services for SIGKILL */
-            initng_handler_term_stopping_services();
             /* Check timers plug-ins */
             initng_plugin_callers_alarm();
         }


More information about the Initng-svn mailing list