From: Andre Noll Date: Sun, 20 Feb 2011 18:06:34 +0000 (+0100) Subject: audiod: Kill com_kill(). X-Git-Tag: v0.4.6~7^2~2 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=86611501;p=paraslash.git audiod: Kill com_kill(). This never worked well because a task which has been killed by kill_task() has no chance to clean up. Also a stale buffer tree node remains if the task had an associated buffer tree node. --- diff --git a/audiod.cmd b/audiod.cmd index 7ffe98e7..23bcfbd1 100644 --- a/audiod.cmd +++ b/audiod.cmd @@ -49,11 +49,6 @@ H: in any way. But now these days are gone, I'm not so self assured. Now I find H: I've changed my mind and opened up the doors. H: -- Beatles: Help --- -N: kill -D: kill an active audiod task -U: kill task_id [task_id ...] -H: Simulate an error condition for the given task(s) ---- N: off D: deactivate para_audiod U: off diff --git a/audiod_command.c b/audiod_command.c index eed9fc15..bfd7c4aa 100644 --- a/audiod_command.c +++ b/audiod_command.c @@ -301,21 +301,6 @@ int com_tasks(int fd, __a_unused int argc, __a_unused char **argv) return ret; } -int com_kill(int fd, int argc, char **argv) -{ - int i, ret = 1; - if (argc < 2) - return -E_AUDIOD_SYNTAX; - for (i = 1; i < argc; i++) { - ret = kill_task(argv[i]); - if (ret < 0) - break; - } - if (ret > 0) - close(fd); - return ret; -} - int com_stat(int fd, int argc, char **argv) { int i, ret, parser_friendly = 0; diff --git a/error.h b/error.h index ed905a10..e35952bd 100644 --- a/error.h +++ b/error.h @@ -230,8 +230,6 @@ extern const char **para_errlist[]; #define SCHED_ERRORS \ - PARA_ERROR(TASK_KILLED, "task killed"), \ - PARA_ERROR(NO_SUCH_TASK, "task not found"), \ PARA_ERROR(NOT_INITIALIZED, "scheduler not yet initialized"), \ PARA_ERROR(SCHED_SHUTDOWN, "scheduler was shut down"), \ diff --git a/sched.c b/sched.c index 7d91797a..4e989d34 100644 --- a/sched.c +++ b/sched.c @@ -51,7 +51,7 @@ static void sched_preselect(struct sched *s) { struct task *t, *tmp; list_for_each_entry_safe(t, tmp, &pre_select_list, pre_select_node) { - if (t->error >= 0 && t->pre_select) + if (t->pre_select) t->pre_select(s, t); // PARA_INFO_LOG("%s \n", t->status); if (t->error >= 0) @@ -93,8 +93,7 @@ static void sched_post_select(struct sched *s) struct task *t, *tmp; list_for_each_entry_safe(t, tmp, &post_select_list, post_select_node) { - if (t->error >= 0) - call_post_select(s, t); + call_post_select(s, t); // PARA_INFO_LOG("%s: %d\n", t->status, t->ret); if (t->error >= 0) continue; @@ -222,8 +221,7 @@ void sched_shutdown(void) * * \return The task list. * - * Each entry of the list contains an identifier which is simply a hex number - * that may be used in \a kill_task() to terminate the task. + * Each entry of the list contains an identifier which is simply a hex number. * The result is dynamically allocated and must be freed by the caller. */ char *get_task_list(void) @@ -251,41 +249,6 @@ char *get_task_list(void) return msg; } -/** - * Simulate an error for the given task. - * - * \param id The task identifier. - * - * Find the task identified by \a id, set the tasks' error value to - * \p -E_TASK_KILLED and unregister the task. - * - * \return Positive on success, negative on errors (e.g. if \a id does not - * correspond to a registered task). - */ -int kill_task(char *id) -{ - struct task *t, *tmp; - char buf[20]; - - if (!initialized) - return -E_NOT_INITIALIZED; - list_for_each_entry_safe(t, tmp, &pre_select_list, pre_select_node) { - sprintf(buf, "%p", t); - if (strcmp(id, buf)) - continue; - t->error = -E_TASK_KILLED; - return 1; - } - list_for_each_entry_safe(t, tmp, &post_select_list, post_select_node) { - sprintf(buf, "%p", t); - if (strcmp(id, buf)) - continue; - t->error = -E_TASK_KILLED; - return 1; - } - return -E_NO_SUCH_TASK; -} - /** * Set the select timeout to the minimal possible value. * diff --git a/sched.h b/sched.h index 7158a873..e018c2fe 100644 --- a/sched.h +++ b/sched.h @@ -77,7 +77,6 @@ extern struct timeval *now; void register_task(struct task *t); int schedule(struct sched *s); char *get_task_list(void); -int kill_task(char *id); void sched_shutdown(void); void sched_min_delay(struct sched *s); void sched_request_timeout(struct timeval *to, struct sched *s);