Mmap does not fail on zero-length files.
[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 /* process structures */
17
18 struct process_dll
19 {
20     struct process_dll  *next;            /* per-process dll list */
21     struct process_dll  *prev;
22     struct file         *file;            /* dll file */
23     void                *base;            /* dll base address (in process addr space) */
24     void                *name;            /* ptr to ptr to name (in process addr space) */
25     int                  dbg_offset;      /* debug info offset */
26     int                  dbg_size;        /* debug info size */
27 };
28
29 struct process
30 {
31     struct object        obj;             /* object header */
32     struct process      *next;            /* system-wide process list */
33     struct process      *prev;
34     struct thread       *thread_list;     /* head of the thread list */
35     struct thread       *debugger;        /* thread debugging this process */
36     struct object       *handles;         /* handle entries */
37     int                  exit_code;       /* process exit code */
38     int                  running_threads; /* number of threads running in this process */
39     struct timeval       start_time;      /* absolute time at process start */
40     struct timeval       end_time;        /* absolute time at process end */
41     int                  priority;        /* priority class */
42     int                  affinity;        /* process affinity mask */
43     int                  suspend;         /* global process suspend count */
44     int                  create_flags;    /* process creation flags */
45     struct object       *console_in;      /* console input */
46     struct object       *console_out;     /* console output */
47     struct event        *init_event;      /* event for init done */
48     struct process_dll   exe;             /* main exe file */
49     void                *ldt_copy;        /* pointer to LDT copy in client addr space */
50     void                *ldt_flags;       /* pointer to LDT flags in client addr space */
51 };
52
53 struct process_snapshot
54 {
55     struct process *process;  /* process ptr */
56     struct process *parent;   /* process parent */
57     int             count;    /* process refcount */
58     int             threads;  /* number of threads */
59     int             priority; /* priority class */
60 };
61
62 struct module_snapshot
63 {
64     void           *base;     /* module base addr */
65 };
66
67 /* process functions */
68
69 extern struct thread *create_process( int fd );
70 extern struct process *get_process_from_id( void *id );
71 extern struct process *get_process_from_handle( int handle, unsigned int access );
72 extern int process_set_debugger( struct process *process, struct thread *thread );
73 extern void add_process_thread( struct process *process,
74                                 struct thread *thread );
75 extern void remove_process_thread( struct process *process,
76                                    struct thread *thread );
77 extern void suspend_process( struct process *process );
78 extern void resume_process( struct process *process );
79 extern void kill_debugged_processes( struct thread *debugger, int exit_code );
80 extern struct process_snapshot *process_snap( int *count );
81 extern struct module_snapshot *module_snap( struct process *process, int *count );
82
83 static inline void *get_process_id( struct process *process ) { return process; }
84
85 #endif  /* __WINE_SERVER_PROCESS_H */