Made process and thread ids small integers instead of pointers.

This commit is contained in:
Alexandre Julliard 2003-02-01 01:38:40 +00:00
parent bb2210bc45
commit 91befe1d64
8 changed files with 166 additions and 76 deletions

View File

@ -114,6 +114,79 @@ static const struct object_ops startup_info_ops =
}; };
struct ptid_entry
{
void *ptr; /* entry ptr */
unsigned int next; /* next free entry */
};
static struct ptid_entry *ptid_entries; /* array of ptid entries */
static unsigned int used_ptid_entries; /* number of entries in use */
static unsigned int alloc_ptid_entries; /* number of allocated entries */
static unsigned int next_free_ptid; /* next free entry */
static unsigned int last_free_ptid; /* last free entry */
#define PTID_OFFSET 8 /* offset for first ptid value */
/* allocate a new process or thread id */
unsigned int alloc_ptid( void *ptr )
{
struct ptid_entry *entry;
unsigned int id;
if (used_ptid_entries < alloc_ptid_entries)
{
id = used_ptid_entries + PTID_OFFSET;
entry = &ptid_entries[used_ptid_entries++];
}
else if (next_free_ptid)
{
id = next_free_ptid;
entry = &ptid_entries[id - PTID_OFFSET];
if (!(next_free_ptid = entry->next)) last_free_ptid = 0;
}
else /* need to grow the array */
{
unsigned int count = alloc_ptid_entries + (alloc_ptid_entries / 2);
if (!count) count = 64;
if (!(entry = realloc( ptid_entries, count * sizeof(*entry) )))
{
set_error( STATUS_NO_MEMORY );
return 0;
}
ptid_entries = entry;
alloc_ptid_entries = count;
id = used_ptid_entries + PTID_OFFSET;
entry = &ptid_entries[used_ptid_entries++];
}
entry->ptr = ptr;
return id;
}
/* free a process or thread id */
void free_ptid( unsigned int id )
{
struct ptid_entry *entry = &ptid_entries[id - PTID_OFFSET];
entry->ptr = NULL;
entry->next = 0;
/* append to end of free list so that we don't reuse it too early */
if (last_free_ptid) ptid_entries[last_free_ptid - PTID_OFFSET].next = id;
else next_free_ptid = id;
last_free_ptid = id;
}
/* retrieve the pointer corresponding to a process or thread id */
void *get_ptid_entry( unsigned int id )
{
if (id < PTID_OFFSET) return NULL;
if (id - PTID_OFFSET >= used_ptid_entries) return NULL;
return ptid_entries[id - PTID_OFFSET].ptr;
}
/* set the state of the process startup info */ /* set the state of the process startup info */
static void set_process_startup_state( struct process *process, enum startup_state state ) static void set_process_startup_state( struct process *process, enum startup_state state )
{ {
@ -225,6 +298,8 @@ struct thread *create_process( int fd )
if ((process->next = first_process) != NULL) process->next->prev = process; if ((process->next = first_process) != NULL) process->next->prev = process;
first_process = process; first_process = process;
if (!(process->id = alloc_ptid( process ))) goto error;
/* create the main thread */ /* create the main thread */
if (pipe( request_pipe ) == -1) if (pipe( request_pipe ) == -1)
{ {
@ -339,6 +414,7 @@ static void process_destroy( struct object *obj )
if (process->atom_table) release_object( process->atom_table ); if (process->atom_table) release_object( process->atom_table );
if (process->exe.file) release_object( process->exe.file ); if (process->exe.file) release_object( process->exe.file );
if (process->exe.filename) free( process->exe.filename ); if (process->exe.filename) free( process->exe.filename );
if (process->id) free_ptid( process->id );
} }
/* dump a process on stdout for debugging purposes */ /* dump a process on stdout for debugging purposes */
@ -347,8 +423,8 @@ static void process_dump( struct object *obj, int verbose )
struct process *process = (struct process *)obj; struct process *process = (struct process *)obj;
assert( obj->ops == &process_ops ); assert( obj->ops == &process_ops );
fprintf( stderr, "Process next=%p prev=%p handles=%p\n", fprintf( stderr, "Process id=%04x next=%p prev=%p handles=%p\n",
process->next, process->prev, process->handles ); process->id, process->next, process->prev, process->handles );
} }
static int process_signaled( struct object *obj, struct thread *thread ) static int process_signaled( struct object *obj, struct thread *thread )
@ -400,11 +476,11 @@ static int startup_info_signaled( struct object *obj, struct thread *thread )
/* get a process from an id (and increment the refcount) */ /* get a process from an id (and increment the refcount) */
struct process *get_process_from_id( process_id_t id ) struct process *get_process_from_id( process_id_t id )
{ {
struct process *p = first_process; struct object *obj = get_ptid_entry( id );
while (p && (get_process_id(p) != id)) p = p->next;
if (p) grab_object( p ); if (obj && obj->ops == &process_ops) return (struct process *)grab_object( obj );
else set_error( STATUS_INVALID_PARAMETER ); set_error( STATUS_INVALID_PARAMETER );
return p; return NULL;
} }
/* get a process from a handle (and increment the refcount) */ /* get a process from a handle (and increment the refcount) */

View File

@ -56,6 +56,8 @@ struct process
struct thread *thread_list; /* head of the thread list */ struct thread *thread_list; /* head of the thread list */
struct thread *debugger; /* thread debugging this process */ struct thread *debugger; /* thread debugging this process */
struct handle_table *handles; /* handle entries */ struct handle_table *handles; /* handle entries */
process_id_t id; /* id of the process */
process_id_t group_id; /* group id of the process */
int exit_code; /* process exit code */ int exit_code; /* process exit code */
int running_threads; /* number of threads running in this process */ int running_threads; /* number of threads running in this process */
struct timeval start_time; /* absolute time at process start */ struct timeval start_time; /* absolute time at process start */
@ -73,7 +75,6 @@ struct process
struct process_dll exe; /* main exe file */ struct process_dll exe; /* main exe file */
void *ldt_copy; /* pointer to LDT copy in client addr space */ void *ldt_copy; /* pointer to LDT copy in client addr space */
void *ldt_flags; /* pointer to LDT flags in client addr space */ void *ldt_flags; /* pointer to LDT flags in client addr space */
process_id_t group_id; /* group ID of the process */
}; };
struct process_snapshot struct process_snapshot
@ -94,6 +95,9 @@ struct module_snapshot
/* process functions */ /* process functions */
extern unsigned int alloc_ptid( void *ptr );
extern void free_ptid( unsigned int id );
extern void *get_ptid_entry( unsigned int id );
extern struct thread *create_process( int fd ); extern struct thread *create_process( int fd );
extern struct process *get_process_from_id( process_id_t id ); extern struct process *get_process_from_id( process_id_t id );
extern struct process *get_process_from_handle( obj_handle_t handle, unsigned int access ); extern struct process *get_process_from_handle( obj_handle_t handle, unsigned int access );
@ -115,7 +119,8 @@ extern struct process_snapshot *process_snap( int *count );
extern struct module_snapshot *module_snap( struct process *process, int *count ); extern struct module_snapshot *module_snap( struct process *process, int *count );
extern void enum_processes( int (*cb)(struct process*, void*), void *user); extern void enum_processes( int (*cb)(struct process*, void*), void *user);
inline static process_id_t get_process_id( struct process *process ) { return (process_id_t)process; } inline static process_id_t get_process_id( struct process *process ) { return process->id; }
inline static int is_process_init_done( struct process *process ) inline static int is_process_init_done( struct process *process )
{ {
return process->startup_state == STARTUP_DONE; return process->startup_state == STARTUP_DONE;

View File

@ -75,7 +75,7 @@ static int handle_child_status( struct thread *thread, int pid, int status )
{ {
int sig = WSTOPSIG(status); int sig = WSTOPSIG(status);
if (debug_level && thread) if (debug_level && thread)
fprintf( stderr, "%08x: *signal* signal=%d\n", (unsigned int)thread, sig ); fprintf( stderr, "%04x: *signal* signal=%d\n", thread->id, sig );
switch(sig) switch(sig)
{ {
case SIGSTOP: /* continue at once if not suspended */ case SIGSTOP: /* continue at once if not suspended */
@ -97,11 +97,11 @@ static int handle_child_status( struct thread *thread, int pid, int status )
if (debug_level) if (debug_level)
{ {
if (WIFSIGNALED(status)) if (WIFSIGNALED(status))
fprintf( stderr, "%08x: *exited* signal=%d\n", fprintf( stderr, "%04x: *exited* signal=%d\n",
(unsigned int)thread, WTERMSIG(status) ); thread->id, WTERMSIG(status) );
else else
fprintf( stderr, "%08x: *exited* status=%d\n", fprintf( stderr, "%04x: *exited* status=%d\n",
(unsigned int)thread, WEXITSTATUS(status) ); thread->id, WEXITSTATUS(status) );
} }
} }
return 0; return 0;
@ -146,7 +146,7 @@ static int attach_thread( struct thread *thread )
if (errno == ESRCH) thread->unix_pid = 0; /* process got killed */ if (errno == ESRCH) thread->unix_pid = 0; /* process got killed */
return 0; return 0;
} }
if (debug_level) fprintf( stderr, "%08x: *attached*\n", (unsigned int)thread ); if (debug_level) fprintf( stderr, "%04x: *attached*\n", thread->id );
thread->attached = 1; thread->attached = 1;
wait4_thread( thread, SIGSTOP ); wait4_thread( thread, SIGSTOP );
return 1; return 1;
@ -161,7 +161,7 @@ void detach_thread( struct thread *thread, int sig )
/* make sure it is stopped */ /* make sure it is stopped */
suspend_thread( thread, 0 ); suspend_thread( thread, 0 );
if (sig) kill( thread->unix_pid, sig ); if (sig) kill( thread->unix_pid, sig );
if (debug_level) fprintf( stderr, "%08x: *detached*\n", (unsigned int)thread ); if (debug_level) fprintf( stderr, "%04x: *detached*\n", thread->id );
ptrace( PTRACE_DETACH, thread->unix_pid, (caddr_t)1, sig ); ptrace( PTRACE_DETACH, thread->unix_pid, (caddr_t)1, sig );
thread->suspend = 0; /* detach makes it continue */ thread->suspend = 0; /* detach makes it continue */
thread->attached = 0; thread->attached = 0;

View File

@ -351,15 +351,15 @@ int receive_fd( struct process *process )
if (!thread || thread->process != process || thread->state == TERMINATED) if (!thread || thread->process != process || thread->state == TERMINATED)
{ {
if (debug_level) if (debug_level)
fprintf( stderr, "%08x: *fd* %d <- %d bad thread id\n", fprintf( stderr, "%04x: *fd* %d <- %d bad thread id\n",
(unsigned int)data.tid, data.fd, fd ); data.tid, data.fd, fd );
close( fd ); close( fd );
} }
else else
{ {
if (debug_level) if (debug_level)
fprintf( stderr, "%08x: *fd* %d <- %d\n", fprintf( stderr, "%04x: *fd* %d <- %d\n",
(unsigned int)thread, data.fd, fd ); thread->id, data.fd, fd );
thread_add_inflight_fd( thread, data.fd, fd ); thread_add_inflight_fd( thread, data.fd, fd );
} }
if (thread) release_object( thread ); if (thread) release_object( thread );
@ -391,7 +391,8 @@ int send_client_fd( struct process *process, int fd, obj_handle_t handle )
int ret; int ret;
if (debug_level) if (debug_level)
fprintf( stderr, "%08x: *fd* %p -> %d\n", (unsigned int)current, handle, fd ); fprintf( stderr, "%04x: *fd* %p -> %d\n",
current ? current->id : process->id, handle, fd );
#ifdef HAVE_MSGHDR_ACCRIGHTS #ifdef HAVE_MSGHDR_ACCRIGHTS
msghdr.msg_accrightslen = sizeof(fd); msghdr.msg_accrightslen = sizeof(fd);

View File

@ -167,6 +167,12 @@ struct thread *create_thread( int fd, struct process *process )
if ((thread->next = first_thread) != NULL) thread->next->prev = thread; if ((thread->next = first_thread) != NULL) thread->next->prev = thread;
first_thread = thread; first_thread = thread;
if (!(thread->id = alloc_ptid( thread )))
{
release_object( thread );
return NULL;
}
set_select_events( &thread->obj, POLLIN ); /* start listening to events */ set_select_events( &thread->obj, POLLIN ); /* start listening to events */
add_process_thread( thread->process, thread ); add_process_thread( thread->process, thread );
return thread; return thread;
@ -236,6 +242,7 @@ static void destroy_thread( struct object *obj )
if (thread->info) release_object( thread->info ); if (thread->info) release_object( thread->info );
cleanup_thread( thread ); cleanup_thread( thread );
release_object( thread->process ); release_object( thread->process );
if (thread->id) free_ptid( thread->id );
} }
/* dump a thread on stdout for debugging purposes */ /* dump a thread on stdout for debugging purposes */
@ -244,8 +251,8 @@ static void dump_thread( struct object *obj, int verbose )
struct thread *thread = (struct thread *)obj; struct thread *thread = (struct thread *)obj;
assert( obj->ops == &thread_ops ); assert( obj->ops == &thread_ops );
fprintf( stderr, "Thread pid=%d teb=%p state=%d\n", fprintf( stderr, "Thread id=%04x unix pid=%d teb=%p state=%d\n",
thread->unix_pid, thread->teb, thread->state ); thread->id, thread->unix_pid, thread->teb, thread->state );
} }
static int thread_signaled( struct object *obj, struct thread *thread ) static int thread_signaled( struct object *obj, struct thread *thread )
@ -257,11 +264,11 @@ static int thread_signaled( struct object *obj, struct thread *thread )
/* get a thread pointer from a thread id (and increment the refcount) */ /* get a thread pointer from a thread id (and increment the refcount) */
struct thread *get_thread_from_id( thread_id_t id ) struct thread *get_thread_from_id( thread_id_t id )
{ {
struct thread *t = first_thread; struct object *obj = get_ptid_entry( id );
while (t && (get_thread_id(t) != id)) t = t->next;
if (t) grab_object( t ); if (obj && obj->ops == &thread_ops) return (struct thread *)grab_object( obj );
else set_error( STATUS_INVALID_PARAMETER ); set_error( STATUS_INVALID_PARAMETER );
return t; return NULL;
} }
/* get a thread from a handle (and increment the refcount) */ /* get a thread from a handle (and increment the refcount) */
@ -465,8 +472,8 @@ static int wake_thread( struct thread *thread )
if ((signaled = check_wait( thread )) == -1) break; if ((signaled = check_wait( thread )) == -1) break;
cookie = thread->wait->cookie; cookie = thread->wait->cookie;
if (debug_level) fprintf( stderr, "%08x: *wakeup* signaled=%d cookie=%p\n", if (debug_level) fprintf( stderr, "%04x: *wakeup* signaled=%d cookie=%p\n",
(unsigned int)thread, signaled, cookie ); thread->id, signaled, cookie );
end_wait( thread ); end_wait( thread );
if (send_thread_wakeup( thread, cookie, signaled ) == -1) /* error */ if (send_thread_wakeup( thread, cookie, signaled ) == -1) /* error */
break; break;
@ -484,8 +491,8 @@ static void thread_timeout( void *ptr )
wait->user = NULL; wait->user = NULL;
if (thread->wait != wait) return; /* not the top-level wait, ignore it */ if (thread->wait != wait) return; /* not the top-level wait, ignore it */
if (debug_level) fprintf( stderr, "%08x: *wakeup* signaled=%d cookie=%p\n", if (debug_level) fprintf( stderr, "%04x: *wakeup* signaled=%d cookie=%p\n",
(unsigned int)thread, STATUS_TIMEOUT, cookie ); thread->id, STATUS_TIMEOUT, cookie );
end_wait( thread ); end_wait( thread );
if (send_thread_wakeup( thread, cookie, STATUS_TIMEOUT ) == -1) return; if (send_thread_wakeup( thread, cookie, STATUS_TIMEOUT ) == -1) return;
/* check if other objects have become signaled in the meantime */ /* check if other objects have become signaled in the meantime */
@ -717,8 +724,8 @@ void kill_thread( struct thread *thread, int violent_death )
thread->exit_time = time(NULL); thread->exit_time = time(NULL);
if (current == thread) current = NULL; if (current == thread) current = NULL;
if (debug_level) if (debug_level)
fprintf( stderr,"%08x: *killed* exit_code=%d\n", fprintf( stderr,"%04x: *killed* exit_code=%d\n",
(unsigned int)thread, thread->exit_code ); thread->id, thread->exit_code );
if (thread->wait) if (thread->wait)
{ {
while (thread->wait) end_wait( thread ); while (thread->wait) end_wait( thread );

View File

@ -63,6 +63,7 @@ struct thread
struct thread *proc_next; /* per-process thread list */ struct thread *proc_next; /* per-process thread list */
struct thread *proc_prev; struct thread *proc_prev;
struct process *process; struct process *process;
thread_id_t id; /* thread id */
struct mutex *mutex; /* list of currently owned mutexes */ struct mutex *mutex; /* list of currently owned mutexes */
struct debug_ctx *debug_ctx; /* debugger context if this thread is a debugger */ struct debug_ctx *debug_ctx; /* debugger context if this thread is a debugger */
struct debug_event *debug_event; /* debug event being sent to debugger */ struct debug_event *debug_event; /* debug event being sent to debugger */
@ -143,6 +144,6 @@ static inline unsigned int get_error(void) { return current ? current->err
static inline void set_error( unsigned int err ) { global_error = err; if (current) current->error = err; } static inline void set_error( unsigned int err ) { global_error = err; if (current) current->error = err; }
static inline void clear_error(void) { set_error(0); } static inline void clear_error(void) { set_error(0); }
static inline thread_id_t get_thread_id( struct thread *thread ) { return (thread_id_t)thread; } static inline thread_id_t get_thread_id( struct thread *thread ) { return thread->id; }
#endif /* __WINE_SERVER_THREAD_H */ #endif /* __WINE_SERVER_THREAD_H */

View File

@ -372,9 +372,9 @@ static void dump_get_new_process_info_request( const struct get_new_process_info
static void dump_get_new_process_info_reply( const struct get_new_process_info_reply *req ) static void dump_get_new_process_info_reply( const struct get_new_process_info_reply *req )
{ {
fprintf( stderr, " pid=%08x,", req->pid ); fprintf( stderr, " pid=%04x,", req->pid );
fprintf( stderr, " phandle=%p,", req->phandle ); fprintf( stderr, " phandle=%p,", req->phandle );
fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " tid=%04x,", req->tid );
fprintf( stderr, " thandle=%p,", req->thandle ); fprintf( stderr, " thandle=%p,", req->thandle );
fprintf( stderr, " success=%d", req->success ); fprintf( stderr, " success=%d", req->success );
} }
@ -388,7 +388,7 @@ static void dump_new_thread_request( const struct new_thread_request *req )
static void dump_new_thread_reply( const struct new_thread_reply *req ) static void dump_new_thread_reply( const struct new_thread_reply *req )
{ {
fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " tid=%04x,", req->tid );
fprintf( stderr, " handle=%p", req->handle ); fprintf( stderr, " handle=%p", req->handle );
} }
@ -452,8 +452,8 @@ static void dump_init_thread_request( const struct init_thread_request *req )
static void dump_init_thread_reply( const struct init_thread_reply *req ) static void dump_init_thread_reply( const struct init_thread_reply *req )
{ {
fprintf( stderr, " pid=%08x,", req->pid ); fprintf( stderr, " pid=%04x,", req->pid );
fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " tid=%04x,", req->tid );
fprintf( stderr, " boot=%d,", req->boot ); fprintf( stderr, " boot=%d,", req->boot );
fprintf( stderr, " version=%d", req->version ); fprintf( stderr, " version=%d", req->version );
} }
@ -488,7 +488,7 @@ static void dump_get_process_info_request( const struct get_process_info_request
static void dump_get_process_info_reply( const struct get_process_info_reply *req ) static void dump_get_process_info_reply( const struct get_process_info_reply *req )
{ {
fprintf( stderr, " pid=%08x,", req->pid ); fprintf( stderr, " pid=%04x,", req->pid );
fprintf( stderr, " debugged=%d,", req->debugged ); fprintf( stderr, " debugged=%d,", req->debugged );
fprintf( stderr, " exit_code=%d,", req->exit_code ); fprintf( stderr, " exit_code=%d,", req->exit_code );
fprintf( stderr, " priority=%d,", req->priority ); fprintf( stderr, " priority=%d,", req->priority );
@ -507,12 +507,12 @@ static void dump_set_process_info_request( const struct set_process_info_request
static void dump_get_thread_info_request( const struct get_thread_info_request *req ) static void dump_get_thread_info_request( const struct get_thread_info_request *req )
{ {
fprintf( stderr, " handle=%p,", req->handle ); fprintf( stderr, " handle=%p,", req->handle );
fprintf( stderr, " tid_in=%08x", req->tid_in ); fprintf( stderr, " tid_in=%04x", req->tid_in );
} }
static void dump_get_thread_info_reply( const struct get_thread_info_reply *req ) static void dump_get_thread_info_reply( const struct get_thread_info_reply *req )
{ {
fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " tid=%04x,", req->tid );
fprintf( stderr, " teb=%p,", req->teb ); fprintf( stderr, " teb=%p,", req->teb );
fprintf( stderr, " exit_code=%d,", req->exit_code ); fprintf( stderr, " exit_code=%d,", req->exit_code );
fprintf( stderr, " priority=%d,", req->priority ); fprintf( stderr, " priority=%d,", req->priority );
@ -642,7 +642,7 @@ static void dump_dup_handle_reply( const struct dup_handle_reply *req )
static void dump_open_process_request( const struct open_process_request *req ) static void dump_open_process_request( const struct open_process_request *req )
{ {
fprintf( stderr, " pid=%08x,", req->pid ); fprintf( stderr, " pid=%04x,", req->pid );
fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " inherit=%d", req->inherit ); fprintf( stderr, " inherit=%d", req->inherit );
} }
@ -654,7 +654,7 @@ static void dump_open_process_reply( const struct open_process_reply *req )
static void dump_open_thread_request( const struct open_thread_request *req ) static void dump_open_thread_request( const struct open_thread_request *req )
{ {
fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " tid=%04x,", req->tid );
fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " inherit=%d", req->inherit ); fprintf( stderr, " inherit=%d", req->inherit );
} }
@ -967,7 +967,7 @@ static void dump_alloc_console_request( const struct alloc_console_request *req
{ {
fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " inherit=%d,", req->inherit ); fprintf( stderr, " inherit=%d,", req->inherit );
fprintf( stderr, " pid=%08x", req->pid ); fprintf( stderr, " pid=%04x", req->pid );
} }
static void dump_alloc_console_reply( const struct alloc_console_reply *req ) static void dump_alloc_console_reply( const struct alloc_console_reply *req )
@ -1212,7 +1212,7 @@ static void dump_move_console_output_request( const struct move_console_output_r
static void dump_send_console_signal_request( const struct send_console_signal_request *req ) static void dump_send_console_signal_request( const struct send_console_signal_request *req )
{ {
fprintf( stderr, " signal=%d,", req->signal ); fprintf( stderr, " signal=%d,", req->signal );
fprintf( stderr, " group_id=%08x", req->group_id ); fprintf( stderr, " group_id=%04x", req->group_id );
} }
static void dump_create_change_notification_request( const struct create_change_notification_request *req ) static void dump_create_change_notification_request( const struct create_change_notification_request *req )
@ -1289,7 +1289,7 @@ static void dump_create_snapshot_request( const struct create_snapshot_request *
{ {
fprintf( stderr, " inherit=%d,", req->inherit ); fprintf( stderr, " inherit=%d,", req->inherit );
fprintf( stderr, " flags=%d,", req->flags ); fprintf( stderr, " flags=%d,", req->flags );
fprintf( stderr, " pid=%08x", req->pid ); fprintf( stderr, " pid=%04x", req->pid );
} }
static void dump_create_snapshot_reply( const struct create_snapshot_reply *req ) static void dump_create_snapshot_reply( const struct create_snapshot_reply *req )
@ -1306,8 +1306,8 @@ static void dump_next_process_request( const struct next_process_request *req )
static void dump_next_process_reply( const struct next_process_reply *req ) static void dump_next_process_reply( const struct next_process_reply *req )
{ {
fprintf( stderr, " count=%d,", req->count ); fprintf( stderr, " count=%d,", req->count );
fprintf( stderr, " pid=%08x,", req->pid ); fprintf( stderr, " pid=%04x,", req->pid );
fprintf( stderr, " ppid=%08x,", req->ppid ); fprintf( stderr, " ppid=%04x,", req->ppid );
fprintf( stderr, " heap=%p,", req->heap ); fprintf( stderr, " heap=%p,", req->heap );
fprintf( stderr, " module=%p,", req->module ); fprintf( stderr, " module=%p,", req->module );
fprintf( stderr, " threads=%d,", req->threads ); fprintf( stderr, " threads=%d,", req->threads );
@ -1325,8 +1325,8 @@ static void dump_next_thread_request( const struct next_thread_request *req )
static void dump_next_thread_reply( const struct next_thread_reply *req ) static void dump_next_thread_reply( const struct next_thread_reply *req )
{ {
fprintf( stderr, " count=%d,", req->count ); fprintf( stderr, " count=%d,", req->count );
fprintf( stderr, " pid=%08x,", req->pid ); fprintf( stderr, " pid=%04x,", req->pid );
fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " tid=%04x,", req->tid );
fprintf( stderr, " base_pri=%d,", req->base_pri ); fprintf( stderr, " base_pri=%d,", req->base_pri );
fprintf( stderr, " delta_pri=%d", req->delta_pri ); fprintf( stderr, " delta_pri=%d", req->delta_pri );
} }
@ -1339,7 +1339,7 @@ static void dump_next_module_request( const struct next_module_request *req )
static void dump_next_module_reply( const struct next_module_reply *req ) static void dump_next_module_reply( const struct next_module_reply *req )
{ {
fprintf( stderr, " pid=%08x,", req->pid ); fprintf( stderr, " pid=%04x,", req->pid );
fprintf( stderr, " base=%p,", req->base ); fprintf( stderr, " base=%p,", req->base );
fprintf( stderr, " size=%d,", req->size ); fprintf( stderr, " size=%d,", req->size );
fprintf( stderr, " filename=" ); fprintf( stderr, " filename=" );
@ -1353,8 +1353,8 @@ static void dump_wait_debug_event_request( const struct wait_debug_event_request
static void dump_wait_debug_event_reply( const struct wait_debug_event_reply *req ) static void dump_wait_debug_event_reply( const struct wait_debug_event_reply *req )
{ {
fprintf( stderr, " pid=%08x,", req->pid ); fprintf( stderr, " pid=%04x,", req->pid );
fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " tid=%04x,", req->tid );
fprintf( stderr, " wait=%p,", req->wait ); fprintf( stderr, " wait=%p,", req->wait );
fprintf( stderr, " event=" ); fprintf( stderr, " event=" );
dump_varargs_debug_event( cur_size ); dump_varargs_debug_event( cur_size );
@ -1393,14 +1393,14 @@ static void dump_output_debug_string_request( const struct output_debug_string_r
static void dump_continue_debug_event_request( const struct continue_debug_event_request *req ) static void dump_continue_debug_event_request( const struct continue_debug_event_request *req )
{ {
fprintf( stderr, " pid=%08x,", req->pid ); fprintf( stderr, " pid=%04x,", req->pid );
fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " tid=%04x,", req->tid );
fprintf( stderr, " status=%d", req->status ); fprintf( stderr, " status=%d", req->status );
} }
static void dump_debug_process_request( const struct debug_process_request *req ) static void dump_debug_process_request( const struct debug_process_request *req )
{ {
fprintf( stderr, " pid=%08x,", req->pid ); fprintf( stderr, " pid=%04x,", req->pid );
fprintf( stderr, " attach=%d", req->attach ); fprintf( stderr, " attach=%d", req->attach );
} }
@ -1761,7 +1761,7 @@ static void dump_wait_input_idle_reply( const struct wait_input_idle_reply *req
static void dump_send_message_request( const struct send_message_request *req ) static void dump_send_message_request( const struct send_message_request *req )
{ {
fprintf( stderr, " id=%08x,", req->id ); fprintf( stderr, " id=%04x,", req->id );
fprintf( stderr, " type=%d,", req->type ); fprintf( stderr, " type=%d,", req->type );
fprintf( stderr, " win=%p,", req->win ); fprintf( stderr, " win=%p,", req->win );
fprintf( stderr, " msg=%08x,", req->msg ); fprintf( stderr, " msg=%08x,", req->msg );
@ -2032,8 +2032,8 @@ static void dump_get_window_info_reply( const struct get_window_info_reply *req
{ {
fprintf( stderr, " full_handle=%p,", req->full_handle ); fprintf( stderr, " full_handle=%p,", req->full_handle );
fprintf( stderr, " last_active=%p,", req->last_active ); fprintf( stderr, " last_active=%p,", req->last_active );
fprintf( stderr, " pid=%08x,", req->pid ); fprintf( stderr, " pid=%04x,", req->pid );
fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " tid=%04x,", req->tid );
fprintf( stderr, " atom=%04x", req->atom ); fprintf( stderr, " atom=%04x", req->atom );
} }
@ -2073,7 +2073,7 @@ static void dump_get_window_children_request( const struct get_window_children_r
{ {
fprintf( stderr, " parent=%p,", req->parent ); fprintf( stderr, " parent=%p,", req->parent );
fprintf( stderr, " atom=%04x,", req->atom ); fprintf( stderr, " atom=%04x,", req->atom );
fprintf( stderr, " tid=%08x", req->tid ); fprintf( stderr, " tid=%04x", req->tid );
} }
static void dump_get_window_children_reply( const struct get_window_children_reply *req ) static void dump_get_window_children_reply( const struct get_window_children_reply *req )
@ -2204,14 +2204,14 @@ static void dump_get_window_properties_reply( const struct get_window_properties
static void dump_attach_thread_input_request( const struct attach_thread_input_request *req ) static void dump_attach_thread_input_request( const struct attach_thread_input_request *req )
{ {
fprintf( stderr, " tid_from=%08x,", req->tid_from ); fprintf( stderr, " tid_from=%04x,", req->tid_from );
fprintf( stderr, " tid_to=%08x,", req->tid_to ); fprintf( stderr, " tid_to=%04x,", req->tid_to );
fprintf( stderr, " attach=%d", req->attach ); fprintf( stderr, " attach=%d", req->attach );
} }
static void dump_get_thread_input_request( const struct get_thread_input_request *req ) static void dump_get_thread_input_request( const struct get_thread_input_request *req )
{ {
fprintf( stderr, " tid=%08x", req->tid ); fprintf( stderr, " tid=%04x", req->tid );
} }
static void dump_get_thread_input_reply( const struct get_thread_input_reply *req ) static void dump_get_thread_input_reply( const struct get_thread_input_reply *req )
@ -2229,7 +2229,7 @@ static void dump_get_thread_input_reply( const struct get_thread_input_reply *re
static void dump_get_key_state_request( const struct get_key_state_request *req ) static void dump_get_key_state_request( const struct get_key_state_request *req )
{ {
fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " tid=%04x,", req->tid );
fprintf( stderr, " key=%d", req->key ); fprintf( stderr, " key=%d", req->key );
} }
@ -2242,7 +2242,7 @@ static void dump_get_key_state_reply( const struct get_key_state_reply *req )
static void dump_set_key_state_request( const struct set_key_state_request *req ) static void dump_set_key_state_request( const struct set_key_state_request *req )
{ {
fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " tid=%04x,", req->tid );
fprintf( stderr, " keystate=" ); fprintf( stderr, " keystate=" );
dump_varargs_bytes( cur_size ); dump_varargs_bytes( cur_size );
} }
@ -2331,7 +2331,7 @@ static void dump_set_caret_info_reply( const struct set_caret_info_reply *req )
static void dump_set_hook_request( const struct set_hook_request *req ) static void dump_set_hook_request( const struct set_hook_request *req )
{ {
fprintf( stderr, " id=%d,", req->id ); fprintf( stderr, " id=%d,", req->id );
fprintf( stderr, " tid=%08x,", req->tid ); fprintf( stderr, " tid=%04x,", req->tid );
fprintf( stderr, " proc=%p,", req->proc ); fprintf( stderr, " proc=%p,", req->proc );
fprintf( stderr, " unicode=%d,", req->unicode ); fprintf( stderr, " unicode=%d,", req->unicode );
fprintf( stderr, " module=" ); fprintf( stderr, " module=" );
@ -2978,7 +2978,7 @@ void trace_request(void)
enum request req = current->req.request_header.req; enum request req = current->req.request_header.req;
if (req < REQ_NB_REQUESTS) if (req < REQ_NB_REQUESTS)
{ {
fprintf( stderr, "%08x: %s(", (unsigned int)current, req_names[req] ); fprintf( stderr, "%04x: %s(", current->id, req_names[req] );
if (req_dumpers[req]) if (req_dumpers[req])
{ {
cur_pos = 0; cur_pos = 0;
@ -2988,15 +2988,15 @@ void trace_request(void)
} }
fprintf( stderr, " )\n" ); fprintf( stderr, " )\n" );
} }
else fprintf( stderr, "%08x: %d(?)\n", (unsigned int)current, req ); else fprintf( stderr, "%04x: %d(?)\n", current->id, req );
} }
void trace_reply( enum request req, const union generic_reply *reply ) void trace_reply( enum request req, const union generic_reply *reply )
{ {
if (req < REQ_NB_REQUESTS) if (req < REQ_NB_REQUESTS)
{ {
fprintf( stderr, "%08x: %s() = %s", fprintf( stderr, "%04x: %s() = %s",
(unsigned int)current, req_names[req], get_status_name(current->error) ); current->id, req_names[req], get_status_name(current->error) );
if (reply_dumpers[req]) if (reply_dumpers[req])
{ {
fprintf( stderr, " {" ); fprintf( stderr, " {" );
@ -3008,6 +3008,6 @@ void trace_reply( enum request req, const union generic_reply *reply )
} }
fputc( '\n', stderr ); fputc( '\n', stderr );
} }
else fprintf( stderr, "%08x: %d() = %s\n", else fprintf( stderr, "%04x: %d() = %s\n",
(unsigned int)current, req, get_status_name(current->error) ); current->id, req, get_status_name(current->error) );
} }

View File

@ -34,8 +34,8 @@
"obj_handle_t" => "%p", "obj_handle_t" => "%p",
"atom_t" => "%04x", "atom_t" => "%04x",
"user_handle_t" => "%p", "user_handle_t" => "%p",
"process_id_t" => "%08x", "process_id_t" => "%04x",
"thread_id_t" => "%08x", "thread_id_t" => "%04x",
"rectangle_t" => "&dump_rectangle", "rectangle_t" => "&dump_rectangle",
"char_info_t" => "&dump_char_info", "char_info_t" => "&dump_char_info",
); );