Rebase against d909f2759066afd128aa1a299d3367c7ab76da8f.

This commit is contained in:
Alistair Leslie-Hughes
2022-07-29 08:38:12 +10:00
parent d3ed71430a
commit 8708356647
7 changed files with 69 additions and 56 deletions

View File

@@ -1,4 +1,4 @@
From 3e714e2eb10fe17f12b747731c0ce7e18fd4b7a0 Mon Sep 17 00:00:00 2001
From 61fb7e02aa6779469e94c79f1132c4991cb27244 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <zfigura@codeweavers.com>
Date: Mon, 6 Jul 2020 15:11:12 -0500
Subject: [PATCH] server: Create eventfd file descriptors for process objects.
@@ -40,16 +40,16 @@ index c7b0323f204..27049ffbdb0 100644
{
struct esync *esync;
diff --git a/server/esync.h b/server/esync.h
index 7ca4ca89394..6a0a367124d 100644
index 00f9e638d83..8522d8a69ae 100644
--- a/server/esync.h
+++ b/server/esync.h
@@ -20,3 +20,4 @@
@@ -22,3 +22,4 @@
extern int do_esync(void);
void esync_init(void);
+int esync_create_fd( int initval, int flags );
diff --git a/server/process.c b/server/process.c
index da972a41955..91b26d00ec0 100644
index da11b90c613..22ac16fb540 100644
--- a/server/process.c
+++ b/server/process.c
@@ -63,6 +63,7 @@
@@ -77,7 +77,7 @@ index da972a41955..91b26d00ec0 100644
no_satisfied, /* satisfied */
no_signal, /* signal */
no_get_fd, /* get_fd */
@@ -684,6 +686,7 @@ struct process *create_process( int fd, struct process *parent, unsigned int fla
@@ -686,6 +688,7 @@ struct process *create_process( int fd, struct process *parent, unsigned int fla
process->rawinput_mouse = NULL;
process->rawinput_kbd = NULL;
memset( &process->image_info, 0, sizeof(process->image_info) );
@@ -85,7 +85,7 @@ index da972a41955..91b26d00ec0 100644
list_init( &process->kernel_object );
list_init( &process->thread_list );
list_init( &process->locks );
@@ -741,6 +744,9 @@ struct process *create_process( int fd, struct process *parent, unsigned int fla
@@ -742,6 +745,9 @@ struct process *create_process( int fd, struct process *parent, unsigned int fla
if (!token_assign_label( process->token, &high_label_sid ))
goto error;
@@ -95,15 +95,15 @@ index da972a41955..91b26d00ec0 100644
set_fd_events( process->msg_fd, POLLIN ); /* start listening to events */
return process;
@@ -787,6 +793,7 @@ static void process_destroy( struct object *obj )
if (process->token) release_object( process->token );
@@ -789,6 +795,7 @@ static void process_destroy( struct object *obj )
free( process->rawinput_devices );
free( process->dir_cache );
free( process->image );
+ if (do_esync()) close( process->esync_fd );
}
/* dump a process on stdout for debugging purposes */
@@ -804,6 +811,13 @@ static int process_signaled( struct object *obj, struct wait_queue_entry *entry
@@ -806,6 +813,13 @@ static int process_signaled( struct object *obj, struct wait_queue_entry *entry
return !process->running_threads;
}
@@ -118,10 +118,10 @@ index da972a41955..91b26d00ec0 100644
{
access = default_map_access( obj, access );
diff --git a/server/process.h b/server/process.h
index 632faf9c4bf..1ba69b3406e 100644
index 97e0d455ece..a0a071d8f88 100644
--- a/server/process.h
+++ b/server/process.h
@@ -90,6 +90,7 @@ struct process
@@ -85,6 +85,7 @@ struct process
const struct rawinput_device *rawinput_kbd; /* rawinput keyboard device, if any */
struct list kernel_object; /* list of kernel object pointers */
pe_image_info_t image_info; /* main exe image info */
@@ -130,5 +130,5 @@ index 632faf9c4bf..1ba69b3406e 100644
/* process functions */
--
2.34.1
2.35.1

View File

@@ -1,4 +1,4 @@
From e0a89702e35941e75ce06f795966c92b3f195ed8 Mon Sep 17 00:00:00 2001
From ca6a89f3bfb6aa5d7ac05bb0c469b527ae1a9d9d Mon Sep 17 00:00:00 2001
From: Zebediah Figura <zfigura@codeweavers.com>
Date: Mon, 6 Jul 2020 16:11:23 -0500
Subject: [PATCH] server, ntdll: Implement message waits.
@@ -10,10 +10,10 @@ Subject: [PATCH] server, ntdll: Implement message waits.
3 files changed, 75 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c
index fcbe563bb5a..88490e08ef9 100644
index 2ae334d8417..608c318c1c7 100644
--- a/dlls/ntdll/unix/esync.c
+++ b/dlls/ntdll/unix/esync.c
@@ -482,12 +482,13 @@ static void update_grabbed_object( struct esync *obj )
@@ -475,12 +475,13 @@ static void update_grabbed_object( struct esync *obj )
/* A value of STATUS_NOT_IMPLEMENTED returned from this function means that we
* need to delegate to server_select(). */
@@ -28,7 +28,7 @@ index fcbe563bb5a..88490e08ef9 100644
LONGLONG timeleft;
LARGE_INTEGER now;
ULONGLONG end;
@@ -515,6 +516,9 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an
@@ -508,6 +509,9 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an
return ret;
}
@@ -38,7 +38,7 @@ index fcbe563bb5a..88490e08ef9 100644
if (has_esync && has_server)
FIXME("Can't wait on esync and server objects at the same time!\n");
else if (has_server)
@@ -526,6 +530,9 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an
@@ -519,6 +523,9 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an
for (i = 0; i < count; i++)
TRACE(" %p", handles[i]);
@@ -48,7 +48,7 @@ index fcbe563bb5a..88490e08ef9 100644
if (!timeout)
TRACE(", timeout = INFINITE.\n");
else
@@ -565,7 +572,9 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an
@@ -558,7 +565,9 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an
int64_t value;
ssize_t size;
@@ -59,7 +59,7 @@ index fcbe563bb5a..88490e08ef9 100644
{
/* Don't grab the object, just check if it's signaled. */
if (fds[i].revents & POLLIN)
@@ -610,6 +619,44 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an
@@ -603,6 +612,44 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an
}
}
@@ -105,10 +105,10 @@ index fcbe563bb5a..88490e08ef9 100644
{
struct stat st;
diff --git a/server/protocol.def b/server/protocol.def
index cf00ab99c63..ecbb78cc9bb 100644
index 5cf63cbac21..f837944574e 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3734,3 +3734,8 @@ enum esync_type
@@ -3797,3 +3797,8 @@ enum esync_type
int type;
unsigned int shm_idx;
@END
@@ -118,10 +118,10 @@ index cf00ab99c63..ecbb78cc9bb 100644
+ int in_msgwait; /* are we in a message wait? */
+@END
diff --git a/server/queue.c b/server/queue.c
index d34bc284d08..f4edb299dc3 100644
index 1702acb8480..9593ae532d4 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -146,6 +146,7 @@ struct msg_queue
@@ -144,6 +144,7 @@ struct msg_queue
int keystate_lock; /* owns an input keystate lock */
unsigned int ignore_post_msg; /* ignore post messages newer than this unique id */
int esync_fd; /* esync file descriptor (signalled on message) */
@@ -129,7 +129,7 @@ index d34bc284d08..f4edb299dc3 100644
};
struct hotkey
@@ -319,6 +320,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
@@ -317,6 +318,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
queue->keystate_lock = 0;
queue->ignore_post_msg = 0;
queue->esync_fd = -1;
@@ -137,7 +137,7 @@ index d34bc284d08..f4edb299dc3 100644
list_init( &queue->send_result );
list_init( &queue->callback_result );
list_init( &queue->pending_timers );
@@ -1002,6 +1004,10 @@ static int is_queue_hung( struct msg_queue *queue )
@@ -1001,6 +1003,10 @@ static int is_queue_hung( struct msg_queue *queue )
if (get_wait_queue_thread(entry)->queue == queue)
return 0; /* thread is waiting on queue -> not hung */
}
@@ -148,9 +148,9 @@ index d34bc284d08..f4edb299dc3 100644
return 1;
}
@@ -3416,3 +3422,18 @@ DECL_HANDLER(get_rawinput_devices)
devices[i++] = e->device;
}
@@ -3456,3 +3462,18 @@ DECL_HANDLER(update_rawinput_devices)
process->rawinput_mouse = find_rawinput_device( process, 1, 2 );
process->rawinput_kbd = find_rawinput_device( process, 1, 6 );
}
+
+DECL_HANDLER(esync_msgwait)
@@ -168,5 +168,5 @@ index d34bc284d08..f4edb299dc3 100644
+ set_fd_events( queue->fd, req->in_msgwait ? POLLIN : 0 );
+}
--
2.30.2
2.35.1