Rebase against cfbbde2abce1eedc7f53db3f8af8078fe4a11cac.

This commit is contained in:
Alistair Leslie-Hughes
2021-02-02 10:51:17 +11:00
parent f6dacd2f9a
commit a6054cf2e9
10 changed files with 61 additions and 249 deletions

View File

@@ -1,4 +1,4 @@
From 882fe7c0815814c912722d663c981c411e7314f5 Mon Sep 17 00:00:00 2001
From 88819d39a698afb9024eb37d233cdddf490a0930 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Fri, 8 Jun 2018 22:04:29 -0500
Subject: [PATCH] server: Create eventfd file descriptors for thread objects.
@@ -9,7 +9,7 @@ Subject: [PATCH] server: Create eventfd file descriptors for thread objects.
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/server/thread.c b/server/thread.c
index 2d2a80a61ef..c52057d1f50 100644
index 0fddc37856a..48c3eae7413 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -172,6 +172,7 @@ static const struct object_ops context_ops =
@@ -34,10 +34,10 @@ index 2d2a80a61ef..c52057d1f50 100644
thread->teb = 0;
thread->entry_point = 0;
+ thread->esync_fd = -1;
thread->debug_obj = NULL;
thread->system_regs = 0;
thread->queue = NULL;
@@ -361,6 +363,9 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
thread->wait = NULL;
@@ -360,6 +362,9 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
return NULL;
}
@@ -47,7 +47,7 @@ index 2d2a80a61ef..c52057d1f50 100644
set_fd_events( thread->request_fd, POLLIN ); /* start listening to events */
add_process_thread( thread->process, thread );
return thread;
@@ -441,6 +446,9 @@ static void destroy_thread( struct object *obj )
@@ -439,6 +444,9 @@ static void destroy_thread( struct object *obj )
if (thread->exit_poll) remove_timeout_user( thread->exit_poll );
if (thread->id) free_ptid( thread->id );
if (thread->token) release_object( thread->token );
@@ -57,7 +57,7 @@ index 2d2a80a61ef..c52057d1f50 100644
}
/* dump a thread on stdout for debugging purposes */
@@ -466,6 +474,13 @@ static int thread_signaled( struct object *obj, struct wait_queue_entry *entry )
@@ -464,6 +472,13 @@ static int thread_signaled( struct object *obj, struct wait_queue_entry *entry )
return mythread->state == TERMINATED && !mythread->exit_poll;
}
@@ -72,7 +72,7 @@ index 2d2a80a61ef..c52057d1f50 100644
{
if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | THREAD_QUERY_INFORMATION | THREAD_GET_CONTEXT;
diff --git a/server/thread.h b/server/thread.h
index 4a8c5b1cb2c..e6a9f987c9e 100644
index 077ab0929ba..99904557d44 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -54,6 +54,7 @@ struct thread
@@ -80,9 +80,9 @@ index 4a8c5b1cb2c..e6a9f987c9e 100644
thread_id_t id; /* thread id */
struct list mutex_list; /* list of currently owned mutexes */
+ int esync_fd; /* esync file descriptor (signalled on exit) */
struct debug_obj *debug_obj; /* debugger context if this thread is a debugger */
unsigned int system_regs; /* which system regs have been set */
struct msg_queue *queue; /* message queue */
struct thread_wait *wait; /* current wait condition if sleeping */
--
2.29.2

View File

@@ -1,4 +1,4 @@
From 607d2418e9997885192791cb54a9cdfdaf77eee1 Mon Sep 17 00:00:00 2001
From abe8fc2432fa484ab121005ad21a92c0c27668b7 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <zfigura@codeweavers.com>
Date: Mon, 6 Jul 2020 17:17:31 -0500
Subject: [PATCH] ntdll, server: Implement alertable waits.
@@ -244,10 +244,10 @@ index aeb58c5469c..cea025d9308 100644
void esync_clear( int fd );
diff --git a/server/protocol.def b/server/protocol.def
index e60d6f7e8dd..34eaff6207c 100644
index f2ad5a88b28..56237afdcad 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3718,3 +3718,7 @@ enum esync_type
@@ -3717,3 +3717,7 @@ enum esync_type
@REQ(esync_msgwait)
int in_msgwait; /* are we in a message wait? */
@END
@@ -256,7 +256,7 @@ index e60d6f7e8dd..34eaff6207c 100644
+@REQ(get_esync_apc_fd)
+@END
diff --git a/server/thread.c b/server/thread.c
index c52057d1f50..0b905e6a155 100644
index 48c3eae7413..83f80740a46 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -227,6 +227,7 @@ static inline void init_thread_structure( struct thread *thread )
@@ -264,10 +264,10 @@ index c52057d1f50..0b905e6a155 100644
thread->entry_point = 0;
thread->esync_fd = -1;
+ thread->esync_apc_fd = -1;
thread->debug_obj = NULL;
thread->system_regs = 0;
thread->queue = NULL;
@@ -364,7 +365,10 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
thread->wait = NULL;
@@ -363,7 +364,10 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
}
if (do_esync())
@@ -278,7 +278,7 @@ index c52057d1f50..0b905e6a155 100644
set_fd_events( thread->request_fd, POLLIN ); /* start listening to events */
add_process_thread( thread->process, thread );
@@ -1152,8 +1156,13 @@ static int queue_apc( struct process *process, struct thread *thread, struct thr
@@ -1150,8 +1154,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 */
@@ -292,7 +292,7 @@ index c52057d1f50..0b905e6a155 100644
return 1;
}
@@ -1199,6 +1208,10 @@ static struct thread_apc *thread_dequeue_apc( struct thread *thread, int system
@@ -1197,6 +1206,10 @@ static struct thread_apc *thread_dequeue_apc( struct thread *thread, int system
apc = LIST_ENTRY( ptr, struct thread_apc, entry );
list_remove( ptr );
}
@@ -304,7 +304,7 @@ index c52057d1f50..0b905e6a155 100644
}
diff --git a/server/thread.h b/server/thread.h
index e6a9f987c9e..ff86da99798 100644
index 99904557d44..f41c3ddd61e 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -55,6 +55,7 @@ struct thread
@@ -312,9 +312,9 @@ index e6a9f987c9e..ff86da99798 100644
struct list mutex_list; /* list of currently owned mutexes */
int esync_fd; /* esync file descriptor (signalled on exit) */
+ int esync_apc_fd; /* esync apc fd (signalled when APCs are present) */
struct debug_obj *debug_obj; /* debugger context if this thread is a debugger */
unsigned int system_regs; /* which system regs have been set */
struct msg_queue *queue; /* message queue */
struct thread_wait *wait; /* current wait condition if sleeping */
--
2.29.2

View File

@@ -1,4 +1,4 @@
From 5126b7e8cd315c7e85d84b897fd2d271d62d91c1 Mon Sep 17 00:00:00 2001
From 075bdc732f12d42184ee6a906f58051739972322 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <zfigura@codeweavers.com>
Date: Mon, 6 Jul 2020 18:01:32 -0500
Subject: [PATCH] ntdll, server: Abandon esync mutexes on thread exit.
@@ -175,12 +175,12 @@ index cea025d9308..125da8e9d12 100644
void esync_reset_event( struct esync *esync );
+void esync_abandon_mutexes( struct thread *thread );
diff --git a/server/thread.c b/server/thread.c
index 6fb8684f5e0..f320f2b26e9 100644
index 83f80740a46..bffe229586f 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -1328,6 +1328,8 @@ void kill_thread( struct thread *thread, int violent_death )
@@ -1325,6 +1325,8 @@ void kill_thread( struct thread *thread, int violent_death )
}
kill_console_processes( thread, 0 );
debug_exit_thread( thread );
abandon_mutexes( thread );
+ if (do_esync())
+ esync_abandon_mutexes( thread );
@@ -188,5 +188,5 @@ index 6fb8684f5e0..f320f2b26e9 100644
{
send_thread_signal( thread, SIGQUIT );
--
2.28.0
2.29.2