Release 20030408.
[wine/gsoc-2012-control.git] / server / process.h
blobb79982a7153155e1ead46ef4de5d7665a064e58b
1 /*
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
24 #include "object.h"
26 struct msg_queue;
27 struct atom_table;
28 struct handle_table;
29 struct startup_info;
31 /* process startup state */
32 enum startup_state { STARTUP_IN_PROGRESS, STARTUP_DONE, STARTUP_ABORTED };
34 /* process structures */
36 struct process_dll
38 struct process_dll *next; /* per-process dll list */
39 struct process_dll *prev;
40 struct file *file; /* dll file */
41 void *base; /* dll base address (in process addr space) */
42 size_t size; /* dll size */
43 void *name; /* ptr to ptr to name (in process addr space) */
44 int dbg_offset; /* debug info offset */
45 int dbg_size; /* debug info size */
46 size_t namelen; /* length of dll file name */
47 char *filename; /* dll file name */
50 struct process
52 struct object obj; /* object header */
53 struct process *next; /* system-wide process list */
54 struct process *prev;
55 struct process *parent; /* parent process */
56 struct thread *thread_list; /* head of the thread list */
57 struct thread *debugger; /* thread debugging this process */
58 struct handle_table *handles; /* handle entries */
59 struct fd *msg_fd; /* fd for sendmsg/recvmsg */
60 process_id_t id; /* id of the process */
61 process_id_t group_id; /* group id of the process */
62 int exit_code; /* process exit code */
63 int running_threads; /* number of threads running in this process */
64 struct timeval start_time; /* absolute time at process start */
65 struct timeval end_time; /* absolute time at process end */
66 int priority; /* priority class */
67 int affinity; /* process affinity mask */
68 int suspend; /* global process suspend count */
69 int create_flags; /* process creation flags */
70 struct list locks; /* list of file locks owned by the process */
71 struct console_input*console; /* console input */
72 enum startup_state startup_state; /* startup state */
73 struct startup_info *startup_info; /* startup info while init is in progress */
74 struct event *idle_event; /* event for input idle */
75 struct msg_queue *queue; /* main message queue */
76 struct atom_table *atom_table; /* pointer to local atom table */
77 struct process_dll exe; /* main exe file */
78 void *ldt_copy; /* pointer to LDT copy in client addr space */
79 void *ldt_flags; /* pointer to LDT flags in client addr space */
82 struct process_snapshot
84 struct process *process; /* process ptr */
85 int count; /* process refcount */
86 int threads; /* number of threads */
87 int priority; /* priority class */
90 struct module_snapshot
92 void *base; /* module base addr */
93 size_t size; /* module size */
94 size_t namelen; /* length of file name */
95 char *filename; /* module file name */
98 /* process functions */
100 extern unsigned int alloc_ptid( void *ptr );
101 extern void free_ptid( unsigned int id );
102 extern void *get_ptid_entry( unsigned int id );
103 extern struct thread *create_process( int fd );
104 extern struct process *get_process_from_id( process_id_t id );
105 extern struct process *get_process_from_handle( obj_handle_t handle, unsigned int access );
106 extern int process_set_debugger( struct process *process, struct thread *thread );
107 extern int debugger_detach( struct process* process, struct thread* debugger );
109 extern void add_process_thread( struct process *process,
110 struct thread *thread );
111 extern void remove_process_thread( struct process *process,
112 struct thread *thread );
113 extern void suspend_process( struct process *process );
114 extern void resume_process( struct process *process );
115 extern void kill_all_processes( struct process *skip, int exit_code );
116 extern void kill_process( struct process *process, struct thread *skip, int exit_code );
117 extern void kill_console_processes( struct thread *renderer, int exit_code );
118 extern void kill_debugged_processes( struct thread *debugger, int exit_code );
119 extern void detach_debugged_processes( struct thread *debugger );
120 extern struct process_snapshot *process_snap( int *count );
121 extern struct module_snapshot *module_snap( struct process *process, int *count );
122 extern void enum_processes( int (*cb)(struct process*, void*), void *user);
124 inline static process_id_t get_process_id( struct process *process ) { return process->id; }
126 inline static int is_process_init_done( struct process *process )
128 return process->startup_state == STARTUP_DONE;
131 #endif /* __WINE_SERVER_PROCESS_H */