Merge pull request #1473 from esdrubal/sq
[mono.git] / mono / io-layer / wapi-private.h
index edb6aeaf491d82201d1e1841459361328920bdb3..34de2f0fd992b1d42c6596df39d19755dbce88e2 100644 (file)
@@ -4,7 +4,7 @@
  * Author:
  *     Dick Porter (dick@ximian.com)
  *
- * (C) 2002 Ximian, Inc.
+ * (C) 2002-2006 Novell, Inc.
  */
 
 #ifndef _WAPI_PRIVATE_H_
 
 #include <config.h>
 #include <glib.h>
+#include <sys/stat.h>
 
 #include <mono/io-layer/handles.h>
 #include <mono/io-layer/io.h>
 
-/* Catch this here rather than corrupt the shared data at runtime */
-#if MONO_SIZEOF_SUNPATH==0
-#error configure failed to discover size of unix socket path
-#endif
-
 /* Increment this whenever an incompatible change is made to the
  * shared handle structure.
  */
-#define _WAPI_HANDLE_VERSION 9
+#define _WAPI_HANDLE_VERSION 12
 
 typedef enum {
        WAPI_HANDLE_UNUSED=0,
@@ -46,9 +42,7 @@ typedef enum {
 
 extern const char *_wapi_handle_typename[];
 
-#define _WAPI_SHARED_HANDLE(type) (type == WAPI_HANDLE_PROCESS || \
-                                  type == WAPI_HANDLE_THREAD || \
-                                  type == WAPI_HANDLE_NAMEDMUTEX || \
+#define _WAPI_SHARED_HANDLE(type) (type == WAPI_HANDLE_NAMEDMUTEX || \
                                   type == WAPI_HANDLE_NAMEDSEM || \
                                   type == WAPI_HANDLE_NAMEDEVENT)
 
@@ -97,7 +91,13 @@ struct _WapiHandleOps
         * instead of using the normal handle signal mechanism.
         * Returns the WaitForSingleObject return code.
         */
-       guint32 (*special_wait)(gpointer handle, guint32 timeout);
+       guint32 (*special_wait)(gpointer handle, guint32 timeout, gboolean alertable);
+
+       /* Called by WaitForSingleObject and WaitForMultipleObjects,
+        * if the handle in question needs some preprocessing before the
+        * signal wait.
+        */
+       void (*prewait)(gpointer handle);
 };
 
 #include <mono/io-layer/event-private.h>
@@ -116,7 +116,7 @@ struct _WapiHandle_shared_ref
        guint32 offset;
 };
 
-#define _WAPI_HANDLE_INITIAL_COUNT 4096
+#define _WAPI_HANDLE_INITIAL_COUNT 256
 
 struct _WapiHandleUnshared
 {
@@ -134,6 +134,8 @@ struct _WapiHandleUnshared
                struct _WapiHandle_mutex mutex;
                struct _WapiHandle_sem sem;
                struct _WapiHandle_socket sock;
+               struct _WapiHandle_thread thread;
+               struct _WapiHandle_process process;
                struct _WapiHandle_shared_ref shared;
        } u;
 };
@@ -147,8 +149,6 @@ struct _WapiHandleShared
        
        union
        {
-               struct _WapiHandle_thread thread;
-               struct _WapiHandle_process process;
                struct _WapiHandle_namedmutex namedmutex;
                struct _WapiHandle_namedsem namedsem;
                struct _WapiHandle_namedevent namedevent;
@@ -159,6 +159,8 @@ struct _WapiHandleShared
 /*#define _WAPI_SHARED_SEM_COLLECTION 1*/
 #define _WAPI_SHARED_SEM_FILESHARE 2
 #define _WAPI_SHARED_SEM_SHARED_HANDLES 3
+#define _WAPI_SHARED_SEM_PROCESS_COUNT_LOCK 6
+#define _WAPI_SHARED_SEM_PROCESS_COUNT 7
 #define _WAPI_SHARED_SEM_COUNT 8       /* Leave some future expansion space */
 
 struct _WapiHandleSharedLayout
@@ -173,6 +175,9 @@ struct _WapiHandleSharedLayout
 
 struct _WapiFileShare
 {
+#ifdef WAPI_FILE_SHARE_PLATFORM_EXTRA_DATA
+       WAPI_FILE_SHARE_PLATFORM_EXTRA_DATA
+#endif
        dev_t device;
        ino_t inode;
        pid_t opened_by_pid;
@@ -182,6 +187,8 @@ struct _WapiFileShare
        guint32 timestamp;
 };
 
+typedef struct _WapiFileShare _WapiFileShare;
+
 struct _WapiFileShareLayout
 {
        guint32 hwm;