Added separate queue for "system" APCs that get called even when the
[wine] / server / process.h
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
16 struct msg_queue;
17 struct atom_table;
18
19 /* process structures */
20
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
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 */
38     struct thread       *debugger;        /* thread debugging this process */
39     struct object       *handles;         /* handle entries */
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 */
47     int                  create_flags;    /* process creation flags */
48     struct object       *console_in;      /* console input */
49     struct object       *console_out;     /* console output */
50     struct event        *init_event;      /* event for init done */
51     struct event        *idle_event;      /* event for input idle */
52     struct msg_queue    *queue;           /* main message queue */
53     struct atom_table   *atom_table;      /* pointer to local atom table */
54     struct process_dll   exe;             /* main exe file */
55     void                *ldt_copy;        /* pointer to LDT copy in client addr space */
56     void                *ldt_flags;       /* pointer to LDT flags in client addr space */
57 };
58
59 struct process_snapshot
60 {
61     struct process *process;  /* process ptr */
62     struct process *parent;   /* process parent */
63     int             count;    /* process refcount */
64     int             threads;  /* number of threads */
65     int             priority; /* priority class */
66 };
67
68 struct module_snapshot
69 {
70     void           *base;     /* module base addr */
71 };
72
73 /* process functions */
74
75 extern struct thread *create_process( int fd );
76 extern struct process *get_process_from_id( void *id );
77 extern struct process *get_process_from_handle( handle_t handle, unsigned int access );
78 extern int process_set_debugger( struct process *process, struct thread *thread );
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 );
83 extern void suspend_process( struct process *process );
84 extern void resume_process( struct process *process );
85 extern void kill_debugged_processes( struct thread *debugger, int exit_code );
86 extern struct process_snapshot *process_snap( int *count );
87 extern struct module_snapshot *module_snap( struct process *process, int *count );
88
89 static inline void *get_process_id( struct process *process ) { return process; }
90
91 #endif  /* __WINE_SERVER_PROCESS_H */