Finish any pending WaitCommEvents if the event mask is set to 0.
[wine] / server / process.h
1 /*
2  * Wine server processes
3  *
4  * Copyright (C) 1999 Alexandre Julliard
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #ifndef __WINE_SERVER_PROCESS_H
22 #define __WINE_SERVER_PROCESS_H
23
24 #include "object.h"
25
26 struct msg_queue;
27 struct atom_table;
28
29 /* process structures */
30
31 struct process_dll
32 {
33     struct process_dll  *next;            /* per-process dll list */
34     struct process_dll  *prev;
35     struct file         *file;            /* dll file */
36     void                *base;            /* dll base address (in process addr space) */
37     void                *name;            /* ptr to ptr to name (in process addr space) */
38     int                  dbg_offset;      /* debug info offset */
39     int                  dbg_size;        /* debug info size */
40 };
41
42 struct process
43 {
44     struct object        obj;             /* object header */
45     struct process      *next;            /* system-wide process list */
46     struct process      *prev;
47     struct process      *parent;          /* parent process */
48     struct thread       *thread_list;     /* head of the thread list */
49     struct thread       *debugger;        /* thread debugging this process */
50     struct object       *handles;         /* handle entries */
51     int                  exit_code;       /* process exit code */
52     int                  running_threads; /* number of threads running in this process */
53     struct timeval       start_time;      /* absolute time at process start */
54     struct timeval       end_time;        /* absolute time at process end */
55     int                  priority;        /* priority class */
56     int                  affinity;        /* process affinity mask */
57     int                  suspend;         /* global process suspend count */
58     int                  create_flags;    /* process creation flags */
59     struct console_input*console;         /* console input */
60     struct event        *init_event;      /* event for init done */
61     struct event        *idle_event;      /* event for input idle */
62     struct msg_queue    *queue;           /* main message queue */
63     struct atom_table   *atom_table;      /* pointer to local atom table */
64     struct process_dll   exe;             /* main exe file */
65     void                *ldt_copy;        /* pointer to LDT copy in client addr space */
66     void                *ldt_flags;       /* pointer to LDT flags in client addr space */
67 };
68
69 struct process_snapshot
70 {
71     struct process *process;  /* process ptr */
72     int             count;    /* process refcount */
73     int             threads;  /* number of threads */
74     int             priority; /* priority class */
75 };
76
77 struct module_snapshot
78 {
79     void           *base;     /* module base addr */
80 };
81
82 /* process functions */
83
84 extern struct thread *create_process( int fd );
85 extern struct process *get_process_from_id( void *id );
86 extern struct process *get_process_from_handle( handle_t handle, unsigned int access );
87 extern int process_set_debugger( struct process *process, struct thread *thread );
88 extern int debugger_detach( struct process* process, struct thread* debugger );
89
90 extern void add_process_thread( struct process *process,
91                                 struct thread *thread );
92 extern void remove_process_thread( struct process *process,
93                                    struct thread *thread );
94 extern void suspend_process( struct process *process );
95 extern void resume_process( struct process *process );
96 extern void kill_process( struct process *process, struct thread *skip, int exit_code );
97 extern void kill_console_processes( struct thread *renderer, int exit_code );
98 extern void kill_debugged_processes( struct thread *debugger, int exit_code );
99 extern void detach_debugged_processes( struct thread *debugger );
100 extern struct process_snapshot *process_snap( int *count );
101 extern struct module_snapshot *module_snap( struct process *process, int *count );
102
103 static inline void *get_process_id( struct process *process ) { return process; }
104
105 #endif  /* __WINE_SERVER_PROCESS_H */