2 * process-private.h: Private definitions for process handles
5 * Dick Porter (dick@ximian.com)
7 * (C) 2002-2006 Novell, Inc.
10 #ifndef _WAPI_PROCESS_PRIVATE_H_
11 #define _WAPI_PROCESS_PRIVATE_H_
16 /* There doesn't seem to be a defined symbol for this */
17 #define _WAPI_PROCESS_CURRENT (gpointer)0xFFFFFFFF
20 * Handles > _WAPI_PROCESS_UNHANDLED are pseudo handles which represent processes
21 * not started by the runtime.
23 /* This marks a system process that we don't have a handle on */
24 /* FIXME: Cope with PIDs > sizeof guint */
25 #define _WAPI_PROCESS_UNHANDLED (1 << (8*sizeof(pid_t)-1))
26 #define _WAPI_PROCESS_UNHANDLED_PID_MASK (-1 & ~_WAPI_PROCESS_UNHANDLED)
27 #define WAPI_IS_PSEUDO_PROCESS_HANDLE(handle) ((GPOINTER_TO_UINT(handle) & _WAPI_PROCESS_UNHANDLED) == _WAPI_PROCESS_UNHANDLED)
28 #define WAPI_PID_TO_HANDLE(pid) GINT_TO_POINTER (_WAPI_PROCESS_UNHANDLED + (pid))
29 #define WAPI_HANDLE_TO_PID(handle) (GPOINTER_TO_UINT ((handle)) - _WAPI_PROCESS_UNHANDLED)
31 void wapi_processes_init (void);
32 extern gpointer _wapi_process_duplicate (void);
33 extern void wapi_processes_cleanup (void);
35 extern struct _WapiHandleOps _wapi_process_ops;
38 * MonoProcess describes processes we create.
39 * It contains a semaphore that can be waited on in order to wait
40 * for process termination. It's accessed in our SIGCHLD handler,
41 * when status is updated (and pid cleared, to not clash with
42 * subsequent processes that may get executed).
45 pid_t pid; /* the pid of the process. This value is only valid until the process has exited. */
46 MonoSemType exit_sem; /* this semaphore will be released when the process exits */
47 int status; /* the exit status */
48 gint32 handle_count; /* the number of handles to this mono_process instance */
49 /* we keep a ref to the creating _WapiHandle_process handle until
50 * the process has exited, so that the information there isn't lost.
54 struct MonoProcess *next;
57 typedef struct MonoProcess MonoProcess;
60 * _WapiHandle_process is a structure containing all the required information
61 * for process handling.
63 struct _WapiHandle_process
68 WapiFileTime create_time;
69 WapiFileTime exit_time;
71 size_t min_working_set;
72 size_t max_working_set;
74 struct MonoProcess *mono_process;
77 typedef struct _WapiHandle_process WapiHandle_process;
79 #endif /* _WAPI_PROCESS_PRIVATE_H_ */