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/handles-private.h>
20 #include <mono/io-layer/io.h>
21 #include <mono/io-layer/shared.h>
23 #include <mono/utils/mono-os-mutex.h>
25 extern gboolean _wapi_has_shut_down;
27 extern const char *_wapi_handle_typename[];
29 #define _WAPI_FD_HANDLE(type) (type == WAPI_HANDLE_FILE || \
30 type == WAPI_HANDLE_CONSOLE || \
31 type == WAPI_HANDLE_SOCKET || \
32 type == WAPI_HANDLE_PIPE)
34 #define _WAPI_SHARED_NAMESPACE(type) (type == WAPI_HANDLE_NAMEDMUTEX || \
35 type == WAPI_HANDLE_NAMEDSEM || \
36 type == WAPI_HANDLE_NAMEDEVENT)
40 gchar name[MAX_PATH + 1];
41 } WapiSharedNamespace;
43 #include <mono/io-layer/event-private.h>
44 #include <mono/io-layer/io-private.h>
45 #include <mono/io-layer/mutex-private.h>
46 #include <mono/io-layer/semaphore-private.h>
47 #include <mono/io-layer/socket-private.h>
48 #include <mono/io-layer/thread-private.h>
49 #include <mono/io-layer/process-private.h>
51 struct _WapiHandle_shared_ref
53 /* This will be split 16:16 with the shared file segment in
54 * the top half, when I implement space increases
59 #define _WAPI_SHARED_SEM_NAMESPACE 0
60 /*#define _WAPI_SHARED_SEM_COLLECTION 1*/
61 #define _WAPI_SHARED_SEM_FILESHARE 2
62 #define _WAPI_SHARED_SEM_PROCESS_COUNT_LOCK 6
63 #define _WAPI_SHARED_SEM_PROCESS_COUNT 7
64 #define _WAPI_SHARED_SEM_COUNT 8 /* Leave some future expansion space */
68 #ifdef WAPI_FILE_SHARE_PLATFORM_EXTRA_DATA
69 WAPI_FILE_SHARE_PLATFORM_EXTRA_DATA
80 typedef struct _WapiFileShare _WapiFileShare;
82 #define _WAPI_HANDLE_INVALID (gpointer)-1
88 _wapi_search_handle_namespace (WapiHandleType type, gchar *utf8_name);
90 static inline int _wapi_namespace_lock (void)
92 return(_wapi_shm_sem_lock (_WAPI_SHARED_SEM_NAMESPACE));
95 /* This signature makes it easier to use in pthread cleanup handlers */
96 static inline int _wapi_namespace_unlock (gpointer data G_GNUC_UNUSED)
98 return(_wapi_shm_sem_unlock (_WAPI_SHARED_SEM_NAMESPACE));
101 #endif /* _WAPI_PRIVATE_H_ */