Mercurial > hvf > hvf-old
changeset 227:9940f9a7a49f
nucleus: Each task has a name associated with it
This will make it easier to figure out which task belongs to what.
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sat, 10 Jan 2009 14:33:04 -0500 |
parents | f5b2d14c531f |
children | d0ea258ea420 |
files | cp/init.c drivers/console.c include/sched.h nucleus/sched.c |
diffstat | 4 files changed, 26 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/cp/init.c Sat Jan 10 14:29:49 2009 -0500 +++ b/cp/init.c Sat Jan 10 14:33:04 2009 -0500 @@ -160,8 +160,8 @@ sys->directory = find_user_by_id("operator"); BUG_ON(IS_ERR(sys->directory)); - sys->task = create_task(cp_init, sys); + sys->task = create_task("operator-vcpu0", cp_init, sys); BUG_ON(IS_ERR(sys->task)); - BUG_ON(IS_ERR(create_task(cp_cmd_intercept_gen, sys))); + BUG_ON(IS_ERR(create_task("*-cmd_intercept", cp_cmd_intercept_gen, sys))); }
--- a/drivers/console.c Sat Jan 10 14:29:49 2009 -0500 +++ b/drivers/console.c Sat Jan 10 14:33:04 2009 -0500 @@ -258,6 +258,7 @@ struct console* start_consoles() { + char name[TASK_NAME_LEN+1]; struct console *op; int i; @@ -268,7 +269,9 @@ BUG_ON(list_empty(&consoles)); op = list_first_entry(&consoles, struct console, consoles); - create_task(console_flusher, op); + snprintf(name, TASK_NAME_LEN, "%05X-conflsh", op->dev->sch); + + create_task(name, console_flusher, op); for(i = 0; splash[i]; i++) con_printf(op, splash[i]);
--- a/include/sched.h Sat Jan 10 14:29:49 2009 -0500 +++ b/include/sched.h Sat Jan 10 14:33:04 2009 -0500 @@ -84,6 +84,8 @@ enum virt_cpustate state; }; +#define TASK_NAME_LEN 16 + /* * This structure describes a running process. */ @@ -98,6 +100,8 @@ struct virt_cpu *cpu; /* guest cpu */ int state; /* state */ + + char name[TASK_NAME_LEN+1]; /* task name */ }; struct virt_sys { @@ -112,12 +116,15 @@ }; extern void init_sched(); /* initialize the scheduler */ -extern struct task* create_task(int (*f)(void*), void*); +extern struct task* create_task(char *name, int (*f)(void*), void*); /* create a new task */ extern void schedule(); /* yield the cpu */ extern void __schedule(struct psw *); /* scheduler helper - use with caution */ extern void __schedule_svc(); +extern void list_tasks(struct console *con, + void (*f)(struct console *, struct task*)); + /** * current - the current task's task struct */
--- a/nucleus/sched.c Sat Jan 10 14:29:49 2009 -0500 +++ b/nucleus/sched.c Sat Jan 10 14:33:04 2009 -0500 @@ -93,10 +93,11 @@ /** * create_task - create a new task + * @name: name for the task * @f: function pointer to where thread of execution should begin * @data: arbitrary data to pass to the task */ -struct task* create_task(int (*f)(void *), void *data) +struct task* create_task(char *name, int (*f)(void *), void *data) { struct page *page; struct task *task; @@ -114,6 +115,8 @@ */ __init_task(task, f, data, page_to_addr(page)); + strncpy(task->name, name, TASK_NAME_LEN); + /* * Add the task to the scheduler lists */ @@ -278,3 +281,11 @@ set_timer(); } +void list_tasks(struct console *con, + void (*f)(struct console *, struct task*)) +{ + struct task *t; + + list_for_each_entry(t, &processes, proc_list) + f(con, t); +}