audiod: Kill com_kill().
authorAndre Noll <maan@systemlinux.org>
Sun, 20 Feb 2011 18:06:34 +0000 (19:06 +0100)
committerAndre Noll <maan@systemlinux.org>
Sat, 12 Mar 2011 20:29:51 +0000 (21:29 +0100)
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.

audiod.cmd
audiod_command.c
error.h
sched.c
sched.h

index 7ffe98e7d249368992568f42dcb1bc816eb7afb5..23bcfbd164d19a91f8b2bc64bc57ff7ac7751565 100644 (file)
@@ -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
 ---
 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
 N: off
 D: deactivate para_audiod
 U: off
index eed9fc154c7191513c3e315a65fe552641823b1b..bfd7c4aa5df170235f24961813bc4cc2e69790fa 100644 (file)
@@ -301,21 +301,6 @@ int com_tasks(int fd, __a_unused int argc, __a_unused char **argv)
        return ret;
 }
 
        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;
 int com_stat(int fd, int argc, char **argv)
 {
        int i, ret, parser_friendly = 0;
diff --git a/error.h b/error.h
index ed905a108dffe5be44e4cc8051da0582e144262b..e35952bd390aeb8ff5fab8c8b17c2ccbfe95f354 100644 (file)
--- a/error.h
+++ b/error.h
@@ -230,8 +230,6 @@ extern const char **para_errlist[];
 
 
 #define SCHED_ERRORS \
 
 
 #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"), \
 
        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 7d91797a4c43139f63bab245d6e904378d80f49a..4e989d34109a0d1f904b01928c3285e773d9aa8f 100644 (file)
--- 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) {
 {
        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)
                        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) {
        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;
 //             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.
  *
  *
  * \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)
  * 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;
 }
 
        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.
  *
 /**
  * Set the select timeout to the minimal possible value.
  *
diff --git a/sched.h b/sched.h
index 7158a8732c314b88ad1e162cbb6743c710d01240..e018c2fe9d0c35d2431b96967f97eb69f8ea0238 100644 (file)
--- 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);
 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);
 void sched_shutdown(void);
 void sched_min_delay(struct sched *s);
 void sched_request_timeout(struct timeval *to, struct sched *s);