/* Increment this whenever an incompatible change is made to the
* shared handle structure.
*/
-#define _WAPI_HANDLE_VERSION 4
+#define _WAPI_HANDLE_VERSION 7
typedef enum {
WAPI_HANDLE_UNUSED=0,
extern const char *_wapi_handle_typename[];
-#define _WAPI_SHARED_HANDLE(type) (type == WAPI_HANDLE_THREAD || \
- type == WAPI_HANDLE_PROCESS || \
+#define _WAPI_SHARED_HANDLE(type) (type == WAPI_HANDLE_PROCESS || \
type == WAPI_HANDLE_NAMEDMUTEX)
#define _WAPI_FD_HANDLE(type) (type == WAPI_HANDLE_FILE || \
struct _WapiHandleOps
{
- void (*close)(gpointer handle);
+ void (*close)(gpointer handle, gpointer data);
/* SignalObjectAndWait */
void (*signal)(gpointer signal);
*/
gboolean (*is_owned)(gpointer handle);
- /* Called by WaitForSingleObject, if the handle in question
- * needs a special wait function instead of using the normal
- * handle signal mechanism. Returns the WaitForSingleObject
- * return code.
+ /* Called by WaitForSingleObject and WaitForMultipleObjects,
+ * if the handle in question needs a special wait function
+ * instead of using the normal handle signal mechanism.
+ * Returns the WaitForSingleObject return code.
*/
guint32 (*special_wait)(gpointer handle, guint32 timeout);
};
struct _WapiHandle_sem sem;
struct _WapiHandle_socket sock;
struct _WapiHandle_shared_ref shared;
+
+ /* Move thread data into the private set, while
+ * problems with cleaning up shared handles are fixed
+ */
+ struct _WapiHandle_thread thread;
} u;
};
volatile guint32 offset;
guint32 timestamp;
volatile gboolean signalled;
- volatile guint32 checking;
};
struct _WapiHandleShared
union
{
+ /* Leave this one while the thread is in the private
+ * set, so the shared space doesn't change size
+ */
struct _WapiHandle_thread thread;
struct _WapiHandle_process process;
struct _WapiHandle_namedmutex namedmutex;
} u;
};
+#define _WAPI_SHARED_SEM_NAMESPACE 0
+#define _WAPI_SHARED_SEM_COLLECTION 1
+#define _WAPI_SHARED_SEM_SHARE 2
+#define _WAPI_SHARED_SEM_HANDLE 3
+#define _WAPI_SHARED_SEM_COUNT 8 /* Leave some future expansion space */
+
struct _WapiHandleSharedLayout
{
- guint32 namespace_check;
volatile guint32 signal_count;
-
- guint32 master_timestamp;
volatile guint32 collection_count;
+ volatile key_t sem_key;
struct _WapiHandleSharedMetadata metadata[_WAPI_HANDLE_INITIAL_COUNT];
struct _WapiHandleShared handles[_WAPI_HANDLE_INITIAL_COUNT];
{
dev_t device;
ino_t inode;
+ pid_t opened_by_pid;
guint32 sharemode;
guint32 access;
guint32 handle_refs;
struct _WapiFileShareLayout
{
- guint32 share_check;
guint32 hwm;
struct _WapiFileShare share_info[_WAPI_FILESHARE_SIZE];