summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2010-07-09 18:08:57 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2010-07-09 18:11:12 +0200
commitd1070265d015218887368117c3a69169dc9df5c5 (patch)
tree70e98a9681c7ce97289a4023cb09148c09b5bff2
parent6877508042fec2f80b5340981edb728a0c715725 (diff)
downloadconnman-d1070265d015218887368117c3a69169dc9df5c5.tar.gz
connman-d1070265d015218887368117c3a69169dc9df5c5.tar.bz2
connman-d1070265d015218887368117c3a69169dc9df5c5.zip
Remove task plugin
-rw-r--r--Makefile.plugins4
-rw-r--r--plugins/task.c145
-rw-r--r--plugins/task.h35
3 files changed, 2 insertions, 182 deletions
diff --git a/Makefile.plugins b/Makefile.plugins
index 7df46a48..0a7424ec 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -81,12 +81,12 @@ endif
if UDHCP
if UDHCP_BUILTIN
builtin_modules += udhcp
-builtin_sources += plugins/udhcp.c plugins/task.h plugins/task.c
+builtin_sources += plugins/udhcp.c
builtin_cflags += -DUDHCPC=\"@UDHCPC@\"
else
plugin_LTLIBRARIES += plugins/udhcp.la
plugin_objects += $(plugins_udhcp_la_OBJECTS)
-plugins_udhcp_la_SOURCES = plugins/udhcp.c plugins/task.h plugins/task.c
+plugins_udhcp_la_SOURCES = plugins/udhcp.c
plugins_udhcp_la_CFLAGS = $(plugin_cflags) -DUDHCPC=\"@UDHCPC@\" \
-DSTATEDIR=\""$(statedir)"\" \
-DSCRIPTDIR=\""$(build_scriptdir)"\"
diff --git a/plugins/task.c b/plugins/task.c
deleted file mode 100644
index a6362e4c..00000000
--- a/plugins/task.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- *
- * Connection Manager
- *
- * Copyright (C) 2007-2010 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <unistd.h>
-#include <sys/wait.h>
-
-#include <glib.h>
-
-#include <connman/log.h>
-
-#include "task.h"
-
-struct task_data {
- pid_t pid;
- int index;
- task_cb_t callback;
- void *user_data;
-};
-
-static GSList *task_list = NULL;
-
-struct task_data *task_find_by_pid(pid_t pid)
-{
- GSList *list;
-
- for (list = task_list; list; list = list->next) {
- struct task_data *task = list->data;
-
- if (task->pid == pid)
- return task;
- }
-
- return NULL;
-}
-
-struct task_data *task_find_by_index(int index)
-{
- GSList *list;
-
- for (list = task_list; list; list = list->next) {
- struct task_data *task = list->data;
-
- if (task->index == index)
- return task;
- }
-
- return NULL;
-}
-
-static void task_died(GPid pid, gint status, gpointer user_data)
-{
- struct task_data *task = user_data;
-
- if (WIFEXITED(status))
- DBG("task %p exit status %d", task, WEXITSTATUS(status));
- else
- DBG("task %p signal %d", task, WTERMSIG(status));
-
- g_spawn_close_pid(pid);
- task->pid = 0;
-
- task_list = g_slist_remove(task_list, task);
-
- if (task->callback)
- task->callback(task->index, task->user_data);
-
- g_free(task);
-}
-
-static void task_setup(gpointer user_data)
-{
- struct task_data *task = user_data;
-
- DBG("task %p", task);
-}
-
-struct task_data *task_spawn(int index, char **argv, char **envp,
- task_cb_t callback, void *user_data)
-{
- GSpawnFlags flags = G_SPAWN_DO_NOT_REAP_CHILD |
- G_SPAWN_STDOUT_TO_DEV_NULL;
- struct task_data *task;
-
- DBG("index %d", index);
-
- task = g_try_new0(struct task_data, 1);
- if (task == NULL)
- return NULL;
-
- task->index = index;
-
- task->callback = callback;
- task->user_data = user_data;
-
- if (g_spawn_async(NULL, argv, envp, flags,
- task_setup, task, &task->pid, NULL) == FALSE) {
- connman_error("Failed to spawn task");
- return NULL;
- }
-
- task_list = g_slist_append(task_list, task);
-
- g_child_watch_add(task->pid, task_died, task);
-
- DBG("task %p pid %d", task, task->pid);
-
- return task;
-}
-
-int task_kill(struct task_data *task)
-{
- DBG("task %p", task);
-
- if (task->pid > 0)
- kill(task->pid, SIGTERM);
-
- return 0;
-}
-
-void *task_get_data(struct task_data *task)
-{
- return task->user_data;
-}
diff --git a/plugins/task.h b/plugins/task.h
deleted file mode 100644
index 059f3511..00000000
--- a/plugins/task.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *
- * Connection Manager
- *
- * Copyright (C) 2007-2010 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#include <sys/types.h>
-
-struct task_data;
-
-typedef void (* task_cb_t) (int index, void *user_data);
-
-struct task_data *task_find_by_pid(pid_t pid);
-struct task_data *task_find_by_index(int index);
-
-struct task_data *task_spawn(int index, char **argv, char **envp,
- task_cb_t callback, void *user_data);
-int task_kill(struct task_data *task);
-
-void *task_get_data(struct task_data *task);