[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnumach] 01/03: git-task_set_name.patch: add task_set_name RPC.
From: |
Samuel Thibault |
Subject: |
[gnumach] 01/03: git-task_set_name.patch: add task_set_name RPC. |
Date: |
Thu, 20 Mar 2014 02:27:00 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch master
in repository gnumach.
commit b8fa0909687a90bfb56dd13152e2db345b184115
Author: Samuel Thibault <address@hidden>
Date: Wed Mar 19 19:08:53 2014 +0000
git-task_set_name.patch: add task_set_name RPC.
---
debian/changelog | 7 ++
debian/patches/git-task_set_name.patch | 194 +++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 202 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 3a57f7c..9e5904f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+gnumach (2:1.4-7) unstable; urgency=medium
+
+ * patches/git-task_set_name.patch: New patch from git to add task_set_name
+ RPC.
+
+ -- Samuel Thibault <address@hidden> Wed, 19 Mar 2014 19:08:30 +0000
+
gnumach (2:1.4-6) unstable; urgency=medium
* Re-enable patches/git-kentry_data_size.patch, but with an additional
diff --git a/debian/patches/git-task_set_name.patch
b/debian/patches/git-task_set_name.patch
new file mode 100644
index 0000000..3afd30d
--- /dev/null
+++ b/debian/patches/git-task_set_name.patch
@@ -0,0 +1,194 @@
+commit df47f83ed98e4ce356af8d34de05b549f4f9c912
+Author: Justus Winter <address@hidden>
+Date: Sat Feb 1 02:15:05 2014 +0100
+
+ kern: add a name field to struct task
+
+ * 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.
+
+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)
+commit 42b8f0e06f9b3a4a089ddbebd851988e095b0c72
+Author: Justus Winter <address@hidden>
+Date: Sat Feb 1 02:19:43 2014 +0100
+
+ ipc: use the name of the task for error messages
+
+ * ipc/mach_port.c (mach_port_destroy): Use the name of the task for
+ error messages.
+ (mach_port_deallocate): Likewise.
+
+diff --git a/ipc/mach_port.c b/ipc/mach_port.c
+index fbc5e69..13572a1 100644
+--- a/ipc/mach_port.c
++++ b/ipc/mach_port.c
+@@ -571,7 +571,7 @@ mach_port_destroy(
+ kr = ipc_right_lookup_write(space, name, &entry);
+ if (kr != KERN_SUCCESS) {
+ if (name != MACH_PORT_NULL && name != MACH_PORT_DEAD && space
== current_space()) {
+- printf("task %p destroying an invalid port %lu, most
probably a bug.\n", current_task(), name);
++ printf("task %.*s destroying an invalid port %lu, most
probably a bug.\n", sizeof current_task()->name, current_task()->name, name);
+ if (mach_port_deallocate_debug)
+ SoftDebugger("mach_port_deallocate");
+ }
+@@ -615,7 +615,7 @@ mach_port_deallocate(
+ kr = ipc_right_lookup_write(space, name, &entry);
+ if (kr != KERN_SUCCESS) {
+ if (name != MACH_PORT_NULL && name != MACH_PORT_DEAD && space
== current_space()) {
+- printf("task %p deallocating an invalid port %lu, most
probably a bug.\n", current_task(), name);
++ printf("task %.*s deallocating an invalid port %lu,
most probably a bug.\n", sizeof current_task()->name, current_task()->name,
name);
+ if (mach_port_deallocate_debug)
+ SoftDebugger("mach_port_deallocate");
+ }
+commit de74f85990dc39bc6723f046f83d4e53c45f4343
+Author: Justus Winter <address@hidden>
+Date: Sat Feb 1 02:23:07 2014 +0100
+
+ kern: implement task_set_name
+
+ task_set_name sets the name of a task. This is a debugging aid. The
+ name will be used in error messages printed by the kernel.
+
+ * kern/task.c (task_set_name): New function.
+ * kern/task.h (task_set_name): New declaration.
+
+diff --git a/kern/task.c b/kern/task.c
+index 0b5a6f7..66eb25c 100644
+--- a/kern/task.c
++++ b/kern/task.c
+@@ -37,6 +37,7 @@
+ #include <mach/vm_param.h>
+ #include <mach/task_info.h>
+ #include <mach/task_special_ports.h>
++#include <mach_debug/mach_debug_types.h>
+ #include <ipc/ipc_space.h>
+ #include <ipc/ipc_types.h>
+ #include <kern/debug.h>
+@@ -1071,6 +1072,22 @@ task_priority(
+ }
+
+ /*
++ * task_set_name
++ *
++ * Set the name of task TASK to NAME. This is a debugging aid.
++ * NAME will be used in error messages printed by the kernel.
++ */
++kern_return_t
++task_set_name(
++ task_t task,
++ kernel_debug_name_t name)
++{
++ strncpy(task->name, name, sizeof task->name - 1);
++ task->name[sizeof task->name - 1] = '\0';
++ return KERN_SUCCESS;
++}
++
++/*
+ * task_collect_scan:
+ *
+ * Attempt to free resources owned by tasks.
+diff --git a/kern/task.h b/kern/task.h
+index 7ae10cd..3c10dc0 100644
+--- a/kern/task.h
++++ b/kern/task.h
+@@ -39,6 +39,7 @@
+ #include <mach/time_value.h>
+ #include <mach/mach_param.h>
+ #include <mach/task_info.h>
++#include <mach_debug/mach_debug_types.h>
+ #include <kern/kern_types.h>
+ #include <kern/lock.h>
+ #include <kern/queue.h>
+@@ -169,6 +170,9 @@ extern kern_return_t task_assign(
+ extern kern_return_t task_assign_default(
+ task_t task,
+ boolean_t assign_threads);
++extern kern_return_t task_set_name(
++ task_t task,
++ kernel_debug_name_t name);
+ extern void consider_task_collect(void);
+
+ /*
+commit 877a319c94619e51a0103b9f201523b269588eb0
+Author: Justus Winter <address@hidden>
+Date: Sat Feb 1 02:25:45 2014 +0100
+
+ include: add task_set_name
+
+ task_set_name sets the name of a task. This is a debugging aid. The
+ name will be used in error messages printed by the kernel.
+
+ * include/mach/gnumach.defs (task_set_name): New procedure.
+
+diff --git a/include/mach/gnumach.defs b/include/mach/gnumach.defs
+index 12c4e99..6cfbb0d 100644
+--- a/include/mach/gnumach.defs
++++ b/include/mach/gnumach.defs
+@@ -27,6 +27,7 @@ subsystem
+
+ #include <mach/std_types.defs>
+ #include <mach/mach_types.defs>
++#include <mach_debug/mach_debug_types.defs>
+
+ type vm_cache_statistics_data_t = struct[11] of integer_t;
+
+@@ -63,3 +64,11 @@ simpleroutine thread_terminate_release(
+ reply_port : mach_port_name_t;
+ address : vm_address_t;
+ size : vm_size_t);
++
++/*
++ * Set the name of task TASK to NAME. This is a debugging aid.
++ * NAME will be used in error messages printed by the kernel.
++ */
++simpleroutine task_set_name(
++ task : task_t;
++ name : kernel_debug_name_t);
diff --git a/debian/patches/series b/debian/patches/series
index 81e99a2..edbebe0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,3 +11,4 @@ git-cursor_init.patch
git-coverity-fixes.patch
git-mig-inlines.patch
git-quiet-cd-floppy.patch
+git-task_set_name.patch
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/gnumach.git