Rebase against 0c27d244f76ad90301c5db09d738b3a0389bcdac.

This commit is contained in:
Zebediah Figura
2020-04-30 17:39:18 -05:00
parent 7b0b95ee53
commit 169c49055d
11 changed files with 136 additions and 137 deletions

View File

@@ -1,8 +1,8 @@
From 86714f32b54c3135e5626f66f65ae5daf946f744 Mon Sep 17 00:00:00 2001
From f7855379ad40d50af6d63a8e7349504ece2f3464 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Tue, 12 Jun 2018 10:01:08 -0500
Subject: [PATCH 23/83] ntdll, wineandroid.drv, winemac.drv, winex11.drv: Store
the thread's queue fd in ntdll.
Subject: [PATCH] ntdll, wineandroid.drv, winemac.drv, winex11.drv: Store the
thread's queue fd in ntdll.
I originally had esync grab it from the server in order to avoid touching the USER drivers, but this doesn't really work since we might perform a MsgWait before ever doing any operations which might initialize the USER driver's thread data. Doing it this way also has the advantage that we won't use extra file descriptors.
@@ -18,7 +18,7 @@ In any case I haven't bothered to guard this code with do_esync(); it'd require
7 files changed, 20 insertions(+)
diff --git a/dlls/ntdll/esync.c b/dlls/ntdll/esync.c
index 0655ab779..210556fc2 100644
index c53818b5485..5d8dbac2df4 100644
--- a/dlls/ntdll/esync.c
+++ b/dlls/ntdll/esync.c
@@ -74,6 +74,12 @@ int do_esync(void)
@@ -35,10 +35,10 @@ index 0655ab779..210556fc2 100644
{
ESYNC_SEMAPHORE = 1,
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 74cebfc42..343ab66a5 100644
index 3e7327211b3..784635a53c8 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1498,6 +1498,8 @@
@@ -1555,6 +1555,8 @@
# All functions must be prefixed with '__wine_' (for internal functions)
# or 'wine_' (for user-visible functions) to avoid namespace conflicts.
@@ -48,10 +48,10 @@ index 74cebfc42..343ab66a5 100644
@ cdecl -norelay wine_server_call(ptr)
@ cdecl wine_server_close_fds_by_type(long)
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index dad0996c4..e2ef7d9b8 100644
index 98caabbf8e8..8e07b148c88 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -280,6 +280,7 @@ struct debug_info
@@ -270,6 +270,7 @@ struct debug_info
struct ntdll_thread_data
{
struct debug_info *debug_info; /* info for debugstr functions */
@@ -60,18 +60,18 @@ index dad0996c4..e2ef7d9b8 100644
int request_fd; /* fd for sending server requests */
int reply_fd; /* fd for receiving server replies */
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index a1ff7c1dd..87134db09 100644
index cbbdafb2e97..688f16eb528 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -326,6 +326,7 @@ void thread_init(void)
@@ -345,6 +345,7 @@ TEB *thread_init(void)
thread_data->reply_fd = -1;
thread_data->wait_fd[0] = -1;
thread_data->wait_fd[1] = -1;
+ thread_data->esync_queue_fd = -1;
signal_init_thread( teb );
virtual_init_threading();
@@ -694,6 +695,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT
debug_init();
init_paths();
@@ -718,6 +719,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT
thread_data->wait_fd[0] = -1;
thread_data->wait_fd[1] = -1;
thread_data->start_stack = (char *)teb->Tib.StackBase;
@@ -80,7 +80,7 @@ index a1ff7c1dd..87134db09 100644
pthread_attr_init( &pthread_attr );
pthread_attr_setstack( &pthread_attr, teb->DeallocationStack,
diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c
index eb05aaf28..2fc258dfd 100644
index c1e7b000a8f..d96f001432d 100644
--- a/dlls/wineandroid.drv/window.c
+++ b/dlls/wineandroid.drv/window.c
@@ -364,6 +364,8 @@ jboolean motion_event( JNIEnv *env, jobject obj, jint win, jint action, jint x,
@@ -101,10 +101,10 @@ index eb05aaf28..2fc258dfd 100644
{
ERR( "Can't allocate handle for event fd\n" );
diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c
index 544d448f9..5dfa54966 100644
index 694a46b11e6..64b8d69b16d 100644
--- a/dlls/winemac.drv/macdrv_main.c
+++ b/dlls/winemac.drv/macdrv_main.c
@@ -321,6 +321,7 @@ void CDECL macdrv_ThreadDetach(void)
@@ -323,6 +323,7 @@ void CDECL macdrv_ThreadDetach(void)
}
}
@@ -112,7 +112,7 @@ index 544d448f9..5dfa54966 100644
/***********************************************************************
* set_queue_display_fd
@@ -332,6 +333,8 @@ static void set_queue_display_fd(int fd)
@@ -334,6 +335,8 @@ static void set_queue_display_fd(int fd)
HANDLE handle;
int ret;
@@ -122,10 +122,10 @@ index 544d448f9..5dfa54966 100644
{
MESSAGE("macdrv: Can't allocate handle for event queue fd\n");
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index 40cd8ca29..18c98e3ec 100644
index 4eaedd1c556..323b71534ac 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -624,6 +624,7 @@ void CDECL X11DRV_ThreadDetach(void)
@@ -643,6 +643,7 @@ void CDECL X11DRV_ThreadDetach(void)
}
}
@@ -133,7 +133,7 @@ index 40cd8ca29..18c98e3ec 100644
/* store the display fd into the message queue */
static void set_queue_display_fd( Display *display )
@@ -631,6 +632,8 @@ static void set_queue_display_fd( Display *display )
@@ -650,6 +651,8 @@ static void set_queue_display_fd( Display *display )
HANDLE handle;
int ret;
@@ -143,5 +143,5 @@ index 40cd8ca29..18c98e3ec 100644
{
MESSAGE( "x11drv: Can't allocate handle for display fd\n" );
--
2.20.1
2.26.2

View File

@@ -1,4 +1,4 @@
From 454430de5505b16af9d90ee99d5fa8a034853d2b Mon Sep 17 00:00:00 2001
From ef25a40d4d6e2676ff66347297f96ca0c7a59460 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Fri, 15 Jun 2018 14:12:22 -0500
Subject: [PATCH] server, ntdll: Implement alertable waits.
@@ -16,7 +16,7 @@ We do this quite simply by waiting on an extra eventfd descriptor, which the ser
8 files changed, 121 insertions(+), 17 deletions(-)
diff --git a/dlls/ntdll/esync.c b/dlls/ntdll/esync.c
index 119a36f3611..5db7adcace7 100644
index d177bb47989..6f41c5e030b 100644
--- a/dlls/ntdll/esync.c
+++ b/dlls/ntdll/esync.c
@@ -684,19 +684,43 @@ static int do_poll( struct pollfd *fds, nfds_t nfds, ULONGLONG *end )
@@ -196,10 +196,10 @@ index 119a36f3611..5db7adcace7 100644
NTSTATUS esync_signal_and_wait( HANDLE signal, HANDLE wait, BOOLEAN alertable,
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 009cfe73330..d7f88f7f8f0 100644
index 8e07b148c88..8ba11bcf94c 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -261,6 +261,7 @@ struct ntdll_thread_data
@@ -271,6 +271,7 @@ struct ntdll_thread_data
{
struct debug_info *debug_info; /* info for debugstr functions */
int esync_queue_fd;/* fd to wait on for driver events */
@@ -208,18 +208,18 @@ index 009cfe73330..d7f88f7f8f0 100644
int request_fd; /* fd for sending server requests */
int reply_fd; /* fd for receiving server replies */
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 97e6d816bdd..129f42b3e01 100644
index 688f16eb528..391c3b62ee3 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -357,6 +357,7 @@ TEB *thread_init(void)
@@ -346,6 +346,7 @@ TEB *thread_init(void)
thread_data->wait_fd[0] = -1;
thread_data->wait_fd[1] = -1;
thread_data->esync_queue_fd = -1;
+ thread_data->esync_apc_fd = -1;
signal_init_thread( teb );
virtual_init_threading();
@@ -757,6 +758,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT
debug_init();
init_paths();
@@ -720,6 +721,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT
thread_data->wait_fd[1] = -1;
thread_data->start_stack = (char *)teb->Tib.StackBase;
thread_data->esync_queue_fd = -1;
@@ -284,10 +284,10 @@ index aeb58c5469c..cea025d9308 100644
void esync_clear( int fd );
diff --git a/server/protocol.def b/server/protocol.def
index eca0325e5c5..975802737fa 100644
index 8991462eb45..3955a8bd1c7 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -4083,6 +4083,11 @@ struct handle_info
@@ -4069,6 +4069,11 @@ struct handle_info
unsigned int shm_idx; /* this object's index into the shm section */
@END
@@ -300,10 +300,10 @@ index eca0325e5c5..975802737fa 100644
{
ESYNC_SEMAPHORE = 1,
diff --git a/server/thread.c b/server/thread.c
index 7c8b6da8a55..7da1a620ddd 100644
index 9341261b580..5677aa518da 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -188,6 +188,7 @@ static inline void init_thread_structure( struct thread *thread )
@@ -224,6 +224,7 @@ static inline void init_thread_structure( struct thread *thread )
thread->teb = 0;
thread->entry_point = 0;
thread->esync_fd = -1;
@@ -311,7 +311,7 @@ index 7c8b6da8a55..7da1a620ddd 100644
thread->debug_ctx = NULL;
thread->system_regs = 0;
thread->queue = NULL;
@@ -297,7 +298,10 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
@@ -362,7 +363,10 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
}
if (do_esync())
@@ -322,7 +322,7 @@ index 7c8b6da8a55..7da1a620ddd 100644
set_fd_events( thread->request_fd, POLLIN ); /* start listening to events */
add_process_thread( thread->process, thread );
@@ -1077,8 +1081,13 @@ static int queue_apc( struct process *process, struct thread *thread, struct thr
@@ -1153,8 +1157,13 @@ static int queue_apc( struct process *process, struct thread *thread, struct thr
grab_object( apc );
list_add_tail( queue, &apc->entry );
if (!list_prev( queue, &apc->entry )) /* first one */
@@ -336,7 +336,7 @@ index 7c8b6da8a55..7da1a620ddd 100644
return 1;
}
@@ -1124,6 +1133,10 @@ static struct thread_apc *thread_dequeue_apc( struct thread *thread, int system
@@ -1200,6 +1209,10 @@ static struct thread_apc *thread_dequeue_apc( struct thread *thread, int system
apc = LIST_ENTRY( ptr, struct thread_apc, entry );
list_remove( ptr );
}
@@ -348,7 +348,7 @@ index 7c8b6da8a55..7da1a620ddd 100644
}
diff --git a/server/thread.h b/server/thread.h
index 8a737010a5b..53409c11956 100644
index 1b2973cba63..9ed70aee857 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -55,6 +55,7 @@ struct thread
@@ -360,5 +360,5 @@ index 8a737010a5b..53409c11956 100644
unsigned int system_regs; /* which system regs have been set */
struct msg_queue *queue; /* message queue */
--
2.26.0
2.26.2