blob: 204fd04f44f553b5a591da2614614b90999c637e [file] [log] [blame]
Alexandre Julliard43c190e1999-05-15 10:48:19 +00001/*
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 Julliardc5e433a2000-05-30 19:48:18 +000016struct msg_queue;
Turchanov Sergei43a27e32000-05-30 20:32:06 +000017struct atom_table;
Alexandre Julliardc5e433a2000-05-30 19:48:18 +000018
Alexandre Julliard43c190e1999-05-15 10:48:19 +000019/* process structures */
20
Alexandre Julliard05f0b712000-03-09 18:18:41 +000021struct 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 Julliard3da5f841999-05-16 16:54:54 +000032struct 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 Julliard3da5f841999-05-16 16:54:54 +000038 struct thread *debugger; /* thread debugging this process */
Alexandre Julliardeb2e77f1999-06-04 19:49:54 +000039 struct object *handles; /* handle entries */
Alexandre Julliard3da5f841999-05-16 16:54:54 +000040 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 Julliardd083a7b1999-11-29 02:10:56 +000047 int create_flags; /* process creation flags */
Alexandre Julliard3da5f841999-05-16 16:54:54 +000048 struct object *console_in; /* console input */
49 struct object *console_out; /* console output */
Alexandre Julliardec7bb231999-11-12 03:35:25 +000050 struct event *init_event; /* event for init done */
Alexandre Julliardc5e433a2000-05-30 19:48:18 +000051 struct event *idle_event; /* event for input idle */
52 struct msg_queue *queue; /* main message queue */
Turchanov Sergei43a27e32000-05-30 20:32:06 +000053 struct atom_table *atom_table; /* pointer to local atom table */
Alexandre Julliard05f0b712000-03-09 18:18:41 +000054 struct process_dll exe; /* main exe file */
Alexandre Julliard0a7c1f62000-01-27 02:54:17 +000055 void *ldt_copy; /* pointer to LDT copy in client addr space */
56 void *ldt_flags; /* pointer to LDT flags in client addr space */
Alexandre Julliard3da5f841999-05-16 16:54:54 +000057};
Alexandre Julliard43c190e1999-05-15 10:48:19 +000058
59struct process_snapshot
60{
61 struct process *process; /* process ptr */
62 struct process *parent; /* process parent */
Alexandre Julliard07d84462000-04-16 19:45:05 +000063 int count; /* process refcount */
Alexandre Julliard43c190e1999-05-15 10:48:19 +000064 int threads; /* number of threads */
65 int priority; /* priority class */
66};
67
Alexandre Julliard07d84462000-04-16 19:45:05 +000068struct module_snapshot
69{
70 void *base; /* module base addr */
71};
72
Alexandre Julliard43c190e1999-05-15 10:48:19 +000073/* process functions */
74
Alexandre Julliard5b4f3e82000-05-01 16:24:22 +000075extern struct thread *create_process( int fd );
Alexandre Julliard43c190e1999-05-15 10:48:19 +000076extern struct process *get_process_from_id( void *id );
77extern struct process *get_process_from_handle( int handle, unsigned int access );
Alexandre Julliard3da5f841999-05-16 16:54:54 +000078extern int process_set_debugger( struct process *process, struct thread *thread );
Alexandre Julliard43c190e1999-05-15 10:48:19 +000079extern void add_process_thread( struct process *process,
80 struct thread *thread );
81extern void remove_process_thread( struct process *process,
82 struct thread *thread );
Alexandre Julliard3da5f841999-05-16 16:54:54 +000083extern void suspend_process( struct process *process );
84extern void resume_process( struct process *process );
Alexandre Julliard17cf8101999-11-24 01:22:14 +000085extern void kill_debugged_processes( struct thread *debugger, int exit_code );
Alexandre Julliard43c190e1999-05-15 10:48:19 +000086extern struct process_snapshot *process_snap( int *count );
Alexandre Julliard07d84462000-04-16 19:45:05 +000087extern struct module_snapshot *module_snap( struct process *process, int *count );
Alexandre Julliard43c190e1999-05-15 10:48:19 +000088
Alexandre Julliardff81d782000-03-08 12:01:30 +000089static inline void *get_process_id( struct process *process ) { return process; }
90
Alexandre Julliard43c190e1999-05-15 10:48:19 +000091#endif /* __WINE_SERVER_PROCESS_H */