2 * Wine server processes
4 * Copyright (C) 1999 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __WINE_SERVER_PROCESS_H
22 #define __WINE_SERVER_PROCESS_H
30 /* process startup state */
31 enum startup_state
{ STARTUP_IN_PROGRESS
, STARTUP_DONE
, STARTUP_ABORTED
};
33 /* process structures */
37 struct process_dll
*next
; /* per-process dll list */
38 struct process_dll
*prev
;
39 struct file
*file
; /* dll file */
40 void *base
; /* dll base address (in process addr space) */
41 size_t size
; /* dll size */
42 void *name
; /* ptr to ptr to name (in process addr space) */
43 int dbg_offset
; /* debug info offset */
44 int dbg_size
; /* debug info size */
45 size_t namelen
; /* length of dll file name */
46 char *filename
; /* dll file name */
51 struct object obj
; /* object header */
52 struct process
*next
; /* system-wide process list */
54 struct process
*parent
; /* parent process */
55 struct thread
*thread_list
; /* head of the thread list */
56 struct thread
*debugger
; /* thread debugging this process */
57 struct object
*handles
; /* handle entries */
58 int exit_code
; /* process exit code */
59 int running_threads
; /* number of threads running in this process */
60 struct timeval start_time
; /* absolute time at process start */
61 struct timeval end_time
; /* absolute time at process end */
62 int priority
; /* priority class */
63 int affinity
; /* process affinity mask */
64 int suspend
; /* global process suspend count */
65 int create_flags
; /* process creation flags */
66 struct console_input
*console
; /* console input */
67 enum startup_state startup_state
; /* startup state */
68 struct startup_info
*startup_info
; /* startup info while init is in progress */
69 struct event
*idle_event
; /* event for input idle */
70 struct msg_queue
*queue
; /* main message queue */
71 struct atom_table
*atom_table
; /* pointer to local atom table */
72 struct process_dll exe
; /* main exe file */
73 void *ldt_copy
; /* pointer to LDT copy in client addr space */
74 void *ldt_flags
; /* pointer to LDT flags in client addr space */
75 void *group_id
; /* group ID of the process */
78 struct process_snapshot
80 struct process
*process
; /* process ptr */
81 int count
; /* process refcount */
82 int threads
; /* number of threads */
83 int priority
; /* priority class */
86 struct module_snapshot
88 void *base
; /* module base addr */
89 size_t size
; /* module size */
90 size_t namelen
; /* length of file name */
91 char *filename
; /* module file name */
94 /* process functions */
96 extern struct thread
*create_process( int fd
);
97 extern struct process
*get_process_from_id( void *id
);
98 extern struct process
*get_process_from_handle( obj_handle_t handle
, unsigned int access
);
99 extern int process_set_debugger( struct process
*process
, struct thread
*thread
);
100 extern int debugger_detach( struct process
* process
, struct thread
* debugger
);
102 extern void add_process_thread( struct process
*process
,
103 struct thread
*thread
);
104 extern void remove_process_thread( struct process
*process
,
105 struct thread
*thread
);
106 extern void suspend_process( struct process
*process
);
107 extern void resume_process( struct process
*process
);
108 extern void kill_all_processes( struct process
*skip
, int exit_code
);
109 extern void kill_process( struct process
*process
, struct thread
*skip
, int exit_code
);
110 extern void kill_console_processes( struct thread
*renderer
, int exit_code
);
111 extern void kill_debugged_processes( struct thread
*debugger
, int exit_code
);
112 extern void detach_debugged_processes( struct thread
*debugger
);
113 extern struct process_snapshot
*process_snap( int *count
);
114 extern struct module_snapshot
*module_snap( struct process
*process
, int *count
);
115 extern void enum_processes( int (*cb
)(struct process
*, void*), void *user
);
117 inline static void *get_process_id( struct process
*process
) { return process
; }
118 inline static int is_process_init_done( struct process
*process
)
120 return process
->startup_state
== STARTUP_DONE
;
123 #endif /* __WINE_SERVER_PROCESS_H */