Alexandre Julliard | 43c190e | 1999-05-15 10:48:19 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Wine server processes |
| 3 | * |
| 4 | * Copyright (C) 1999 Alexandre Julliard |
| 5 | */ |
| 6 | |
| 7 | #ifndef __WINE_SERVER_PROCESS_H |
| 8 | #define __WINE_SERVER_PROCESS_H |
| 9 | |
| 10 | #ifndef __WINE_SERVER__ |
| 11 | #error This file can only be used in the Wine server |
| 12 | #endif |
| 13 | |
| 14 | #include "object.h" |
| 15 | |
Alexandre Julliard | c5e433a | 2000-05-30 19:48:18 +0000 | [diff] [blame] | 16 | struct msg_queue; |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame] | 17 | struct atom_table; |
Alexandre Julliard | c5e433a | 2000-05-30 19:48:18 +0000 | [diff] [blame] | 18 | |
Alexandre Julliard | 43c190e | 1999-05-15 10:48:19 +0000 | [diff] [blame] | 19 | /* process structures */ |
| 20 | |
Alexandre Julliard | 05f0b71 | 2000-03-09 18:18:41 +0000 | [diff] [blame] | 21 | struct process_dll |
| 22 | { |
| 23 | struct process_dll *next; /* per-process dll list */ |
| 24 | struct process_dll *prev; |
| 25 | struct file *file; /* dll file */ |
| 26 | void *base; /* dll base address (in process addr space) */ |
| 27 | void *name; /* ptr to ptr to name (in process addr space) */ |
| 28 | int dbg_offset; /* debug info offset */ |
| 29 | int dbg_size; /* debug info size */ |
| 30 | }; |
| 31 | |
Alexandre Julliard | 3da5f84 | 1999-05-16 16:54:54 +0000 | [diff] [blame] | 32 | struct process |
| 33 | { |
| 34 | struct object obj; /* object header */ |
| 35 | struct process *next; /* system-wide process list */ |
| 36 | struct process *prev; |
| 37 | struct thread *thread_list; /* head of the thread list */ |
Alexandre Julliard | 3da5f84 | 1999-05-16 16:54:54 +0000 | [diff] [blame] | 38 | struct thread *debugger; /* thread debugging this process */ |
Alexandre Julliard | eb2e77f | 1999-06-04 19:49:54 +0000 | [diff] [blame] | 39 | struct object *handles; /* handle entries */ |
Alexandre Julliard | 3da5f84 | 1999-05-16 16:54:54 +0000 | [diff] [blame] | 40 | int exit_code; /* process exit code */ |
| 41 | int running_threads; /* number of threads running in this process */ |
| 42 | struct timeval start_time; /* absolute time at process start */ |
| 43 | struct timeval end_time; /* absolute time at process end */ |
| 44 | int priority; /* priority class */ |
| 45 | int affinity; /* process affinity mask */ |
| 46 | int suspend; /* global process suspend count */ |
Alexandre Julliard | d083a7b | 1999-11-29 02:10:56 +0000 | [diff] [blame] | 47 | int create_flags; /* process creation flags */ |
Alexandre Julliard | 3da5f84 | 1999-05-16 16:54:54 +0000 | [diff] [blame] | 48 | struct object *console_in; /* console input */ |
| 49 | struct object *console_out; /* console output */ |
Alexandre Julliard | ec7bb23 | 1999-11-12 03:35:25 +0000 | [diff] [blame] | 50 | struct event *init_event; /* event for init done */ |
Alexandre Julliard | c5e433a | 2000-05-30 19:48:18 +0000 | [diff] [blame] | 51 | struct event *idle_event; /* event for input idle */ |
| 52 | struct msg_queue *queue; /* main message queue */ |
Turchanov Sergei | 43a27e3 | 2000-05-30 20:32:06 +0000 | [diff] [blame] | 53 | struct atom_table *atom_table; /* pointer to local atom table */ |
Alexandre Julliard | 05f0b71 | 2000-03-09 18:18:41 +0000 | [diff] [blame] | 54 | struct process_dll exe; /* main exe file */ |
Alexandre Julliard | 0a7c1f6 | 2000-01-27 02:54:17 +0000 | [diff] [blame] | 55 | void *ldt_copy; /* pointer to LDT copy in client addr space */ |
| 56 | void *ldt_flags; /* pointer to LDT flags in client addr space */ |
Alexandre Julliard | 3da5f84 | 1999-05-16 16:54:54 +0000 | [diff] [blame] | 57 | }; |
Alexandre Julliard | 43c190e | 1999-05-15 10:48:19 +0000 | [diff] [blame] | 58 | |
| 59 | struct process_snapshot |
| 60 | { |
| 61 | struct process *process; /* process ptr */ |
| 62 | struct process *parent; /* process parent */ |
Alexandre Julliard | 07d8446 | 2000-04-16 19:45:05 +0000 | [diff] [blame] | 63 | int count; /* process refcount */ |
Alexandre Julliard | 43c190e | 1999-05-15 10:48:19 +0000 | [diff] [blame] | 64 | int threads; /* number of threads */ |
| 65 | int priority; /* priority class */ |
| 66 | }; |
| 67 | |
Alexandre Julliard | 07d8446 | 2000-04-16 19:45:05 +0000 | [diff] [blame] | 68 | struct module_snapshot |
| 69 | { |
| 70 | void *base; /* module base addr */ |
| 71 | }; |
| 72 | |
Alexandre Julliard | 43c190e | 1999-05-15 10:48:19 +0000 | [diff] [blame] | 73 | /* process functions */ |
| 74 | |
Alexandre Julliard | 5b4f3e8 | 2000-05-01 16:24:22 +0000 | [diff] [blame] | 75 | extern struct thread *create_process( int fd ); |
Alexandre Julliard | 43c190e | 1999-05-15 10:48:19 +0000 | [diff] [blame] | 76 | extern struct process *get_process_from_id( void *id ); |
| 77 | extern struct process *get_process_from_handle( int handle, unsigned int access ); |
Alexandre Julliard | 3da5f84 | 1999-05-16 16:54:54 +0000 | [diff] [blame] | 78 | extern int process_set_debugger( struct process *process, struct thread *thread ); |
Alexandre Julliard | 43c190e | 1999-05-15 10:48:19 +0000 | [diff] [blame] | 79 | extern void add_process_thread( struct process *process, |
| 80 | struct thread *thread ); |
| 81 | extern void remove_process_thread( struct process *process, |
| 82 | struct thread *thread ); |
Alexandre Julliard | 3da5f84 | 1999-05-16 16:54:54 +0000 | [diff] [blame] | 83 | extern void suspend_process( struct process *process ); |
| 84 | extern void resume_process( struct process *process ); |
Alexandre Julliard | 17cf810 | 1999-11-24 01:22:14 +0000 | [diff] [blame] | 85 | extern void kill_debugged_processes( struct thread *debugger, int exit_code ); |
Alexandre Julliard | 43c190e | 1999-05-15 10:48:19 +0000 | [diff] [blame] | 86 | extern struct process_snapshot *process_snap( int *count ); |
Alexandre Julliard | 07d8446 | 2000-04-16 19:45:05 +0000 | [diff] [blame] | 87 | extern struct module_snapshot *module_snap( struct process *process, int *count ); |
Alexandre Julliard | 43c190e | 1999-05-15 10:48:19 +0000 | [diff] [blame] | 88 | |
Alexandre Julliard | ff81d78 | 2000-03-08 12:01:30 +0000 | [diff] [blame] | 89 | static inline void *get_process_id( struct process *process ) { return process; } |
| 90 | |
Alexandre Julliard | 43c190e | 1999-05-15 10:48:19 +0000 | [diff] [blame] | 91 | #endif /* __WINE_SERVER_PROCESS_H */ |