Rebase against 5e75310837e5ec77ebc361d689ea3279fa49ebac.

This commit is contained in:
Zebediah Figura 2020-04-13 18:10:11 -05:00
parent 4c160ec82a
commit 437038604a
8 changed files with 130 additions and 132 deletions

View File

@ -1,4 +1,4 @@
From f55b5ebadbc078201d81f5f53ad248be58bfac13 Mon Sep 17 00:00:00 2001
From 454430de5505b16af9d90ee99d5fa8a034853d2b 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 119a36f36..8a41f6961 100644
index 119a36f3611..5db7adcace7 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 )
@ -184,8 +184,8 @@ index 119a36f36..8a41f6961 100644
+ TRACE("Woken up by user APC.\n");
+
+ /* We have to make a server call anyway to get the APC to execute, so just
+ * delegate down to server_select(). */
+ ret = server_select( NULL, 0, SELECT_INTERRUPTIBLE | SELECT_ALERTABLE, &zero );
+ * delegate down to server_wait(). */
+ ret = server_wait( NULL, 0, SELECT_INTERRUPTIBLE | SELECT_ALERTABLE, &zero );
+
+ /* This can happen if we received a system APC, and the APC fd was woken up
+ * before we got SIGUSR1. poll() doesn't return EINTR in that case. The
@ -196,10 +196,10 @@ index 119a36f36..8a41f6961 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 31714f905..009dd33ed 100644
index 009cfe73330..d7f88f7f8f0 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -239,6 +239,7 @@ struct ntdll_thread_data
@@ -261,6 +261,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,10 +208,10 @@ index 31714f905..009dd33ed 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 95c175aa7..711505242 100644
index 97e6d816bdd..129f42b3e01 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -328,6 +328,7 @@ void thread_init(void)
@@ -357,6 +357,7 @@ TEB *thread_init(void)
thread_data->wait_fd[0] = -1;
thread_data->wait_fd[1] = -1;
thread_data->esync_queue_fd = -1;
@ -219,7 +219,7 @@ index 95c175aa7..711505242 100644
signal_init_thread( teb );
virtual_init_threading();
@@ -706,6 +707,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT
@@ -757,6 +758,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;
@ -228,10 +228,10 @@ index 95c175aa7..711505242 100644
pthread_attr_init( &pthread_attr );
pthread_attr_setstack( &pthread_attr, teb->DeallocationStack,
diff --git a/server/esync.c b/server/esync.c
index 5ef4dd282..4fb42e6f9 100644
index c68b2bc1fc0..a3cd1a8decf 100644
--- a/server/esync.c
+++ b/server/esync.c
@@ -247,19 +247,25 @@ int esync_create_fd( int initval, int flags )
@@ -246,19 +246,25 @@ int esync_create_fd( int initval, int flags )
#endif
}
@ -261,7 +261,7 @@ index 5ef4dd282..4fb42e6f9 100644
}
}
@@ -385,3 +391,9 @@ DECL_HANDLER(get_esync_fd)
@@ -384,3 +390,9 @@ DECL_HANDLER(get_esync_fd)
release_object( obj );
}
@ -272,7 +272,7 @@ index 5ef4dd282..4fb42e6f9 100644
+ send_client_fd( current->process, current->esync_apc_fd, current->id );
+}
diff --git a/server/esync.h b/server/esync.h
index aeb58c546..cea025d93 100644
index aeb58c5469c..cea025d9308 100644
--- a/server/esync.h
+++ b/server/esync.h
@@ -21,6 +21,7 @@
@ -284,10 +284,10 @@ index aeb58c546..cea025d93 100644
void esync_clear( int fd );
diff --git a/server/protocol.def b/server/protocol.def
index 65a6696e3..d577edc0e 100644
index eca0325e5c5..975802737fa 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -4054,6 +4054,11 @@ struct handle_info
@@ -4083,6 +4083,11 @@ struct handle_info
unsigned int shm_idx; /* this object's index into the shm section */
@END
@ -300,7 +300,7 @@ index 65a6696e3..d577edc0e 100644
{
ESYNC_SEMAPHORE = 1,
diff --git a/server/thread.c b/server/thread.c
index b7ed72a5c..fc751c2cb 100644
index 7c8b6da8a55..7da1a620ddd 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -188,6 +188,7 @@ static inline void init_thread_structure( struct thread *thread )
@ -311,7 +311,7 @@ index b7ed72a5c..fc751c2cb 100644
thread->debug_ctx = NULL;
thread->system_regs = 0;
thread->queue = NULL;
@@ -295,7 +296,10 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
@@ -297,7 +298,10 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
}
if (do_esync())
@ -322,7 +322,7 @@ index b7ed72a5c..fc751c2cb 100644
set_fd_events( thread->request_fd, POLLIN ); /* start listening to events */
add_process_thread( thread->process, thread );
@@ -1050,8 +1054,13 @@ static int queue_apc( struct process *process, struct thread *thread, struct thr
@@ -1077,8 +1081,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 b7ed72a5c..fc751c2cb 100644
return 1;
}
@@ -1098,6 +1107,10 @@ static struct thread_apc *thread_dequeue_apc( struct thread *thread, int system_
@@ -1124,6 +1133,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 b7ed72a5c..fc751c2cb 100644
}
diff --git a/server/thread.h b/server/thread.h
index dd06333fd..a62559dc4 100644
index 8a737010a5b..53409c11956 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -55,6 +55,7 @@ struct thread
@ -360,5 +360,5 @@ index dd06333fd..a62559dc4 100644
unsigned int system_regs; /* which system regs have been set */
struct msg_queue *queue; /* message queue */
--
2.22.0
2.26.0

View File

@ -1,15 +1,14 @@
From 78390efe3e29255fc19abd46e1741a332f6acde9 Mon Sep 17 00:00:00 2001
From 5262cc2c80ae65a0144dffb16072473149c70da7 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Wed, 20 Jun 2018 13:41:12 -0500
Subject: [PATCH 55/83] ntdll: Let the server know when we are doing a message
wait.
Subject: [PATCH] ntdll: Let the server know when we are doing a message wait.
---
dlls/ntdll/esync.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/dlls/ntdll/esync.c b/dlls/ntdll/esync.c
index 5eef7e3c8..d935a4af5 100644
index 80f659d6fde..f2dc32f3a0e 100644
--- a/dlls/ntdll/esync.c
+++ b/dlls/ntdll/esync.c
@@ -753,11 +753,22 @@ NTSTATUS esync_wait_objects( DWORD count, const HANDLE *handles, BOOLEAN wait_an
@ -29,12 +28,12 @@ index 5eef7e3c8..d935a4af5 100644
+ * hung queues. Do it like this. */
+ select_op.wait.op = SELECT_WAIT;
+ select_op.wait.handles[0] = wine_server_obj_handle( handles[count - 1] );
+ ret = server_select( &select_op, offsetof( select_op_t, wait.handles[1] ), 0, &zero );
+ ret = server_wait( &select_op, offsetof( select_op_t, wait.handles[1] ), 0, &zero );
+ if (ret != STATUS_WAIT_0 && ret != STATUS_TIMEOUT)
+ ERR("Unexpected ret %#x\n", ret);
}
if (has_esync && has_server)
--
2.20.1
2.26.0

View File

@ -1,22 +1,21 @@
From e880d8328ae7d2602c828298fcf78e7bc9188add Mon Sep 17 00:00:00 2001
From ffbf02d62296a0a0f56d3792bad1ff107d2ef725 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Wed, 20 Jun 2018 14:04:04 -0500
Subject: [PATCH 56/83] ntdll: Avoid server_select() when waiting for critical
Subject: [PATCH] ntdll: Avoid server_select() when waiting for critical
sections.
There's no reason not to always use NtWaitForSingleObject(), so just do that.
And of course this lets esync work right.
---
dlls/ntdll/critsection.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/dlls/ntdll/critsection.c b/dlls/ntdll/critsection.c
index 6b17cebe0..d9add3f06 100644
index 1892d3abcb7..32907703730 100644
--- a/dlls/ntdll/critsection.c
+++ b/dlls/ntdll/critsection.c
@@ -220,12 +220,9 @@ static inline NTSTATUS wait_semaphore( RTL_CRITICAL_SECTION *crit, int timeout )
@@ -237,12 +237,9 @@ static inline NTSTATUS wait_semaphore( RTL_CRITICAL_SECTION *crit, int timeout )
{
HANDLE sem = get_semaphore( crit );
LARGE_INTEGER time;
@ -25,11 +24,11 @@ index 6b17cebe0..d9add3f06 100644
time.QuadPart = timeout * (LONGLONG)-10000000;
- select_op.wait.op = SELECT_WAIT;
- select_op.wait.handles[0] = wine_server_obj_handle( sem );
- ret = server_select( &select_op, offsetof( select_op_t, wait.handles[1] ), 0, &time );
- ret = server_wait( &select_op, offsetof( select_op_t, wait.handles[1] ), 0, &time );
+ ret = NtWaitForSingleObject( sem, FALSE, &time );
}
return ret;
}
--
2.20.1
2.26.0

View File

@ -1,4 +1,4 @@
From 997461625f8169228a34358a6908ff24b1d4f602 Mon Sep 17 00:00:00 2001
From d67891b541cfcd5107805b088f20d3b8ca7f7d00 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Mon, 13 Aug 2018 21:35:06 -0500
Subject: [PATCH] ntdll, server: Revert to old implementation of hung queue
@ -22,7 +22,7 @@ critical code that this patchset was written for.
3 files changed, 73 insertions(+), 21 deletions(-)
diff --git a/dlls/ntdll/esync.c b/dlls/ntdll/esync.c
index ea4654d1f13..4ffbc4bd25e 100644
index 2cdfcca4f04..9c7e8deea85 100644
--- a/dlls/ntdll/esync.c
+++ b/dlls/ntdll/esync.c
@@ -831,8 +831,8 @@ static void update_grabbed_object( struct esync *obj )
@ -53,7 +53,7 @@ index ea4654d1f13..4ffbc4bd25e 100644
- * hung queues. Do it like this. */
- select_op.wait.op = SELECT_WAIT;
- select_op.wait.handles[0] = wine_server_obj_handle( handles[count - 1] );
- ret = server_select( &select_op, offsetof( select_op_t, wait.handles[1] ), 0, &zero );
- ret = server_wait( &select_op, offsetof( select_op_t, wait.handles[1] ), 0, &zero );
- if (ret != STATUS_WAIT_0 && ret != STATUS_TIMEOUT)
- ERR("Unexpected ret %#x\n", ret);
}
@ -105,10 +105,10 @@ index ea4654d1f13..4ffbc4bd25e 100644
const LARGE_INTEGER *timeout )
{
diff --git a/server/protocol.def b/server/protocol.def
index 7082fee04b5..7078c33b94b 100644
index ab5e205462d..2260f432311 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -4077,7 +4077,11 @@ struct handle_info
@@ -4085,7 +4085,11 @@ struct handle_info
/* Retrieve the fd to wait on for user APCs. */
@REQ(get_esync_apc_fd)
@ -122,7 +122,7 @@ index 7082fee04b5..7078c33b94b 100644
enum esync_type
diff --git a/server/queue.c b/server/queue.c
index b6ed2478c6e..5eb1a046f7b 100644
index c365eacb9e0..2b780deb112 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -126,6 +126,7 @@ struct msg_queue
@ -133,7 +133,7 @@ index b6ed2478c6e..5eb1a046f7b 100644
unsigned int wake_bits; /* wakeup bits */
unsigned int wake_mask; /* wakeup mask */
unsigned int changed_bits; /* changed wakeup bits */
@@ -975,7 +976,21 @@ static void cleanup_results( struct msg_queue *queue )
@@ -996,7 +997,21 @@ static void cleanup_results( struct msg_queue *queue )
/* check if the thread owning the queue is hung (not checking for messages) */
static int is_queue_hung( struct msg_queue *queue )
{
@ -156,7 +156,7 @@ index b6ed2478c6e..5eb1a046f7b 100644
}
static int msg_queue_add_queue( struct object *obj, struct wait_queue_entry *entry )
@@ -991,12 +1006,6 @@ static int msg_queue_add_queue( struct object *obj, struct wait_queue_entry *ent
@@ -1012,12 +1027,6 @@ static int msg_queue_add_queue( struct object *obj, struct wait_queue_entry *ent
}
if (process->idle_event && !(queue->wake_mask & QS_SMRESULT)) set_event( process->idle_event );
@ -169,7 +169,7 @@ index b6ed2478c6e..5eb1a046f7b 100644
if (queue->fd && list_empty( &obj->wait_queue )) /* first on the queue */
set_fd_events( queue->fd, POLLIN );
add_queue( obj, entry );
@@ -1688,6 +1697,7 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa
@@ -1728,6 +1737,7 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa
if (!(hook_thread = get_first_global_hook( id ))) return 0;
if (!(queue = hook_thread->queue)) return 0;
@ -177,7 +177,7 @@ index b6ed2478c6e..5eb1a046f7b 100644
if (!(msg = mem_alloc( sizeof(*msg) ))) return 0;
@@ -3383,3 +3393,14 @@ DECL_HANDLER(get_rawinput_devices)
@@ -3432,3 +3442,14 @@ DECL_HANDLER(get_rawinput_devices)
set_reply_data_ptr( devices, device_count * sizeof (*devices) );
}

View File

@ -1,4 +1,4 @@
From 32fbaef5e77e1fbe08ad35c933ff4ed7f61217f8 Mon Sep 17 00:00:00 2001
From 334c3d93fc14f11be5b750c539f61a9ae88a943f Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 5 Aug 2017 03:37:47 +0200
Subject: [PATCH] include: Move interlocked_inc/dec to port.h.
@ -10,7 +10,7 @@ Subject: [PATCH] include: Move interlocked_inc/dec to port.h.
3 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/dlls/ntdll/critsection.c b/dlls/ntdll/critsection.c
index 42e432c8f65..6b17cebe058 100644
index 1892d3abcb7..95acc321240 100644
--- a/dlls/ntdll/critsection.c
+++ b/dlls/ntdll/critsection.c
@@ -40,16 +40,6 @@
@ -31,10 +31,10 @@ index 42e432c8f65..6b17cebe058 100644
{
#ifdef __i386__
diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c
index bf7449cdfa6..b8dc8273702 100644
index 215a5e9c53a..6ee739b9c02 100644
--- a/dlls/ntdll/threadpool.c
+++ b/dlls/ntdll/threadpool.c
@@ -331,16 +331,6 @@ static void tp_object_prepare_shutdown( struct threadpool_object *object );
@@ -378,16 +378,6 @@ static void tp_object_prepare_shutdown( struct threadpool_object *object );
static BOOL tp_object_release( struct threadpool_object *object );
static struct threadpool *default_threadpool = NULL;
@ -48,14 +48,14 @@ index bf7449cdfa6..b8dc8273702 100644
- return interlocked_xchg_add( dest, -1 ) - 1;
-}
-
static void CALLBACK process_rtl_work_item( TP_CALLBACK_INSTANCE *instance, void *userdata )
static BOOL array_reserve(void **elements, unsigned int *capacity, unsigned int count, unsigned int size)
{
struct rtl_work_item *item = userdata;
unsigned int new_capacity, max_capacity;
diff --git a/include/wine/port.h b/include/wine/port.h
index e32818e5455..470ba66cb50 100644
index 8514a4a43bf..60c95af6cb5 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -501,6 +501,16 @@ static inline __int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int6
@@ -479,6 +479,16 @@ static inline __int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int6
extern __int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compare );
#endif
@ -72,7 +72,7 @@ index e32818e5455..470ba66cb50 100644
#else /* NO_LIBWINE_PORT */
#define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable
@@ -511,9 +521,11 @@ extern __int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compa
@@ -489,9 +499,11 @@ extern __int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compa
#define getopt_long_only __WINE_NOT_PORTABLE(getopt_long_only)
#define interlocked_cmpxchg __WINE_NOT_PORTABLE(interlocked_cmpxchg)
#define interlocked_cmpxchg_ptr __WINE_NOT_PORTABLE(interlocked_cmpxchg_ptr)
@ -86,5 +86,5 @@ index e32818e5455..470ba66cb50 100644
#define pread __WINE_NOT_PORTABLE(pread)
#define pwrite __WINE_NOT_PORTABLE(pwrite)
--
2.20.1
2.26.0

View File

@ -1,17 +1,17 @@
From 858272e45212c9bbcbd121b6a5fc7f25358cd40f Mon Sep 17 00:00:00 2001
From 7fb74639d7598c653bbd70fef5c58c9a1c1541d3 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 5 Aug 2017 03:39:37 +0200
Subject: [PATCH] ntdll: Use fast CS functions for threadpool locking.
---
dlls/ntdll/threadpool.c | 96 ++++++++++++++++++++++++-------------------------
dlls/ntdll/threadpool.c | 96 ++++++++++++++++++++---------------------
1 file changed, 48 insertions(+), 48 deletions(-)
diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c
index db7391b..639e032 100644
index 6ee739b9c02..94d6efced9e 100644
--- a/dlls/ntdll/threadpool.c
+++ b/dlls/ntdll/threadpool.c
@@ -1206,7 +1206,7 @@ static void CALLBACK timerqueue_thread_proc( void *param )
@@ -1279,7 +1279,7 @@ static void CALLBACK timerqueue_thread_proc( void *param )
TRACE( "starting timer queue thread\n" );
@ -20,7 +20,7 @@ index db7391b..639e032 100644
for (;;)
{
NtQuerySystemTime( &now );
@@ -1280,7 +1280,7 @@ static void CALLBACK timerqueue_thread_proc( void *param )
@@ -1353,7 +1353,7 @@ static void CALLBACK timerqueue_thread_proc( void *param )
}
timerqueue.thread_running = FALSE;
@ -29,7 +29,7 @@ index db7391b..639e032 100644
TRACE( "terminating timer queue thread\n" );
RtlExitUserThread( 0 );
@@ -1326,7 +1326,7 @@ static NTSTATUS tp_timerqueue_lock( struct threadpool_object *timer )
@@ -1399,7 +1399,7 @@ static NTSTATUS tp_timerqueue_lock( struct threadpool_object *timer )
timer->u.timer.period = 0;
timer->u.timer.window_length = 0;
@ -38,7 +38,7 @@ index db7391b..639e032 100644
/* Make sure that the timerqueue thread is running. */
if (!timerqueue.thread_running)
@@ -1347,7 +1347,7 @@ static NTSTATUS tp_timerqueue_lock( struct threadpool_object *timer )
@@ -1420,7 +1420,7 @@ static NTSTATUS tp_timerqueue_lock( struct threadpool_object *timer )
timerqueue.objcount++;
}
@ -47,7 +47,7 @@ index db7391b..639e032 100644
return status;
}
@@ -1360,7 +1360,7 @@ static void tp_timerqueue_unlock( struct threadpool_object *timer )
@@ -1433,7 +1433,7 @@ static void tp_timerqueue_unlock( struct threadpool_object *timer )
{
assert( timer->type == TP_OBJECT_TYPE_TIMER );
@ -56,7 +56,7 @@ index db7391b..639e032 100644
if (timer->u.timer.timer_initialized)
{
/* If timer was pending, remove it. */
@@ -1379,7 +1379,7 @@ static void tp_timerqueue_unlock( struct threadpool_object *timer )
@@ -1452,7 +1452,7 @@ static void tp_timerqueue_unlock( struct threadpool_object *timer )
timer->u.timer.timer_initialized = FALSE;
}
@ -65,7 +65,7 @@ index db7391b..639e032 100644
}
/***********************************************************************
@@ -1397,7 +1397,7 @@ static void CALLBACK waitqueue_thread_proc( void *param )
@@ -1470,7 +1470,7 @@ static void CALLBACK waitqueue_thread_proc( void *param )
TRACE( "starting wait queue thread\n" );
@ -74,7 +74,7 @@ index db7391b..639e032 100644
for (;;)
{
@@ -1434,10 +1434,10 @@ static void CALLBACK waitqueue_thread_proc( void *param )
@@ -1507,10 +1507,10 @@ static void CALLBACK waitqueue_thread_proc( void *param )
/* All wait objects have been destroyed, if no new wait objects are created
* within some amount of time, then we can shutdown this thread. */
assert( num_handles == 0 );
@ -87,7 +87,7 @@ index db7391b..639e032 100644
if (status == STATUS_TIMEOUT && !bucket->objcount)
break;
@@ -1445,9 +1445,9 @@ static void CALLBACK waitqueue_thread_proc( void *param )
@@ -1518,9 +1518,9 @@ static void CALLBACK waitqueue_thread_proc( void *param )
else
{
handles[num_handles] = bucket->update_event;
@ -99,7 +99,7 @@ index db7391b..639e032 100644
if (status >= STATUS_WAIT_0 && status < STATUS_WAIT_0 + num_handles)
{
@@ -1520,7 +1520,7 @@ static void CALLBACK waitqueue_thread_proc( void *param )
@@ -1593,7 +1593,7 @@ static void CALLBACK waitqueue_thread_proc( void *param )
if (!--waitqueue.num_buckets)
assert( list_empty( &waitqueue.buckets ) );
@ -108,7 +108,7 @@ index db7391b..639e032 100644
TRACE( "terminating wait queue thread\n" );
@@ -1549,7 +1549,7 @@ static NTSTATUS tp_waitqueue_lock( struct threadpool_object *wait )
@@ -1622,7 +1622,7 @@ static NTSTATUS tp_waitqueue_lock( struct threadpool_object *wait )
wait->u.wait.timeout = 0;
wait->u.wait.handle = INVALID_HANDLE_VALUE;
@ -117,7 +117,7 @@ index db7391b..639e032 100644
/* Try to assign to existing bucket if possible. */
LIST_FOR_EACH_ENTRY( bucket, &waitqueue.buckets, struct waitqueue_bucket, bucket_entry )
@@ -1605,7 +1605,7 @@ static NTSTATUS tp_waitqueue_lock( struct threadpool_object *wait )
@@ -1678,7 +1678,7 @@ static NTSTATUS tp_waitqueue_lock( struct threadpool_object *wait )
}
out:
@ -126,7 +126,7 @@ index db7391b..639e032 100644
return status;
}
@@ -1616,7 +1616,7 @@ static void tp_waitqueue_unlock( struct threadpool_object *wait )
@@ -1689,7 +1689,7 @@ static void tp_waitqueue_unlock( struct threadpool_object *wait )
{
assert( wait->type == TP_OBJECT_TYPE_WAIT );
@ -135,7 +135,7 @@ index db7391b..639e032 100644
if (wait->u.wait.bucket)
{
struct waitqueue_bucket *bucket = wait->u.wait.bucket;
@@ -1628,7 +1628,7 @@ static void tp_waitqueue_unlock( struct threadpool_object *wait )
@@ -1701,7 +1701,7 @@ static void tp_waitqueue_unlock( struct threadpool_object *wait )
NtSetEvent( bucket->update_event, NULL );
}
@ -143,8 +143,8 @@ index db7391b..639e032 100644
+ leave_critical_section( &waitqueue.cs );
}
/***********************************************************************
@@ -1759,7 +1759,7 @@ static NTSTATUS tp_threadpool_lock( struct threadpool **out, TP_CALLBACK_ENVIRON
static void CALLBACK ioqueue_thread_proc( void *param )
@@ -1956,7 +1956,7 @@ static NTSTATUS tp_threadpool_lock( struct threadpool **out, TP_CALLBACK_ENVIRON
pool = default_threadpool;
}
@ -153,7 +153,7 @@ index db7391b..639e032 100644
/* Make sure that the threadpool has at least one thread. */
if (!pool->num_workers)
@@ -1773,7 +1773,7 @@ static NTSTATUS tp_threadpool_lock( struct threadpool **out, TP_CALLBACK_ENVIRON
@@ -1970,7 +1970,7 @@ static NTSTATUS tp_threadpool_lock( struct threadpool **out, TP_CALLBACK_ENVIRON
pool->objcount++;
}
@ -162,7 +162,7 @@ index db7391b..639e032 100644
if (status != STATUS_SUCCESS)
return status;
@@ -1789,9 +1789,9 @@ static NTSTATUS tp_threadpool_lock( struct threadpool **out, TP_CALLBACK_ENVIRON
@@ -1986,9 +1986,9 @@ static NTSTATUS tp_threadpool_lock( struct threadpool **out, TP_CALLBACK_ENVIRON
*/
static void tp_threadpool_unlock( struct threadpool *pool )
{
@ -174,7 +174,7 @@ index db7391b..639e032 100644
tp_threadpool_release( pool );
}
@@ -1928,10 +1928,10 @@ static void tp_object_initialize( struct threadpool_object *object, struct threa
@@ -2125,10 +2125,10 @@ static void tp_object_initialize( struct threadpool_object *object, struct threa
struct threadpool_group *group = object->group;
interlocked_inc( &group->refcount );
@ -187,7 +187,7 @@ index db7391b..639e032 100644
}
if (is_simple_callback)
@@ -1957,7 +1957,7 @@ static void tp_object_submit( struct threadpool_object *object, BOOL signaled )
@@ -2154,7 +2154,7 @@ static void tp_object_submit( struct threadpool_object *object, BOOL signaled )
assert( !object->shutdown );
assert( !pool->shutdown );
@ -196,7 +196,7 @@ index db7391b..639e032 100644
/* Start new worker threads if required. */
if (pool->num_busy_workers >= pool->num_workers &&
@@ -1980,7 +1980,7 @@ static void tp_object_submit( struct threadpool_object *object, BOOL signaled )
@@ -2177,7 +2177,7 @@ static void tp_object_submit( struct threadpool_object *object, BOOL signaled )
RtlWakeConditionVariable( &pool->update_event );
}
@ -205,7 +205,7 @@ index db7391b..639e032 100644
}
/***********************************************************************
@@ -1993,7 +1993,7 @@ static void tp_object_cancel( struct threadpool_object *object )
@@ -2190,7 +2190,7 @@ static void tp_object_cancel( struct threadpool_object *object )
struct threadpool *pool = object->pool;
LONG pending_callbacks = 0;
@ -214,26 +214,26 @@ index db7391b..639e032 100644
if (object->num_pending_callbacks)
{
pending_callbacks = object->num_pending_callbacks;
@@ -2003,7 +2003,7 @@ static void tp_object_cancel( struct threadpool_object *object )
if (object->type == TP_OBJECT_TYPE_WAIT)
object->u.wait.signaled = 0;
@@ -2202,7 +2202,7 @@ static void tp_object_cancel( struct threadpool_object *object )
}
if (object->type == TP_OBJECT_TYPE_IO)
object->u.io.pending_count = 0;
- RtlLeaveCriticalSection( &pool->cs );
+ leave_critical_section( &pool->cs );
while (pending_callbacks--)
tp_object_release( object );
@@ -2019,7 +2019,7 @@ static void tp_object_wait( struct threadpool_object *object, BOOL group_wait )
@@ -2231,7 +2231,7 @@ static void tp_object_wait( struct threadpool_object *object, BOOL group_wait )
{
struct threadpool *pool = object->pool;
- RtlEnterCriticalSection( &pool->cs );
+ enter_critical_section( &pool->cs );
if (group_wait)
while (!object_is_finished( object, group_wait ))
{
while (object->num_pending_callbacks || object->num_running_callbacks)
@@ -2030,7 +2030,7 @@ static void tp_object_wait( struct threadpool_object *object, BOOL group_wait )
while (object->num_pending_callbacks || object->num_associated_callbacks)
if (group_wait)
@@ -2239,7 +2239,7 @@ static void tp_object_wait( struct threadpool_object *object, BOOL group_wait )
else
RtlSleepConditionVariableCS( &object->finished_event, &pool->cs, NULL );
}
- RtlLeaveCriticalSection( &pool->cs );
@ -241,7 +241,7 @@ index db7391b..639e032 100644
}
/***********************************************************************
@@ -2068,13 +2068,13 @@ static BOOL tp_object_release( struct threadpool_object *object )
@@ -2279,13 +2279,13 @@ static BOOL tp_object_release( struct threadpool_object *object )
{
struct threadpool_group *group = object->group;
@ -257,7 +257,7 @@ index db7391b..639e032 100644
tp_group_release( group );
}
@@ -2117,7 +2117,7 @@ static void CALLBACK threadpool_worker_proc( void *param )
@@ -2329,7 +2329,7 @@ static void CALLBACK threadpool_worker_proc( void *param )
TRACE( "starting worker thread for pool %p\n", pool );
@ -266,7 +266,7 @@ index db7391b..639e032 100644
pool->num_busy_workers--;
for (;;)
{
@@ -2143,7 +2143,7 @@ static void CALLBACK threadpool_worker_proc( void *param )
@@ -2361,7 +2361,7 @@ static void CALLBACK threadpool_worker_proc( void *param )
object->num_associated_callbacks++;
object->num_running_callbacks++;
pool->num_busy_workers++;
@ -275,7 +275,7 @@ index db7391b..639e032 100644
/* Initialize threadpool instance struct. */
callback_instance = (TP_CALLBACK_INSTANCE *)&instance;
@@ -2236,7 +2236,7 @@ static void CALLBACK threadpool_worker_proc( void *param )
@@ -2465,7 +2465,7 @@ static void CALLBACK threadpool_worker_proc( void *param )
}
skip_cleanup:
@ -284,7 +284,7 @@ index db7391b..639e032 100644
pool->num_busy_workers--;
/* Simple callbacks are automatically shutdown after execution. */
@@ -2278,7 +2278,7 @@ static void CALLBACK threadpool_worker_proc( void *param )
@@ -2507,7 +2507,7 @@ static void CALLBACK threadpool_worker_proc( void *param )
}
}
pool->num_workers--;
@ -293,7 +293,7 @@ index db7391b..639e032 100644
TRACE( "terminating worker thread for pool %p\n", pool );
tp_threadpool_release( pool );
@@ -2454,7 +2454,7 @@ NTSTATUS WINAPI TpCallbackMayRunLong( TP_CALLBACK_INSTANCE *instance )
@@ -2747,7 +2747,7 @@ NTSTATUS WINAPI TpCallbackMayRunLong( TP_CALLBACK_INSTANCE *instance )
return STATUS_SUCCESS;
pool = object->pool;
@ -302,7 +302,7 @@ index db7391b..639e032 100644
/* Start new worker threads if required. */
if (pool->num_busy_workers >= pool->num_workers)
@@ -2469,7 +2469,7 @@ NTSTATUS WINAPI TpCallbackMayRunLong( TP_CALLBACK_INSTANCE *instance )
@@ -2762,7 +2762,7 @@ NTSTATUS WINAPI TpCallbackMayRunLong( TP_CALLBACK_INSTANCE *instance )
}
}
@ -311,7 +311,7 @@ index db7391b..639e032 100644
this->may_run_long = TRUE;
return status;
}
@@ -2550,13 +2550,13 @@ VOID WINAPI TpDisassociateCallback( TP_CALLBACK_INSTANCE *instance )
@@ -2843,13 +2843,13 @@ VOID WINAPI TpDisassociateCallback( TP_CALLBACK_INSTANCE *instance )
return;
pool = object->pool;
@ -319,7 +319,7 @@ index db7391b..639e032 100644
+ enter_critical_section( &pool->cs );
object->num_associated_callbacks--;
if (!object->num_pending_callbacks && !object->num_associated_callbacks)
if (object_is_finished( object, FALSE ))
RtlWakeAllConditionVariable( &object->finished_event );
- RtlLeaveCriticalSection( &pool->cs );
@ -327,7 +327,7 @@ index db7391b..639e032 100644
this->associated = FALSE;
}
@@ -2608,7 +2608,7 @@ VOID WINAPI TpReleaseCleanupGroupMembers( TP_CLEANUP_GROUP *group, BOOL cancel_p
@@ -2901,7 +2901,7 @@ VOID WINAPI TpReleaseCleanupGroupMembers( TP_CLEANUP_GROUP *group, BOOL cancel_p
TRACE( "%p %u %p\n", group, cancel_pending, userdata );
@ -336,7 +336,7 @@ index db7391b..639e032 100644
/* Unset group, increase references, and mark objects for shutdown */
LIST_FOR_EACH_ENTRY_SAFE( object, next, &this->members, struct threadpool_object, group_entry )
@@ -2634,7 +2634,7 @@ VOID WINAPI TpReleaseCleanupGroupMembers( TP_CLEANUP_GROUP *group, BOOL cancel_p
@@ -2927,7 +2927,7 @@ VOID WINAPI TpReleaseCleanupGroupMembers( TP_CLEANUP_GROUP *group, BOOL cancel_p
list_init( &members );
list_move_tail( &members, &this->members );
@ -345,7 +345,7 @@ index db7391b..639e032 100644
/* Cancel pending callbacks if requested */
if (cancel_pending)
@@ -2734,10 +2734,10 @@ VOID WINAPI TpSetPoolMaxThreads( TP_POOL *pool, DWORD maximum )
@@ -3041,10 +3041,10 @@ VOID WINAPI TpSetPoolMaxThreads( TP_POOL *pool, DWORD maximum )
TRACE( "%p %u\n", pool, maximum );
@ -358,7 +358,7 @@ index db7391b..639e032 100644
}
/***********************************************************************
@@ -2750,7 +2750,7 @@ BOOL WINAPI TpSetPoolMinThreads( TP_POOL *pool, DWORD minimum )
@@ -3057,7 +3057,7 @@ BOOL WINAPI TpSetPoolMinThreads( TP_POOL *pool, DWORD minimum )
TRACE( "%p %u\n", pool, minimum );
@ -367,7 +367,7 @@ index db7391b..639e032 100644
while (this->num_workers < minimum)
{
@@ -2765,7 +2765,7 @@ BOOL WINAPI TpSetPoolMinThreads( TP_POOL *pool, DWORD minimum )
@@ -3072,7 +3072,7 @@ BOOL WINAPI TpSetPoolMinThreads( TP_POOL *pool, DWORD minimum )
this->max_workers = max( this->min_workers, this->max_workers );
}
@ -376,7 +376,7 @@ index db7391b..639e032 100644
return !status;
}
@@ -2781,7 +2781,7 @@ VOID WINAPI TpSetTimer( TP_TIMER *timer, LARGE_INTEGER *timeout, LONG period, LO
@@ -3088,7 +3088,7 @@ VOID WINAPI TpSetTimer( TP_TIMER *timer, LARGE_INTEGER *timeout, LONG period, LO
TRACE( "%p %p %u %u\n", timer, timeout, period, window_length );
@ -385,7 +385,7 @@ index db7391b..639e032 100644
assert( this->u.timer.timer_initialized );
this->u.timer.timer_set = timeout != NULL;
@@ -2841,7 +2841,7 @@ VOID WINAPI TpSetTimer( TP_TIMER *timer, LARGE_INTEGER *timeout, LONG period, LO
@@ -3148,7 +3148,7 @@ VOID WINAPI TpSetTimer( TP_TIMER *timer, LARGE_INTEGER *timeout, LONG period, LO
this->u.timer.timer_pending = TRUE;
}
@ -394,7 +394,7 @@ index db7391b..639e032 100644
if (submit_timer)
tp_object_submit( this, FALSE );
@@ -2858,7 +2858,7 @@ VOID WINAPI TpSetWait( TP_WAIT *wait, HANDLE handle, LARGE_INTEGER *timeout )
@@ -3165,7 +3165,7 @@ VOID WINAPI TpSetWait( TP_WAIT *wait, HANDLE handle, LARGE_INTEGER *timeout )
TRACE( "%p %p %p\n", wait, handle, timeout );
@ -403,7 +403,7 @@ index db7391b..639e032 100644
assert( this->u.wait.bucket );
this->u.wait.handle = handle;
@@ -2902,7 +2902,7 @@ VOID WINAPI TpSetWait( TP_WAIT *wait, HANDLE handle, LARGE_INTEGER *timeout )
@@ -3209,7 +3209,7 @@ VOID WINAPI TpSetWait( TP_WAIT *wait, HANDLE handle, LARGE_INTEGER *timeout )
NtSetEvent( bucket->update_event, NULL );
}
@ -413,5 +413,5 @@ index db7391b..639e032 100644
if (submit_wait)
tp_object_submit( this, FALSE );
--
1.9.1
2.26.0

View File

@ -52,13 +52,13 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "4cdb7ec8291c171176fb390f4cef1f88409a982f"
echo "5e75310837e5ec77ebc361d689ea3279fa49ebac"
}
# Show version information
version()
{
echo "Wine Staging 5.6"
echo "Wine Staging 5.6.1"
echo "Copyright (C) 2014-2019 the Wine Staging project authors."
echo "Copyright (C) 2018-2020 Alistair Leslie-Hughes"
echo ""

View File

@ -1,4 +1,4 @@
From 2852446d8d31596d8622045d3553c60a953a81ea Mon Sep 17 00:00:00 2001
From 3881d5a6262c869f17318fdf7810a13138110e5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 19 Mar 2015 01:22:34 +0100
Subject: [PATCH] server: Implement support for global and local shared memory
@ -20,22 +20,22 @@ Subject: [PATCH] server: Implement support for global and local shared memory
12 files changed, 215 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 40dc2cd6f..76f0ae971 100644
index 2394ce37113..4764d0db129 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -116,6 +116,7 @@ extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct o
@@ -133,6 +133,7 @@ extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct o
extern NTSTATUS validate_open_object_attributes( const OBJECT_ATTRIBUTES *attr ) DECLSPEC_HIDDEN;
extern int wait_select_reply( void *cookie ) DECLSPEC_HIDDEN;
extern void invoke_apc( const apc_call_t *call, apc_result_t *result ) DECLSPEC_HIDDEN;
extern void invoke_apc( const user_apc_t *apc ) DECLSPEC_HIDDEN;
+extern void *server_get_shared_memory( HANDLE thread ) DECLSPEC_HIDDEN;
/* module handling */
extern LIST_ENTRY tls_links DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index 4facdc08a..3a26024a9 100644
index 9053ad2042c..02b6dca3605 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -998,6 +998,66 @@ done:
@@ -1036,6 +1036,66 @@ done:
}
@ -102,7 +102,7 @@ index 4facdc08a..3a26024a9 100644
/***********************************************************************
* wine_server_fd_to_handle (NTDLL.@)
*
@@ -1535,6 +1595,10 @@ size_t server_init_thread( void *entry_point, BOOL *suspend )
@@ -1576,6 +1636,10 @@ size_t server_init_thread( void *entry_point, BOOL *suspend )
}
SERVER_END_REQ;
@ -114,10 +114,10 @@ index 4facdc08a..3a26024a9 100644
ntdll_get_thread_data()->wow64_redir = is_wow64;
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 7c3930c58..d80ebe235 100644
index 8ab42d65070..e79b43a748b 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -366,6 +366,7 @@ void exit_thread( int status )
@@ -370,6 +370,7 @@ void exit_thread( int status )
void WINAPI RtlExitUserThread( ULONG status )
{
static void *prev_teb;
@ -125,7 +125,7 @@ index 7c3930c58..d80ebe235 100644
sigset_t sigset;
TEB *teb;
@@ -390,6 +391,9 @@ void WINAPI RtlExitUserThread( ULONG status )
@@ -394,6 +395,9 @@ void WINAPI RtlExitUserThread( ULONG status )
LdrShutdownThread();
RtlFreeThreadActivationContextStack();
@ -136,7 +136,7 @@ index 7c3930c58..d80ebe235 100644
if ((teb = interlocked_xchg_ptr( &prev_teb, NtCurrentTeb() )))
diff --git a/include/wine/server.h b/include/wine/server.h
index ac5dcc6f8..5a845f424 100644
index ac5dcc6f8bc..5a845f424c2 100644
--- a/include/wine/server.h
+++ b/include/wine/server.h
@@ -120,6 +120,17 @@ static inline void *wine_server_get_ptr( client_ptr_t ptr )
@ -158,7 +158,7 @@ index ac5dcc6f8..5a845f424 100644
/* macros for server requests */
diff --git a/include/winternl.h b/include/winternl.h
index e5aed5acb..b6b213a0b 100644
index 2ac548764f2..9ca696d4ecc 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -403,7 +403,7 @@ typedef struct _TEB
@ -171,10 +171,10 @@ index e5aed5acb..b6b213a0b 100644
#ifdef _WIN64
PVOID DeallocationBStore; /* /1788 */
diff --git a/server/fd.c b/server/fd.c
index 5d80e218b..87d7047a1 100644
index 39fb419f25f..a7cba834d46 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -2568,6 +2568,33 @@ DECL_HANDLER(write)
@@ -2638,6 +2638,33 @@ DECL_HANDLER(write)
release_object( fd );
}
@ -209,10 +209,10 @@ index 5d80e218b..87d7047a1 100644
DECL_HANDLER(ioctl)
{
diff --git a/server/file.h b/server/file.h
index 4341ad3b0..da9e6b788 100644
index 7395814dadd..1ea6e8e8e8d 100644
--- a/server/file.h
+++ b/server/file.h
@@ -166,6 +166,14 @@ extern struct object *create_mailslot_device( struct object *root, const struct
@@ -180,6 +180,14 @@ extern struct object *create_mailslot_device( struct object *root, const struct
extern struct object *create_unix_device( struct object *root, const struct unicode_str *name,
const char *unix_path );
@ -228,10 +228,10 @@ index 4341ad3b0..da9e6b788 100644
extern void do_change_notify( int unix_fd );
diff --git a/server/main.c b/server/main.c
index 26986d34b..4499d6871 100644
index efb205f5292..43297a3e93d 100644
--- a/server/main.c
+++ b/server/main.c
@@ -144,6 +144,7 @@ int main( int argc, char *argv[] )
@@ -145,6 +145,7 @@ int main( int argc, char *argv[] )
init_signals();
init_directories();
init_registry();
@ -240,7 +240,7 @@ index 26986d34b..4499d6871 100644
return 0;
}
diff --git a/server/mapping.c b/server/mapping.c
index 6990a1913..3d794bfaa 100644
index 6990a1913d7..3d794bfaaf9 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -29,8 +29,32 @@
@ -341,7 +341,7 @@ index 6990a1913..3d794bfaa 100644
static int create_temp_file( file_pos_t size )
{
diff --git a/server/protocol.def b/server/protocol.def
index 6c44b2b43..d3e41247c 100644
index 0830bc684a5..16aafab5b66 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -69,6 +69,15 @@ struct request_max_size
@ -360,7 +360,7 @@ index 6c44b2b43..d3e41247c 100644
/* debug event data */
typedef union
@@ -1320,6 +1329,12 @@ enum server_fd_type
@@ -1329,6 +1338,12 @@ enum server_fd_type
@END
@ -374,7 +374,7 @@ index 6c44b2b43..d3e41247c 100644
@REQ(flush)
async_data_t async; /* async I/O parameters */
diff --git a/server/thread.c b/server/thread.c
index 7683b6698..77edbcdcd 100644
index d3bbd8ecfa8..a1d24c160ac 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -204,6 +204,8 @@ static inline void init_thread_structure( struct thread *thread )
@ -407,7 +407,7 @@ index 7683b6698..77edbcdcd 100644
/* destroy a thread when its refcount is 0 */
diff --git a/server/thread.h b/server/thread.h
index 1256e0da4..bc4ad79b1 100644
index 1256e0da49e..bc4ad79b110 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -91,6 +91,8 @@ struct thread
@ -420,5 +420,5 @@ index 1256e0da4..bc4ad79b1 100644
struct thread_snapshot
--
2.25.0
2.26.0