Rebase against 17f052c36a414a05fcb6a6e67bd3aac824fbed3e.

This commit is contained in:
Alistair Leslie-Hughes
2024-07-02 11:15:09 +10:00
parent d1f022f686
commit 0d4b9f2f62
6 changed files with 79 additions and 72 deletions

View File

@@ -1,28 +1,30 @@
From cdced5d4d89a932fa456191551899e1919a1881e Mon Sep 17 00:00:00 2001
From f0ff0cdc5472deafb8c75f3d0d6456ddb4164878 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <zfigura@codeweavers.com>
Date: Mon, 6 Jul 2020 12:34:42 -0500
Subject: [PATCH] ntdll: Implement NtWaitForMultipleObjects().
---
dlls/ntdll/unix/esync.c | 170 ++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/unix/esync.c | 172 ++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/unix/esync.h | 3 +
dlls/ntdll/unix/sync.c | 7 ++
3 files changed, 180 insertions(+)
3 files changed, 182 insertions(+)
diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c
index e031e9cb94f..75ceb95bc66 100644
index e031e9cb94f..f383221194c 100644
--- a/dlls/ntdll/unix/esync.c
+++ b/dlls/ntdll/unix/esync.c
@@ -22,6 +22,8 @@
@@ -22,6 +22,10 @@
#pragma makedep unix
#endif
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
#include "config.h"
#include <assert.h>
@@ -34,6 +36,12 @@
@@ -34,6 +38,12 @@
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
@@ -35,7 +37,7 @@ index e031e9cb94f..75ceb95bc66 100644
#include <sys/types.h>
#include <unistd.h>
@@ -286,6 +294,168 @@ NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev )
@@ -286,6 +296,168 @@ NTSTATUS esync_release_semaphore( HANDLE handle, ULONG count, ULONG *prev )
return STATUS_SUCCESS;
}
@@ -219,10 +221,10 @@ index c63491dcaad..92b609ebd27 100644
/* We have to synchronize on the fd cache mutex so that our calls to receive_fd
* don't race with theirs. It looks weird, I know.
diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c
index c85f985b4f3..79141999e33 100644
index 76da038649f..1c60cd11f77 100644
--- a/dlls/ntdll/unix/sync.c
+++ b/dlls/ntdll/unix/sync.c
@@ -1479,6 +1479,13 @@ NTSTATUS WINAPI NtWaitForMultipleObjects( DWORD count, const HANDLE *handles, BO
@@ -1524,6 +1524,13 @@ NTSTATUS WINAPI NtWaitForMultipleObjects( DWORD count, const HANDLE *handles, BO
if (!count || count > MAXIMUM_WAIT_OBJECTS) return STATUS_INVALID_PARAMETER_1;
@@ -237,5 +239,5 @@ index c85f985b4f3..79141999e33 100644
select_op.wait.op = wait_any ? SELECT_WAIT : SELECT_WAIT_ALL;
for (i = 0; i < count; i++) select_op.wait.handles[i] = wine_server_obj_handle( handles[i] );
--
2.42.0
2.43.0

View File

@@ -1,4 +1,4 @@
From f1fcc584ff2bb975656b9f2f111d3e09b36293d0 Mon Sep 17 00:00:00 2001
From 27e2bc1b0d098abce9168ea46589024054817e25 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <zfigura@codeweavers.com>
Date: Mon, 6 Jul 2020 16:01:56 -0500
Subject: [PATCH] server: Create eventfd file descriptors for message queues.
@@ -8,7 +8,7 @@ Subject: [PATCH] server: Create eventfd file descriptors for message queues.
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/server/queue.c b/server/queue.c
index 4d3f43b8d52..74a59b2ee84 100644
index ee575724e4e..60f0c043257 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -44,6 +44,7 @@
@@ -19,7 +19,7 @@ index 4d3f43b8d52..74a59b2ee84 100644
#define WM_NCMOUSEFIRST WM_NCMOUSEMOVE
#define WM_NCMOUSELAST (WM_NCMOUSEFIRST+(WM_MOUSELAST-WM_MOUSEFIRST))
@@ -148,6 +149,7 @@ struct msg_queue
@@ -144,6 +145,7 @@ struct msg_queue
int keystate_lock; /* owns an input keystate lock */
const queue_shm_t *shared; /* queue in session shared memory */
unsigned int ignore_post_msg; /* ignore post messages newer than this unique id */
@@ -27,7 +27,7 @@ index 4d3f43b8d52..74a59b2ee84 100644
};
struct hotkey
@@ -164,6 +166,7 @@ static void msg_queue_dump( struct object *obj, int verbose );
@@ -160,6 +162,7 @@ static void msg_queue_dump( struct object *obj, int verbose );
static int msg_queue_add_queue( struct object *obj, struct wait_queue_entry *entry );
static void msg_queue_remove_queue( struct object *obj, struct wait_queue_entry *entry );
static int msg_queue_signaled( struct object *obj, struct wait_queue_entry *entry );
@@ -35,7 +35,7 @@ index 4d3f43b8d52..74a59b2ee84 100644
static void msg_queue_satisfied( struct object *obj, struct wait_queue_entry *entry );
static void msg_queue_destroy( struct object *obj );
static void msg_queue_poll_event( struct fd *fd, int event );
@@ -179,7 +182,7 @@ static const struct object_ops msg_queue_ops =
@@ -175,7 +178,7 @@ static const struct object_ops msg_queue_ops =
msg_queue_add_queue, /* add_queue */
msg_queue_remove_queue, /* remove_queue */
msg_queue_signaled, /* signaled */
@@ -44,7 +44,7 @@ index 4d3f43b8d52..74a59b2ee84 100644
msg_queue_satisfied, /* satisfied */
no_signal, /* signal */
no_get_fd, /* get_fd */
@@ -321,6 +324,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
@@ -313,6 +316,7 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
queue->last_get_msg = current_time;
queue->keystate_lock = 0;
queue->ignore_post_msg = 0;
@@ -52,7 +52,7 @@ index 4d3f43b8d52..74a59b2ee84 100644
list_init( &queue->send_result );
list_init( &queue->callback_result );
list_init( &queue->pending_timers );
@@ -339,6 +343,9 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
@@ -335,6 +339,9 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_
}
SHARED_WRITE_END;
@@ -62,7 +62,7 @@ index 4d3f43b8d52..74a59b2ee84 100644
thread->queue = queue;
if ((desktop = get_thread_desktop( thread, 0 )))
@@ -672,6 +679,9 @@ static inline void clear_queue_bits( struct msg_queue *queue, unsigned int bits
@@ -685,6 +692,9 @@ static inline void clear_queue_bits( struct msg_queue *queue, unsigned int bits
if (queue->keystate_lock) unlock_input_keystate( queue->input );
queue->keystate_lock = 0;
}
@@ -72,7 +72,7 @@ index 4d3f43b8d52..74a59b2ee84 100644
}
/* check if message is matched by the filter */
@@ -1213,6 +1223,13 @@ static int msg_queue_signaled( struct object *obj, struct wait_queue_entry *entr
@@ -1227,6 +1237,13 @@ static int msg_queue_signaled( struct object *obj, struct wait_queue_entry *entr
return ret || is_signaled( queue );
}
@@ -86,7 +86,7 @@ index 4d3f43b8d52..74a59b2ee84 100644
static void msg_queue_satisfied( struct object *obj, struct wait_queue_entry *entry )
{
struct msg_queue *queue = (struct msg_queue *)obj;
@@ -1258,6 +1275,7 @@ static void msg_queue_destroy( struct object *obj )
@@ -1278,6 +1295,7 @@ static void msg_queue_destroy( struct object *obj )
if (queue->hooks) release_object( queue->hooks );
if (queue->fd) release_object( queue->fd );
if (queue->shared) free_shared_object( queue->shared );
@@ -94,8 +94,8 @@ index 4d3f43b8d52..74a59b2ee84 100644
}
static void msg_queue_poll_event( struct fd *fd, int event )
@@ -2962,6 +2980,9 @@ DECL_HANDLER(set_queue_mask)
if (req->skip_wait) queue->wake_mask = queue->changed_mask = 0;
@@ -3000,6 +3018,9 @@ DECL_HANDLER(set_queue_mask)
}
else wake_up( &queue->obj, 0 );
}
+
@@ -104,19 +104,19 @@ index 4d3f43b8d52..74a59b2ee84 100644
}
}
@@ -2975,6 +2996,9 @@ DECL_HANDLER(get_queue_status)
reply->wake_bits = queue->wake_bits;
reply->changed_bits = queue->changed_bits;
queue->changed_bits &= ~req->clear_bits;
@@ -3020,6 +3041,9 @@ DECL_HANDLER(get_queue_status)
shared->changed_bits &= ~req->clear_bits;
}
SHARED_WRITE_END;
+
+ if (do_esync() && !is_signaled( queue ))
+ esync_clear( queue->esync_fd );
}
else reply->wake_bits = reply->changed_bits = 0;
}
@@ -3229,6 +3253,10 @@ DECL_HANDLER(get_message)
queue->wake_mask = req->wake_mask;
queue->changed_mask = req->changed_mask;
@@ -3286,6 +3310,10 @@ DECL_HANDLER(get_message)
SHARED_WRITE_END;
set_error( STATUS_PENDING ); /* FIXME */
+
+ if (do_esync() && !is_signaled( queue ))

View File

@@ -1,4 +1,4 @@
From 57703c0423cf2b138b93dfaf4bd993d50235e55a Mon Sep 17 00:00:00 2001
From 7522f4cf4bb29413bce97be5e61ebaefb5276c77 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.
@@ -6,8 +6,8 @@ Subject: [PATCH] server, ntdll: Implement message waits.
---
dlls/ntdll/unix/esync.c | 51 +++++++++++++++++++++++++++++++++++++++--
server/protocol.def | 4 ++++
server/queue.c | 22 ++++++++++++++++++
3 files changed, 75 insertions(+), 2 deletions(-)
server/queue.c | 24 +++++++++++++++++++
3 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/unix/esync.c b/dlls/ntdll/unix/esync.c
index 399930c444b..06d7d8babc6 100644
@@ -105,10 +105,10 @@ index 399930c444b..06d7d8babc6 100644
{
struct stat st;
diff --git a/server/protocol.def b/server/protocol.def
index d4a7173776f..4a081973ca5 100644
index 56f2d263100..46cdbbed9b7 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3964,6 +3964,10 @@ enum esync_type
@@ -3968,6 +3968,10 @@ enum esync_type
unsigned int shm_idx;
@END
@@ -120,10 +120,10 @@ index d4a7173776f..4a081973ca5 100644
@REQ(set_keyboard_repeat)
int enable; /* whether to enable auto-repeat */
diff --git a/server/queue.c b/server/queue.c
index 6183c2fa686..260fb753799 100644
index 60f0c043257..d6b6f2f20aa 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -150,6 +150,7 @@ struct msg_queue
@@ -146,6 +146,7 @@ struct msg_queue
const queue_shm_t *shared; /* queue in session shared memory */
unsigned int ignore_post_msg; /* ignore post messages newer than this unique id */
int esync_fd; /* esync file descriptor (signalled on message) */
@@ -131,7 +131,7 @@ index 6183c2fa686..260fb753799 100644
};
struct hotkey
@@ -325,6 +326,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;
@@ -139,7 +139,7 @@ index 6183c2fa686..260fb753799 100644
list_init( &queue->send_result );
list_init( &queue->callback_result );
list_init( &queue->pending_timers );
@@ -1170,6 +1172,10 @@ static int is_queue_hung( struct msg_queue *queue )
@@ -1183,6 +1185,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 */
}
@@ -150,18 +150,20 @@ index 6183c2fa686..260fb753799 100644
return 1;
}
@@ -4025,6 +4031,21 @@ DECL_HANDLER(update_rawinput_devices)
@@ -4079,6 +4085,23 @@ DECL_HANDLER(update_rawinput_devices)
}
}
+DECL_HANDLER(esync_msgwait)
+{
+ struct msg_queue *queue = get_current_queue();
+ const queue_shm_t *queue_shm;
+
+ if (!queue) return;
+ queue_shm = queue->shared;
+ queue->esync_in_msgwait = req->in_msgwait;
+
+ if (current->process->idle_event && !(queue->wake_mask & QS_SMRESULT))
+ if (current->process->idle_event && !(queue_shm->wake_mask & QS_SMRESULT))
+ set_event( current->process->idle_event );
+
+ /* and start/stop waiting on the driver */
@@ -172,7 +174,7 @@ index 6183c2fa686..260fb753799 100644
DECL_HANDLER(set_keyboard_repeat)
{
struct desktop *desktop;
@@ -4043,3 +4064,4 @@ DECL_HANDLER(set_keyboard_repeat)
@@ -4097,3 +4120,4 @@ DECL_HANDLER(set_keyboard_repeat)
release_object( desktop );
}