summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6dee31b)
raw | patch | inline | side by side (parent: 6dee31b)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Fri, 30 Mar 2007 19:45:38 +0000 (21:45 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Fri, 30 Mar 2007 19:45:38 +0000 (21:45 +0200) |
src/exec.c | patch | blob | history |
diff --git a/src/exec.c b/src/exec.c
index 82c7efa655a94835178bd9592307d3a1362dc474..5bddfc5920ff9a09ed33c3b7ded80c1b05adab71 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
#include <sys/types.h>
#include <pwd.h>
+#include <signal.h>
#include <pthread.h>
pl->pid = 0;
pthread_exit ((void *) 0);
+ return (NULL);
} /* void *exec_read_one */
static int exec_read (void)
return (0);
} /* int exec_read */
+static int exec_shutdown (void)
+{
+ program_list_t *pl;
+ program_list_t *next;
+
+ pl = pl_head;
+ while (pl != NULL)
+ {
+ next = pl->next;
+
+ if (pl->pid > 0)
+ {
+ kill (pl->pid, SIGTERM);
+ INFO ("exec plugin: Sent SIGTERM to %hu", (unsigned short int) pl->pid);
+ }
+
+ sfree (pl->user);
+ sfree (pl);
+
+ pl = next;
+ } /* while (pl) */
+ pl_head = NULL;
+
+ return (0);
+} /* int exec_shutdown */
+
void module_register (modreg_e load)
{
if (load & MR_DATASETS)
{
plugin_register_config ("exec", exec_config, config_keys, config_keys_num);
plugin_register_read ("exec", exec_read);
+ plugin_register_shutdown ("exec", exec_shutdown);
}
} /* void module_register */