diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-02-04 12:51:02 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-02-04 12:51:02 +0100 |
commit | 4507e14b35a496b913ff35e72ad9ae348e69cf38 (patch) | |
tree | 0f9fff258d9434e641f1715f99a054f7ac5bf99b | |
parent | a693305ea05c405fe05b09061eee1fafc08d9e30 (diff) | |
parent | 7353f589daccb7fb61880d6994f6471e103da902 (diff) |
Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/gnumach
-rw-r--r-- | include/mach_debug/mach_debug_types.defs | 2 | ||||
-rw-r--r-- | include/mach_debug/mach_debug_types.h | 11 | ||||
-rw-r--r-- | ipc/mach_port.c | 4 | ||||
-rw-r--r-- | kern/ipc_kobject.c | 23 | ||||
-rw-r--r-- | kern/printf.c | 10 | ||||
-rw-r--r-- | kern/printf.h | 1 | ||||
-rw-r--r-- | kern/task.c | 3 | ||||
-rw-r--r-- | kern/task.h | 9 | ||||
-rw-r--r-- | vm/memory_object_proxy.h | 11 |
9 files changed, 50 insertions, 24 deletions
diff --git a/include/mach_debug/mach_debug_types.defs b/include/mach_debug/mach_debug_types.defs index f60125a..d24b6f9 100644 --- a/include/mach_debug/mach_debug_types.defs +++ b/include/mach_debug/mach_debug_types.defs @@ -57,6 +57,8 @@ type vm_page_info_array_t = array[] of vm_page_info_t; type symtab_name_t = (MACH_MSG_TYPE_STRING_C, 8*32); +type kernel_debug_name_t = c_string[*: 64]; + import <mach_debug/mach_debug_types.h>; #endif /* _MACH_DEBUG_MACH_DEBUG_TYPES_DEFS_ */ diff --git a/include/mach_debug/mach_debug_types.h b/include/mach_debug/mach_debug_types.h index 5d4efcd..9c7d1fd 100644 --- a/include/mach_debug/mach_debug_types.h +++ b/include/mach_debug/mach_debug_types.h @@ -37,4 +37,15 @@ typedef char symtab_name_t[32]; +/* + * A fixed-length string data type intended for names given to + * kernel objects. + * + * Note that it is not guaranteed that the in-kernel data + * structure will hold KERNEL_DEBUG_NAME_MAX bytes. The given + * name will be truncated to fit into the target data structure. + */ +#define KERNEL_DEBUG_NAME_MAX (64) +typedef char kernel_debug_name_t[KERNEL_DEBUG_NAME_MAX]; + #endif /* _MACH_DEBUG_MACH_DEBUG_TYPES_H_ */ 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"); } diff --git a/kern/ipc_kobject.c b/kern/ipc_kobject.c index 37d4eb9..13af820 100644 --- a/kern/ipc_kobject.c +++ b/kern/ipc_kobject.c @@ -49,6 +49,18 @@ #include <vm/memory_object_proxy.h> #include <device/ds_routines.h> +#include <kern/mach.server.h> +#include <ipc/mach_port.server.h> +#include <kern/mach_host.server.h> +#include <device/device.server.h> +#include <device/device_pager.server.h> +#include <kern/mach4.server.h> +#include <kern/gnumach.server.h> + +#if MACH_DEBUG +#include <kern/mach_debug.server.h> +#endif + #if MACH_MACHINE_ROUTINES #include <machine/machine_routines.h> #endif @@ -146,17 +158,6 @@ ipc_kobject_server(request) * to perform the kernel function */ { - extern mig_routine_t mach_server_routine(), - mach_port_server_routine(), - mach_host_server_routine(), - device_server_routine(), - device_pager_server_routine(), - mach4_server_routine(), - gnumach_server_routine(); -#if MACH_DEBUG - extern mig_routine_t mach_debug_server_routine(); -#endif - #if MACH_MACHINE_ROUTINES extern mig_routine_t MACHINE_SERVER_ROUTINE(); #endif diff --git a/kern/printf.c b/kern/printf.c index af59d5a..ea78d48 100644 --- a/kern/printf.c +++ b/kern/printf.c @@ -615,6 +615,16 @@ vsnprintf(char *buf, size_t size, const char *fmt, va_list args) return cookie.index; } +int +snprintf(char *buf, size_t size, const char *fmt, ...) +{ + int written; + va_list listp; + va_start(listp, fmt); + written = vsnprintf(buf, size, fmt, listp); + va_end(listp); + return written; +} void safe_gets(str, maxlen) char *str; diff --git a/kern/printf.h b/kern/printf.h index 8b4e760..0f8b328 100644 --- a/kern/printf.h +++ b/kern/printf.h @@ -40,6 +40,7 @@ extern void printnum (unsigned long u, int base, vm_offset_t putc_arg); extern int sprintf (char *buf, const char *fmt, ...); +extern int snprintf (char *buf, size_t size, const char *fmt, ...); extern int vsnprintf (char *buf, size_t size, const char *fmt, va_list args); extern int printf (const char *fmt, ...); 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) diff --git a/vm/memory_object_proxy.h b/vm/memory_object_proxy.h index 3de6996..dc0ea74 100644 --- a/vm/memory_object_proxy.h +++ b/vm/memory_object_proxy.h @@ -30,17 +30,6 @@ extern void memory_object_proxy_init (void); extern boolean_t memory_object_proxy_notify (mach_msg_header_t *msg); -extern kern_return_t memory_object_create_proxy (const ipc_space_t space, - vm_prot_t max_protection, - ipc_port_t *object, - natural_t object_count, - const vm_offset_t *offset, - natural_t offset_count, - const vm_offset_t *start, - natural_t start_count, - const vm_offset_t *len, - natural_t len_count, - ipc_port_t *port); extern kern_return_t memory_object_proxy_lookup (ipc_port_t port, ipc_port_t *object, vm_prot_t *max_protection); |