[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/8] kern: add a name field to struct task
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 3/8] kern: add a name field to struct task |
Date: |
Sat, 1 Feb 2014 15:24:01 +0100 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Justus Winter, le Sat 01 Feb 2014 15:09:23 +0100, a écrit :
> * kern/task.c (task_create): Initialize name with the address of the task.
> * kern/task.h (TASK_NAME_SIZE): New definition.
> (struct task): Add field name.
Ack.
> ---
> kern/task.c | 3 +++
> kern/task.h | 9 +++++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/kern/task.c b/kern/task.c
> index 13b3c76..0b5a6f7 100644
> --- a/kern/task.c
> +++ b/kern/task.c
> @@ -45,6 +45,7 @@
> #include <kern/slab.h>
> #include <kern/kalloc.h>
> #include <kern/processor.h>
> +#include <kern/printf.h>
> #include <kern/sched_prim.h> /* for thread_wakeup */
> #include <kern/ipc_tt.h>
> #include <kern/syscall_emulation.h>
> @@ -164,6 +165,8 @@ kern_return_t task_create(
> }
> #endif /* FAST_TAS */
>
> + snprintf (new_task->name, sizeof new_task->name, "%p", new_task);
> +
> ipc_task_enable(new_task);
>
> *child_task = new_task;
> diff --git a/kern/task.h b/kern/task.h
> index e852033..7ae10cd 100644
> --- a/kern/task.h
> +++ b/kern/task.h
> @@ -48,6 +48,13 @@
> #include <vm/vm_types.h>
> #include <machine/task.h>
>
> +/*
> + * Task name buffer size. The size is chosen so that struct task fits
> + * into three cache lines. The size of a cache line on a typical CPU
> + * is 64 bytes.
> + */
> +#define TASK_NAME_SIZE 32
> +
> struct task {
> /* Synchronization/destruction information */
> decl_simple_lock_data(,lock) /* Task's lock */
> @@ -113,6 +120,8 @@ struct task {
> natural_t cow_faults; /* copy-on-write faults counter */
> natural_t messages_sent; /* messages sent counter */
> natural_t messages_received; /* messages received counter */
> +
> + char name[TASK_NAME_SIZE];
> };
>
> #define task_lock(task) simple_lock(&(task)->lock)
> --
> 1.8.5.2
>
--
Samuel
> Allez, soyez sympa ... traduisez-lui "linux"
Linux, c'est comme le miel : c'est vachement bon mais ça attire les
mouches. En plus, ça colle aux doigts et on a du mal à s'en défaire.
-+- TP in: Guide du linuxien pervers - "Barrez vous les mouches !"
- [PATCH 1/8] kern: fix printing of kmem_cache names, Justus Winter, 2014/02/01
- [PATCH 2/8] kern: add snprintf, Justus Winter, 2014/02/01
- [PATCH 4/8] ipc: use the name of the task for error messages, Justus Winter, 2014/02/01
- [PATCH 3/8] kern: add a name field to struct task, Justus Winter, 2014/02/01
- Re: [PATCH 3/8] kern: add a name field to struct task,
Samuel Thibault <=
- [PATCH 7/8] include: add task_set_name, Justus Winter, 2014/02/01
- [PATCH 5/8] include: add a fixed-size string type for debugging purposes, Justus Winter, 2014/02/01
- [PATCH 6/8] kern: implement task_set_name, Justus Winter, 2014/02/01
[PATCH 8/8] doc: document task_set_name, Justus Winter, 2014/02/01