2 * wapi-private.h: internal definitions of handles and shared memory layout
5 * Dick Porter (dick@ximian.com)
7 * (C) 2002-2006 Novell, Inc.
10 #ifndef _WAPI_PRIVATE_H_
11 #define _WAPI_PRIVATE_H_
17 #include <mono/io-layer/wapi.h>
18 #include <mono/io-layer/handles.h>
19 #include <mono/io-layer/io.h>
21 #include <mono/utils/mono-os-mutex.h>
23 extern gboolean _wapi_has_shut_down;
37 WAPI_HANDLE_NAMEDMUTEX,
39 WAPI_HANDLE_NAMEDEVENT,
43 extern const char *_wapi_handle_typename[];
45 #define _WAPI_FD_HANDLE(type) (type == WAPI_HANDLE_FILE || \
46 type == WAPI_HANDLE_CONSOLE || \
47 type == WAPI_HANDLE_SOCKET || \
48 type == WAPI_HANDLE_PIPE)
50 #define _WAPI_SHARED_NAMESPACE(type) (type == WAPI_HANDLE_NAMEDMUTEX || \
51 type == WAPI_HANDLE_NAMEDSEM || \
52 type == WAPI_HANDLE_NAMEDEVENT)
56 gchar name[MAX_PATH + 1];
57 } WapiSharedNamespace;
60 WAPI_HANDLE_CAP_WAIT=0x01,
61 WAPI_HANDLE_CAP_SIGNAL=0x02,
62 WAPI_HANDLE_CAP_OWN=0x04,
63 WAPI_HANDLE_CAP_SPECIAL_WAIT=0x08
64 } WapiHandleCapability;
68 void (*close)(gpointer handle, gpointer data);
70 /* SignalObjectAndWait */
71 void (*signal)(gpointer signal);
73 /* Called by WaitForSingleObject and WaitForMultipleObjects,
74 * with the handle locked (shared handles aren't locked.)
75 * Returns TRUE if ownership was established, false otherwise.
77 gboolean (*own_handle)(gpointer handle);
79 /* Called by WaitForSingleObject and WaitForMultipleObjects, if the
80 * handle in question is "ownable" (ie mutexes), to see if the current
81 * thread already owns this handle
83 gboolean (*is_owned)(gpointer handle);
85 /* Called by WaitForSingleObject and WaitForMultipleObjects,
86 * if the handle in question needs a special wait function
87 * instead of using the normal handle signal mechanism.
88 * Returns the WaitForSingleObject return code.
90 guint32 (*special_wait)(gpointer handle, guint32 timeout, gboolean alertable);
92 /* Called by WaitForSingleObject and WaitForMultipleObjects,
93 * if the handle in question needs some preprocessing before the
96 void (*prewait)(gpointer handle);
98 /* Called when dumping the handles */
99 void (*details)(gpointer data);
102 #include <mono/io-layer/event-private.h>
103 #include <mono/io-layer/io-private.h>
104 #include <mono/io-layer/mutex-private.h>
105 #include <mono/io-layer/semaphore-private.h>
106 #include <mono/io-layer/socket-private.h>
107 #include <mono/io-layer/thread-private.h>
108 #include <mono/io-layer/process-private.h>
110 struct _WapiHandle_shared_ref
112 /* This will be split 16:16 with the shared file segment in
113 * the top half, when I implement space increases
118 #define _WAPI_SHARED_SEM_NAMESPACE 0
119 /*#define _WAPI_SHARED_SEM_COLLECTION 1*/
120 #define _WAPI_SHARED_SEM_FILESHARE 2
121 #define _WAPI_SHARED_SEM_PROCESS_COUNT_LOCK 6
122 #define _WAPI_SHARED_SEM_PROCESS_COUNT 7
123 #define _WAPI_SHARED_SEM_COUNT 8 /* Leave some future expansion space */
125 struct _WapiFileShare
127 #ifdef WAPI_FILE_SHARE_PLATFORM_EXTRA_DATA
128 WAPI_FILE_SHARE_PLATFORM_EXTRA_DATA
139 typedef struct _WapiFileShare _WapiFileShare;
141 #define _WAPI_HANDLE_INVALID (gpointer)-1
146 #endif /* _WAPI_PRIVATE_H_ */