+ if (!initialized)
+ return NULL;
+ list_for_each_entry_safe(t, tmp, &pre_select_list, pre_select_node) {
+ char *tmp_msg;
+ tmp_msg = make_message("%s%p\tpre\t%s\n", msg? msg : "", t, t->status);
+ free(msg);
+ msg = tmp_msg;
+ }
+ list_for_each_entry_safe(t, tmp, &post_select_list, post_select_node) {
+ char *tmp_msg;
+// if (t->pre_select)
+// continue;
+ tmp_msg = make_message("%s%p\tpost\t%s\n", msg? msg : "", t, t->status);
+ free(msg);
+ msg = tmp_msg;
+ }
+ //PARA_DEBUG_LOG("task list:\n%s", 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;
+}