[runtime] Free rgctx_lazy_fetch_trampoline info
[mono.git] / mono / io-layer / process-private.h
1 /*
2  * process-private.h: Private definitions for process handles
3  *
4  * Author:
5  *      Dick Porter (dick@ximian.com)
6  *
7  * (C) 2002-2006 Novell, Inc.
8  */
9
10 #ifndef _WAPI_PROCESS_PRIVATE_H_
11 #define _WAPI_PROCESS_PRIVATE_H_
12
13 #include <config.h>
14 #include <glib.h>
15
16 #include <mono/utils/mono-os-semaphore.h>
17
18 /* There doesn't seem to be a defined symbol for this */
19 #define _WAPI_PROCESS_CURRENT (gpointer)0xFFFFFFFF
20
21 /*
22  * Handles > _WAPI_PROCESS_UNHANDLED are pseudo handles which represent processes
23  * not started by the runtime.
24  */
25 /* This marks a system process that we don't have a handle on */
26 /* FIXME: Cope with PIDs > sizeof guint */
27 #define _WAPI_PROCESS_UNHANDLED (1 << (8*sizeof(pid_t)-1))
28 #define _WAPI_PROCESS_UNHANDLED_PID_MASK (-1 & ~_WAPI_PROCESS_UNHANDLED)
29 #define WAPI_IS_PSEUDO_PROCESS_HANDLE(handle) ((GPOINTER_TO_UINT(handle) & _WAPI_PROCESS_UNHANDLED) == _WAPI_PROCESS_UNHANDLED)
30 #define WAPI_PID_TO_HANDLE(pid) GINT_TO_POINTER (_WAPI_PROCESS_UNHANDLED + (pid))
31 #define WAPI_HANDLE_TO_PID(handle) (GPOINTER_TO_UINT ((handle)) - _WAPI_PROCESS_UNHANDLED)
32
33 void wapi_processes_init (void);
34 extern gpointer _wapi_process_duplicate (void);
35 extern void wapi_processes_cleanup (void);
36
37 extern struct _WapiHandleOps _wapi_process_ops;
38
39 /*
40  * MonoProcess describes processes we create.
41  * It contains a semaphore that can be waited on in order to wait
42  * for process termination. It's accessed in our SIGCHLD handler,
43  * when status is updated (and pid cleared, to not clash with 
44  * subsequent processes that may get executed).
45  */
46 struct MonoProcess {
47         pid_t pid; /* the pid of the process. This value is only valid until the process has exited. */
48         MonoSemType exit_sem; /* this semaphore will be released when the process exits */
49         int status; /* the exit status */
50         gint32 handle_count; /* the number of handles to this mono_process instance */
51         /* we keep a ref to the creating _WapiHandle_process handle until
52          * the process has exited, so that the information there isn't lost.
53          */
54         gpointer handle;
55         gboolean freeable;
56         struct MonoProcess *next;
57 };
58
59 typedef struct MonoProcess MonoProcess;
60
61 /*
62  * _WapiHandle_process is a structure containing all the required information
63  * for process handling.
64  */
65 struct _WapiHandle_process
66 {
67         pid_t id;
68         guint32 exitstatus;
69         gpointer main_thread;
70         WapiFileTime create_time;
71         WapiFileTime exit_time;
72         char *proc_name;
73         size_t min_working_set;
74         size_t max_working_set;
75         gboolean exited;
76         struct MonoProcess *mono_process;
77 };
78
79 typedef struct _WapiHandle_process WapiHandle_process;
80
81 #endif /* _WAPI_PROCESS_PRIVATE_H_ */