eventfd_synchronization: Include unistd.h in files using close(2).

Something on Linux pulls this in, but not on Mac.
This commit is contained in:
Zebediah Figura 2021-10-10 12:38:19 -05:00
parent d1ea5ced2b
commit 5e9626af6c
2 changed files with 42 additions and 26 deletions

View File

@ -1,4 +1,4 @@
From 0ffe77334eaf10be9a241dae48cf772228abde3b Mon Sep 17 00:00:00 2001
From dfa487b0d7d7895f6f47f4ae9c81faf951080b56 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Fri, 8 Jun 2018 21:01:24 -0500
Subject: [PATCH] server: Create eventfd file descriptors for event objects.
@ -9,8 +9,8 @@ This lets system processes shut down.
---
server/esync.c | 8 ++++++++
server/esync.h | 1 +
server/event.c | 29 +++++++++++++++++++++++++++--
3 files changed, 36 insertions(+), 2 deletions(-)
server/event.c | 30 ++++++++++++++++++++++++++++--
3 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/server/esync.c b/server/esync.c
index 2b9307267f9..975e5d2ddd6 100644
@ -41,10 +41,18 @@ index 1e12560ddd6..fcbfd0989bb 100644
void esync_wake_up( struct object *obj );
+void esync_clear( int fd );
diff --git a/server/event.c b/server/event.c
index 490fd9875bd..0938a73f648 100644
index 4168fef90d1..346c55805c8 100644
--- a/server/event.c
+++ b/server/event.c
@@ -35,6 +35,7 @@
@@ -24,6 +24,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
+#include <unistd.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
@@ -34,6 +35,7 @@
#include "thread.h"
#include "request.h"
#include "security.h"
@ -52,7 +60,7 @@ index 490fd9875bd..0938a73f648 100644
static const WCHAR event_name[] = {'E','v','e','n','t'};
@@ -56,13 +57,16 @@ struct event
@@ -55,13 +57,16 @@ struct event
struct list kernel_object; /* list of kernel object pointers */
int manual_reset; /* is it a manual reset event? */
int signaled; /* event has been signaled */
@ -69,7 +77,7 @@ index 490fd9875bd..0938a73f648 100644
static const struct object_ops event_ops =
{
@@ -72,7 +76,7 @@ static const struct object_ops event_ops =
@@ -71,7 +76,7 @@ static const struct object_ops event_ops =
add_queue, /* add_queue */
remove_queue, /* remove_queue */
event_signaled, /* signaled */
@ -78,7 +86,7 @@ index 490fd9875bd..0938a73f648 100644
event_satisfied, /* satisfied */
event_signal, /* signal */
no_get_fd, /* get_fd */
@@ -86,7 +90,7 @@ static const struct object_ops event_ops =
@@ -85,7 +90,7 @@ static const struct object_ops event_ops =
no_open_file, /* open_file */
event_get_kernel_obj_list, /* get_kernel_obj_list */
no_close_handle, /* close_handle */
@ -87,7 +95,7 @@ index 490fd9875bd..0938a73f648 100644
};
@@ -152,6 +156,9 @@ struct event *create_event( struct object *root, const struct unicode_str *name,
@@ -151,6 +156,9 @@ struct event *create_event( struct object *root, const struct unicode_str *name,
list_init( &event->kernel_object );
event->manual_reset = manual_reset;
event->signaled = initial_state;
@ -97,7 +105,7 @@ index 490fd9875bd..0938a73f648 100644
}
}
return event;
@@ -180,6 +187,9 @@ void set_event( struct event *event )
@@ -179,6 +187,9 @@ void set_event( struct event *event )
void reset_event( struct event *event )
{
event->signaled = 0;
@ -107,7 +115,7 @@ index 490fd9875bd..0938a73f648 100644
}
static void event_dump( struct object *obj, int verbose )
@@ -197,6 +207,13 @@ static int event_signaled( struct object *obj, struct wait_queue_entry *entry )
@@ -196,6 +207,13 @@ static int event_signaled( struct object *obj, struct wait_queue_entry *entry )
return event->signaled;
}
@ -121,7 +129,7 @@ index 490fd9875bd..0938a73f648 100644
static void event_satisfied( struct object *obj, struct wait_queue_entry *entry )
{
struct event *event = (struct event *)obj;
@@ -225,6 +242,14 @@ static struct list *event_get_kernel_obj_list( struct object *obj )
@@ -224,6 +242,14 @@ static struct list *event_get_kernel_obj_list( struct object *obj )
return &event->kernel_object;
}
@ -137,5 +145,5 @@ index 490fd9875bd..0938a73f648 100644
unsigned int attr, const struct security_descriptor *sd )
{
--
2.20.1
2.33.0

View File

@ -1,4 +1,4 @@
From 2053200985a44de70df5b6024177927b64689954 Mon Sep 17 00:00:00 2001
From 3518ce5bf3c6010425f35bb228b3fb2b238b1726 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Sat, 9 Jun 2018 15:39:37 -0500
Subject: [PATCH] server: Create eventfd descriptors for device manager
@ -11,14 +11,22 @@ process.
This lets drivers like mountmgr finally work, and so winecfg can open the
Drives tab.
---
server/device.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
server/device.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/server/device.c b/server/device.c
index cc9aa2358a4..b8ce131c732 100644
index 80904d33d0d..2a7727f05ae 100644
--- a/server/device.c
+++ b/server/device.c
@@ -39,6 +39,7 @@
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
+#include <unistd.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
@@ -38,6 +39,7 @@
#include "handle.h"
#include "request.h"
#include "process.h"
@ -26,7 +34,7 @@ index cc9aa2358a4..b8ce131c732 100644
/* IRP object */
@@ -95,10 +96,12 @@ struct device_manager
@@ -93,10 +95,12 @@ struct device_manager
struct list requests; /* list of pending irps across all devices */
struct irp_call *current_call; /* call currently executed on client side */
struct wine_rb_tree kernel_objects; /* map of objects that have client side pointer associated */
@ -39,7 +47,7 @@ index cc9aa2358a4..b8ce131c732 100644
static void device_manager_destroy( struct object *obj );
static const struct object_ops device_manager_ops =
@@ -109,7 +112,7 @@ static const struct object_ops device_manager_ops =
@@ -107,7 +111,7 @@ static const struct object_ops device_manager_ops =
add_queue, /* add_queue */
remove_queue, /* remove_queue */
device_manager_signaled, /* signaled */
@ -48,7 +56,7 @@ index cc9aa2358a4..b8ce131c732 100644
no_satisfied, /* satisfied */
no_signal, /* signal */
no_get_fd, /* get_fd */
@@ -751,6 +754,9 @@ static void delete_file( struct device_file *file )
@@ -751,6 +755,9 @@ static void delete_file( struct device_file *file )
/* terminate all pending requests */
LIST_FOR_EACH_ENTRY_SAFE( irp, next, &file->requests, struct irp_call, dev_entry )
{
@ -58,7 +66,7 @@ index cc9aa2358a4..b8ce131c732 100644
list_remove( &irp->mgr_entry );
set_irp_result( irp, STATUS_FILE_DELETED, NULL, 0, 0 );
}
@@ -786,6 +792,13 @@ static int device_manager_signaled( struct object *obj, struct wait_queue_entry
@@ -786,6 +793,13 @@ static int device_manager_signaled( struct object *obj, struct wait_queue_entry
return !list_empty( &manager->requests );
}
@ -72,7 +80,7 @@ index cc9aa2358a4..b8ce131c732 100644
static void device_manager_destroy( struct object *obj )
{
struct device_manager *manager = (struct device_manager *)obj;
@@ -820,6 +833,9 @@ static void device_manager_destroy( struct object *obj )
@@ -820,6 +834,9 @@ static void device_manager_destroy( struct object *obj )
assert( !irp->file && !irp->async );
release_object( irp );
}
@ -82,7 +90,7 @@ index cc9aa2358a4..b8ce131c732 100644
}
static struct device_manager *create_device_manager(void)
@@ -832,6 +848,9 @@ static struct device_manager *create_device_manager(void)
@@ -832,6 +849,9 @@ static struct device_manager *create_device_manager(void)
list_init( &manager->devices );
list_init( &manager->requests );
wine_rb_init( &manager->kernel_objects, compare_kernel_object );
@ -92,7 +100,7 @@ index cc9aa2358a4..b8ce131c732 100644
}
return manager;
}
@@ -997,6 +1016,9 @@ DECL_HANDLER(get_next_device_request)
@@ -1019,6 +1039,9 @@ DECL_HANDLER(get_next_device_request)
/* we already own the object if it's only on manager queue */
if (irp->file) grab_object( irp );
manager->current_call = irp;
@ -103,5 +111,5 @@ index cc9aa2358a4..b8ce131c732 100644
else close_handle( current->process, reply->next );
}
--
2.28.0
2.33.0