eventfd_synchronization: Create esync file descriptors for console server objects.

This commit is contained in:
Zebediah Figura 2020-10-17 19:24:53 -05:00
parent ed56966feb
commit be9c96813a
2 changed files with 100 additions and 0 deletions

View File

@ -0,0 +1,99 @@
From 6202eab7a05dae145676e55f7fd7373569930cda Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Sat, 17 Oct 2020 19:13:16 -0500
Subject: [PATCH] server: Create esync file descriptors for console servers.
---
server/console.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/server/console.c b/server/console.c
index c0892b251c4..99831b299b8 100644
--- a/server/console.c
+++ b/server/console.c
@@ -42,6 +42,7 @@
#include "wincon.h"
#include "winternl.h"
#include "wine/condrv.h"
+#include "esync.h"
struct screen_buffer;
@@ -134,11 +135,13 @@ struct console_server
int busy; /* flag if server processing an ioctl */
int term_fd; /* UNIX terminal fd */
struct termios termios; /* original termios */
+ int esync_fd;
};
static void console_server_dump( struct object *obj, int verbose );
static void console_server_destroy( struct object *obj );
static int console_server_signaled( struct object *obj, struct wait_queue_entry *entry );
+static int console_server_get_esync_fd( struct object *obj, enum esync_type *type );
static struct fd *console_server_get_fd( struct object *obj );
static struct object *console_server_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr );
static struct object *console_server_open_file( struct object *obj, unsigned int access,
@@ -152,7 +155,7 @@ static const struct object_ops console_server_ops =
add_queue, /* add_queue */
remove_queue, /* remove_queue */
console_server_signaled, /* signaled */
- NULL, /* get_esync_fd */
+ console_server_get_esync_fd, /* get_esync_fd */
no_satisfied, /* satisfied */
no_signal, /* signal */
console_server_get_fd, /* get_fd */
@@ -427,6 +430,8 @@ static void disconnect_console_server( struct console_server *server )
list_remove( &call->entry );
console_host_ioctl_terminate( call, STATUS_CANCELLED );
}
+ if (do_esync())
+ esync_clear( server->esync_fd );
while (!list_empty( &server->read_queue ))
{
struct console_host_ioctl *call = LIST_ENTRY( list_head( &server->read_queue ), struct console_host_ioctl, entry );
@@ -764,6 +769,13 @@ static int console_server_signaled( struct object *obj, struct wait_queue_entry
return !server->console || !list_empty( &server->queue );
}
+static int console_server_get_esync_fd( struct object *obj, enum esync_type *type )
+{
+ struct console_server *server = (struct console_server*)obj;
+ *type = ESYNC_MANUAL_SERVER;
+ return server->esync_fd;
+}
+
static struct fd *console_server_get_fd( struct object* obj )
{
struct console_server *server = (struct console_server*)obj;
@@ -794,6 +806,10 @@ static struct object *create_console_server( void )
return NULL;
}
allow_fd_caching(server->fd);
+ server->esync_fd = -1;
+
+ if (do_esync())
+ server->esync_fd = esync_create_fd( 0, 0 );
return &server->obj;
}
@@ -1219,6 +1235,8 @@ DECL_HANDLER(get_next_console_request)
/* set result of previous ioctl */
ioctl = LIST_ENTRY( list_head( &server->queue ), struct console_host_ioctl, entry );
list_remove( &ioctl->entry );
+ if (do_esync() && list_empty( &server->queue ))
+ esync_clear( server->esync_fd );
}
if (ioctl)
@@ -1309,6 +1327,8 @@ DECL_HANDLER(get_next_console_request)
{
set_error( STATUS_PENDING );
}
+ if (do_esync() && list_empty( &server->queue ))
+ esync_clear( server->esync_fd );
release_object( server );
}
--
2.28.0

View File

@ -2619,6 +2619,7 @@ if test "$enable_eventfd_synchronization" -eq 1; then
patch_apply eventfd_synchronization/0053-esync-Update-README.patch
patch_apply eventfd_synchronization/0054-server-Create-esync-file-descriptors-for-true-file-o.patch
patch_apply eventfd_synchronization/0055-ntdll-server-Abandon-esync-mutexes-on-thread-exit.patch
patch_apply eventfd_synchronization/0056-server-Create-esync-file-descriptors-for-console-ser.patch
fi
# Patchset explorer-Video_Registry_Key