Rebase against 4e2ad334b5881af7661be4d6df3c51aae92ca4a2

This commit is contained in:
Alistair Leslie-Hughes 2020-05-05 09:11:37 +10:00 committed by Zebediah Figura
parent d4918b4305
commit 76ba9d2387
27 changed files with 209 additions and 302 deletions

View File

@ -82,7 +82,7 @@ index da35bdf85..2bb85d910 100644
+ }
+ }
+
+ obj = interlocked_xchg_ptr((void **)&esync_list[entry][idx], obj);
+ obj = InterlockedExchangePointer((void **)&esync_list[entry][idx], obj);
+ assert(!obj);
+ return TRUE;
+}

View File

@ -26,7 +26,7 @@ index bca95b9b2d9..f7a427425b7 100644
+
+ if (entry < ESYNC_LIST_ENTRIES && esync_list[entry])
+ {
+ if ((obj = interlocked_xchg_ptr( (void **)&esync_list[entry][idx], 0 )))
+ if ((obj = InterlockedExchangePointer( (void **)&esync_list[entry][idx], 0 )))
+ {
+ close( obj->fd );
+ RtlFreeHeap( GetProcessHeap(), 0, obj );

View File

@ -62,7 +62,7 @@ index 9da300853..25e049291 100644
+
+ if (count + current > semaphore->max)
+ return STATUS_SEMAPHORE_LIMIT_EXCEEDED;
+ } while (interlocked_cmpxchg( &semaphore->count, count + current, current ) != current);
+ } while (InterlockedCompareExchange( &semaphore->count, count + current, current ) != current);
+
+ if (prev) *prev = current;
+
@ -83,7 +83,7 @@ index 9da300853..25e049291 100644
+ * the fact that we were able to grab it at all means the count
+ * is nonzero, and if someone else grabbed it then the count
+ * must have been >= 2, etc. */
+ interlocked_xchg_add( &semaphore->count, -1 );
+ InterlockedDecrement( &semaphore->count );
+ }
return i;
}
@ -105,7 +105,7 @@ index 9da300853..25e049291 100644
+ else if (objs[i]->type == ESYNC_SEMAPHORE)
+ {
+ struct semaphore *semaphore = (struct semaphore *)objs[i];
+ interlocked_xchg_add( &semaphore->count, -1 );
+ InterlockedDecrement( &semaphore->count );
+ }
}
TRACE("Wait successful.\n");

View File

@ -100,7 +100,7 @@ index c1d8882d817..ea71c960007 100644
+
+ TRACE("Mapping page %d at %p.\n", entry, addr);
+
+ if (interlocked_cmpxchg_ptr( &shm_addrs[entry], addr, 0 ))
+ if (InterlockedCompareExchangePointer( &shm_addrs[entry], addr, 0 ))
+ munmap( addr, pagesize ); /* someone beat us to it */
+ }
+
@ -654,7 +654,7 @@ index c1d8882d817..ea71c960007 100644
{
- struct semaphore *semaphore = (struct semaphore *)objs[i];
+ struct semaphore *semaphore = objs[i]->shm;
interlocked_xchg_add( &semaphore->count, -1 );
InterlockedDecrement( &semaphore->count );
}
}
diff --git a/dlls/ntdll/esync.h b/dlls/ntdll/esync.h

View File

@ -43,10 +43,10 @@ index 0a1999162..3d0c17fd1 100644
}
}
- obj = interlocked_xchg_ptr((void **)&esync_list[entry][idx], obj);
- obj = InterlockedExchangePointer((void **)&esync_list[entry][idx], obj);
- assert(!obj);
- return TRUE;
+ if (!interlocked_cmpxchg((int *)&esync_list[entry][idx].type, type, 0))
+ if (!InterlockedCompareExchange((int *)&esync_list[entry][idx].type, type, 0))
+ {
+ esync_list[entry][idx].fd = fd;
+ esync_list[entry][idx].shm = shm;
@ -129,8 +129,8 @@ index 0a1999162..3d0c17fd1 100644
if (entry < ESYNC_LIST_ENTRIES && esync_list[entry])
{
- if ((obj = interlocked_xchg_ptr( (void **)&esync_list[entry][idx], 0 )))
+ if (interlocked_xchg((int *)&esync_list[entry][idx].type, 0))
- if ((obj = InterlockedExchangePointer( (void **)&esync_list[entry][idx], 0 )))
+ if (InterlockedExchange((int *)&esync_list[entry][idx].type, 0))
{
- close( obj->fd );
- RtlFreeHeap( GetProcessHeap(), 0, obj );

View File

@ -68,7 +68,7 @@ index 506d1c99d..4e5fcef8e 100644
+ if ((size = read( obj->fd, &value, sizeof(value) )) == sizeof(value))
+ {
+ TRACE("Woken up by handle %p [%d].\n", handles[i], i);
+ interlocked_xchg_add( &semaphore->count, -1 );
+ InterlockedDecrement( &semaphore->count );
+ return i;
+ }
+ }

View File

@ -155,12 +155,12 @@ index 4e5fcef8e..663b3658b 100644
+ event = obj->shm;
+
+ /* Acquire the spinlock. */
+ while (interlocked_cmpxchg( &event->locked, 1, 0 ))
+ while (InterlockedCompareExchange( &event->locked, 1, 0 ))
+ small_pause();
- if (prev)
+ /* Only bother signaling the fd if we weren't already signaled. */
+ if (!(current = interlocked_xchg( &event->signaled, 1 )))
+ if (!(current = InterlockedExchange( &event->signaled, 1 )))
{
- FIXME("Can't write previous value.\n");
- *prev = 1;
@ -192,12 +192,12 @@ index 4e5fcef8e..663b3658b 100644
+ event = obj->shm;
+
+ /* Acquire the spinlock. */
+ while (interlocked_cmpxchg( &event->locked, 1, 0 ))
+ while (InterlockedCompareExchange( &event->locked, 1, 0 ))
+ small_pause();
- if (prev)
+ /* Only bother signaling the fd if we weren't already signaled. */
+ if ((current = interlocked_xchg( &event->signaled, 0 )))
+ if ((current = InterlockedExchange( &event->signaled, 0 )))
{
- FIXME("Can't write previous value.\n");
- *prev = 1;
@ -233,7 +233,7 @@ index 4e5fcef8e..663b3658b 100644
- *prev = 1;
- }
+ /* Acquire the spinlock. */
+ while (interlocked_cmpxchg( &event->locked, 1, 0 ))
+ while (InterlockedCompareExchange( &event->locked, 1, 0 ))
+ small_pause();
/* This isn't really correct; an application could miss the write.
@ -242,7 +242,7 @@ index 4e5fcef8e..663b3658b 100644
return FILE_GetNtStatus();
read( obj->fd, &value, sizeof(value) );
+ current = interlocked_xchg( &event->signaled, 0 );
+ current = InterlockedExchange( &event->signaled, 0 );
+ if (prev) *prev = current;
+
+ /* Release the spinlock. */
@ -273,7 +273,7 @@ index 4e5fcef8e..663b3658b 100644
+ * fact that we were able to grab it at all means the count is nonzero,
+ * and if someone else grabbed it then the count must have been >= 2,
+ * etc. */
+ interlocked_xchg_add( &semaphore->count, -1 );
+ InterlockedDecrement( &semaphore->count );
+ }
+ else if (obj->type == ESYNC_AUTO_EVENT)
+ {
@ -340,7 +340,7 @@ index 4e5fcef8e..663b3658b 100644
- * the fact that we were able to grab it at all means the count
- * is nonzero, and if someone else grabbed it then the count
- * must have been >= 2, etc. */
- interlocked_xchg_add( &semaphore->count, -1 );
- InterlockedDecrement( &semaphore->count );
- }
+ update_grabbed_object( obj );
return i;
@ -360,7 +360,7 @@ index 4e5fcef8e..663b3658b 100644
- else if (objs[i]->type == ESYNC_SEMAPHORE)
- {
- struct semaphore *semaphore = objs[i]->shm;
- interlocked_xchg_add( &semaphore->count, -1 );
- InterlockedDecrement( &semaphore->count );
- }
- }
+ update_grabbed_object( objs[i] );

View File

@ -78,7 +78,7 @@ index 847f1e974..1fc9316b1 100644
+ if (debug_level)
+ fprintf( stderr, "esync: Mapping page %d at %p.\n", entry, addr );
+
+ if (interlocked_cmpxchg_ptr( &shm_addrs[entry], addr, 0 ))
+ if (InterlockedCompareExchangePointer( &shm_addrs[entry], addr, 0 ))
+ munmap( addr, pagesize ); /* someone beat us to it */
+ }
+
@ -116,10 +116,10 @@ index 847f1e974..1fc9316b1 100644
+ fprintf( stderr, "esync_set_event() fd=%d\n", esync->fd );
+
+ /* Acquire the spinlock. */
+ while (interlocked_cmpxchg( &event->locked, 1, 0 ))
+ while (InterlockedCompareExchange( &event->locked, 1, 0 ))
+ small_pause();
+
+ if (!interlocked_xchg( &event->signaled, 1 ))
+ if (!InterlockedExchange( &event->signaled, 1 ))
+ {
+ if (write( esync->fd, &value, sizeof(value) ) == -1)
+ perror( "esync: write" );
@ -143,11 +143,11 @@ index 847f1e974..1fc9316b1 100644
+ fprintf( stderr, "esync_reset_event() fd=%d\n", esync->fd );
+
+ /* Acquire the spinlock. */
+ while (interlocked_cmpxchg( &event->locked, 1, 0 ))
+ while (InterlockedCompareExchange( &event->locked, 1, 0 ))
+ small_pause();
+
+ /* Only bother signaling the fd if we weren't already signaled. */
+ if (interlocked_xchg( &event->signaled, 0 ))
+ if (InterlockedExchange( &event->signaled, 0 ))
+ {
+ /* we don't care about the return value */
+ read( esync->fd, &value, sizeof(value) );

View File

@ -234,7 +234,7 @@ index f5556e91c..19e614a89 100644
+ if (debug_level)
+ fprintf( stderr, "esync: Mapping page %d at %p.\n", entry, addr );
+
+ if (interlocked_cmpxchg_ptr( &shm_addrs[entry], addr, 0 ))
+ if (InterlockedCompareExchangePointer( &shm_addrs[entry], addr, 0 ))
+ munmap( addr, pagesize ); /* someone beat us to it */
+ }
+
@ -340,7 +340,7 @@ index f5556e91c..19e614a89 100644
- if (debug_level)
- fprintf( stderr, "esync: Mapping page %d at %p.\n", entry, addr );
-
- if (interlocked_cmpxchg_ptr( &shm_addrs[entry], addr, 0 ))
- if (InterlockedCompareExchangePointer( &shm_addrs[entry], addr, 0 ))
- munmap( addr, pagesize ); /* someone beat us to it */
- }
-

View File

@ -23,7 +23,7 @@ index 597cb8fa8..d9b5b1a70 100644
+
read( obj->fd, &value, sizeof(value) );
current = interlocked_xchg( &event->signaled, 0 );
current = InterlockedExchange( &event->signaled, 0 );
--
2.20.1

View File

@ -34,12 +34,12 @@ index 2f030c141..87f303403 100644
event = obj->shm;
- /* Acquire the spinlock. */
- while (interlocked_cmpxchg( &event->locked, 1, 0 ))
- while (InterlockedCompareExchange( &event->locked, 1, 0 ))
- small_pause();
+ if (obj->type == ESYNC_MANUAL_EVENT)
+ {
+ /* Acquire the spinlock. */
+ while (interlocked_cmpxchg( &event->locked, 1, 0 ))
+ while (InterlockedCompareExchange( &event->locked, 1, 0 ))
+ small_pause();
+ }
+
@ -53,8 +53,8 @@ index 2f030c141..87f303403 100644
+ * *must* signal the fd now, or any waiting threads will never wake up. */
/* Only bother signaling the fd if we weren't already signaled. */
- if (!(current = interlocked_xchg( &event->signaled, 1 )))
+ if (!(current = interlocked_xchg( &event->signaled, 1 )) || obj->type == ESYNC_AUTO_EVENT)
- if (!(current = InterlockedExchange( &event->signaled, 1 )))
+ if (!(current = InterlockedExchange( &event->signaled, 1 )) || obj->type == ESYNC_AUTO_EVENT)
{
if (write( obj->fd, &value, sizeof(value) ) == -1)
- return FILE_GetNtStatus();
@ -78,24 +78,24 @@ index 2f030c141..87f303403 100644
event = obj->shm;
- /* Acquire the spinlock. */
- while (interlocked_cmpxchg( &event->locked, 1, 0 ))
- while (InterlockedCompareExchange( &event->locked, 1, 0 ))
- small_pause();
+ if (obj->type == ESYNC_MANUAL_EVENT)
+ {
+ /* Acquire the spinlock. */
+ while (interlocked_cmpxchg( &event->locked, 1, 0 ))
+ while (InterlockedCompareExchange( &event->locked, 1, 0 ))
+ small_pause();
+ }
- /* Only bother signaling the fd if we weren't already signaled. */
- if ((current = interlocked_xchg( &event->signaled, 0 )))
- if ((current = InterlockedExchange( &event->signaled, 0 )))
+ /* For manual-reset events, as long as we're in a lock, we can take the
+ * optimization of only calling read() if the event was already signaled.
+ *
+ * For auto-reset events, we have no guarantee that the previous "signaled"
+ * state is actually correct. We need to leave both states unsignaled after
+ * leaving this function, so we always have to read(). */
+ if ((current = interlocked_xchg( &event->signaled, 0 )) || obj->type == ESYNC_AUTO_EVENT)
+ if ((current = InterlockedExchange( &event->signaled, 0 )) || obj->type == ESYNC_AUTO_EVENT)
{
- /* we don't care about the return value */
- read( obj->fd, &value, sizeof(value) );
@ -146,16 +146,16 @@ index 4521993d4..84d0951cb 100644
fprintf( stderr, "esync_set_event() fd=%d\n", esync->fd );
- /* Acquire the spinlock. */
- while (interlocked_cmpxchg( &event->locked, 1, 0 ))
- while (InterlockedCompareExchange( &event->locked, 1, 0 ))
- small_pause();
+ if (esync->type == ESYNC_MANUAL_EVENT)
+ {
+ /* Acquire the spinlock. */
+ while (interlocked_cmpxchg( &event->locked, 1, 0 ))
+ while (InterlockedCompareExchange( &event->locked, 1, 0 ))
+ small_pause();
+ }
if (!interlocked_xchg( &event->signaled, 1 ))
if (!InterlockedExchange( &event->signaled, 1 ))
{
@@ -406,8 +409,11 @@ void esync_set_event( struct esync *esync )
perror( "esync: write" );
@ -176,17 +176,17 @@ index 4521993d4..84d0951cb 100644
fprintf( stderr, "esync_reset_event() fd=%d\n", esync->fd );
- /* Acquire the spinlock. */
- while (interlocked_cmpxchg( &event->locked, 1, 0 ))
- while (InterlockedCompareExchange( &event->locked, 1, 0 ))
- small_pause();
+ if (esync->type == ESYNC_MANUAL_EVENT)
+ {
+ /* Acquire the spinlock. */
+ while (interlocked_cmpxchg( &event->locked, 1, 0 ))
+ while (InterlockedCompareExchange( &event->locked, 1, 0 ))
+ small_pause();
+ }
/* Only bother signaling the fd if we weren't already signaled. */
if (interlocked_xchg( &event->signaled, 0 ))
if (InterlockedExchange( &event->signaled, 0 ))
@@ -432,8 +441,11 @@ void esync_reset_event( struct esync *esync )
read( esync->fd, &value, sizeof(value) );
}

View File

@ -1,7 +1,7 @@
From 31994d20fb36774cb6cc0652bdd432e524ce4837 Mon Sep 17 00:00:00 2001
From b03e8c0e0097e3dfd2c30f1f53f13abaa731b858 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 3 Mar 2015 03:39:12 +0100
Subject: ntdll: Reuse old async fileio structures if possible.
Subject: [PATCH] ntdll: Reuse old async fileio structures if possible.
This should speed up apps which heavily rely on async io stuff. Some
tests (using the kernel and ntdll wine tests) show that it is very
@ -11,10 +11,10 @@ often possible to reuse old fileio structures.
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 264ad65fe0..011e47a1ca 100644
index 45660b47ec2e..083a413aac5f 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -352,6 +352,7 @@ struct async_fileio
@@ -387,6 +387,7 @@ struct async_fileio
{
async_callback_t *callback; /* must be the first field */
struct async_fileio *next;
@ -22,12 +22,12 @@ index 264ad65fe0..011e47a1ca 100644
HANDLE handle;
};
@@ -396,18 +397,29 @@ static struct async_fileio *alloc_fileio( DWORD size, async_callback_t callback,
@@ -430,18 +431,29 @@ static struct async_fileio *alloc_fileio( DWORD size, async_callback_t callback,
{
/* first free remaining previous fileinfos */
- struct async_fileio *io = interlocked_xchg_ptr( (void **)&fileio_freelist, NULL );
+ struct async_fileio *old_io = interlocked_xchg_ptr( (void **)&fileio_freelist, NULL );
- struct async_fileio *io = InterlockedExchangePointer( (void **)&fileio_freelist, NULL );
+ struct async_fileio *old_io = InterlockedExchangePointer( (void **)&fileio_freelist, NULL );
+ struct async_fileio *io = NULL;
- while (io)
@ -59,5 +59,5 @@ index 264ad65fe0..011e47a1ca 100644
}
return io;
--
2.11.0
2.26.2

View File

@ -1,90 +0,0 @@
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.
---
dlls/ntdll/critsection.c | 10 ----------
dlls/ntdll/threadpool.c | 10 ----------
include/wine/port.h | 14 +++++++++++++-
3 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/dlls/ntdll/critsection.c b/dlls/ntdll/critsection.c
index 1892d3abcb7..95acc321240 100644
--- a/dlls/ntdll/critsection.c
+++ b/dlls/ntdll/critsection.c
@@ -40,16 +40,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
WINE_DECLARE_DEBUG_CHANNEL(relay);
-static inline LONG interlocked_inc( PLONG dest )
-{
- return interlocked_xchg_add( dest, 1 ) + 1;
-}
-
-static inline LONG interlocked_dec( PLONG dest )
-{
- return interlocked_xchg_add( dest, -1 ) - 1;
-}
-
static inline void small_pause(void)
{
#ifdef __i386__
diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c
index 215a5e9c53a..6ee739b9c02 100644
--- a/dlls/ntdll/threadpool.c
+++ b/dlls/ntdll/threadpool.c
@@ -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;
-static inline LONG interlocked_inc( PLONG dest )
-{
- return interlocked_xchg_add( dest, 1 ) + 1;
-}
-
-static inline LONG interlocked_dec( PLONG dest )
-{
- return interlocked_xchg_add( dest, -1 ) - 1;
-}
-
static BOOL array_reserve(void **elements, unsigned int *capacity, unsigned int count, unsigned int size)
{
unsigned int new_capacity, max_capacity;
diff --git a/include/wine/port.h b/include/wine/port.h
index 8514a4a43bf..60c95af6cb5 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -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
+static inline int interlocked_inc( int *dest )
+{
+ return interlocked_xchg_add( dest, 1 ) + 1;
+}
+
+static inline int interlocked_dec( int *dest )
+{
+ return interlocked_xchg_add( dest, -1 ) - 1;
+}
+
#else /* NO_LIBWINE_PORT */
#define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable
@@ -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)
+#define interlocked_dec __WINE_NOT_PORTABLE(interlocked_dec)
+#define interlocked_inc __WINE_NOT_PORTABLE(interlocked_inc)
#define interlocked_xchg __WINE_NOT_PORTABLE(interlocked_xchg)
-#define interlocked_xchg_ptr __WINE_NOT_PORTABLE(interlocked_xchg_ptr)
#define interlocked_xchg_add __WINE_NOT_PORTABLE(interlocked_xchg_add)
+#define interlocked_xchg_ptr __WINE_NOT_PORTABLE(interlocked_xchg_ptr)
#define lstat __WINE_NOT_PORTABLE(lstat)
#define pread __WINE_NOT_PORTABLE(pread)
#define pwrite __WINE_NOT_PORTABLE(pwrite)
--
2.26.0

View File

@ -29,7 +29,7 @@ index 84866721a07..303cad1764a 100644
+/* inline version of RtlEnterCriticalSection */
+static inline void enter_critical_section( RTL_CRITICAL_SECTION *crit )
+{
+ if (interlocked_inc( &crit->LockCount ))
+ if (InterlockedIncrement( &crit->LockCount ))
+ {
+ if (crit->OwningThread == ULongToHandle(GetCurrentThreadId()))
+ {
@ -48,13 +48,13 @@ index 84866721a07..303cad1764a 100644
+ WINE_DECLARE_DEBUG_CHANNEL(ntdll);
+ if (--crit->RecursionCount)
+ {
+ if (crit->RecursionCount > 0) interlocked_dec( &crit->LockCount );
+ if (crit->RecursionCount > 0) InterlockedDecrement( &crit->LockCount );
+ else ERR_(ntdll)( "section %p is not acquired\n", crit );
+ }
+ else
+ {
+ crit->OwningThread = 0;
+ if (interlocked_dec( &crit->LockCount ) >= 0)
+ if (InterlockedDecrement( &crit->LockCount ) >= 0)
+ RtlpUnWaitCriticalSection( crit );
+ }
+}

View File

@ -1,4 +1,4 @@
From 7fb74639d7598c653bbd70fef5c58c9a1c1541d3 Mon Sep 17 00:00:00 2001
From 7dcc94642b6771f949fa2ff747a2f992e862157d 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.
@ -8,7 +8,7 @@ Subject: [PATCH] ntdll: Use fast CS functions for threadpool locking.
1 file changed, 48 insertions(+), 48 deletions(-)
diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c
index 6ee739b9c02..94d6efced9e 100644
index 451d441f5725..253a13002950 100644
--- a/dlls/ntdll/threadpool.c
+++ b/dlls/ntdll/threadpool.c
@@ -1279,7 +1279,7 @@ static void CALLBACK timerqueue_thread_proc( void *param )
@ -176,7 +176,7 @@ index 6ee739b9c02..94d6efced9e 100644
@@ -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 );
InterlockedIncrement( &group->refcount );
- RtlEnterCriticalSection( &group->cs );
+ enter_critical_section( &group->cs );
@ -413,5 +413,5 @@ index 6ee739b9c02..94d6efced9e 100644
if (submit_wait)
tp_object_submit( this, FALSE );
--
2.26.0
2.26.2

View File

@ -1,4 +1,4 @@
From 5f8071c1a278c96b1fd0a83b4b9924ed69520e5e Mon Sep 17 00:00:00 2001
From 74693bc85e3dbc1f757cfea348dc385b4badeb89 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Tue, 19 Aug 2014 22:10:49 -0600
Subject: [PATCH] ntdll: Implement retrieving DOS attributes in
@ -14,7 +14,7 @@ Subject: [PATCH] ntdll: Implement retrieving DOS attributes in
create mode 100644 libs/port/xattr.c
diff --git a/configure.ac b/configure.ac
index af9175dfaad..4cbd823f5e0 100644
index 180d958fc4ef..1e3d2e0d4ef0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,6 +89,7 @@ AC_ARG_WITH(usb, AS_HELP_STRING([--without-usb],[do not use the libusb lib
@ -25,7 +25,7 @@ index af9175dfaad..4cbd823f5e0 100644
AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]),
[if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi])
AC_ARG_WITH(xcursor, AS_HELP_STRING([--without-xcursor],[do not use the Xcursor extension]),
@@ -699,6 +700,17 @@ AC_CHECK_HEADERS([libprocstat.h],,,
@@ -709,6 +710,17 @@ AC_CHECK_HEADERS([libprocstat.h],,,
#include <sys/socket.h>
#endif])
@ -44,7 +44,7 @@ index af9175dfaad..4cbd823f5e0 100644
AC_SUBST(DLLFLAGS,"-D_REENTRANT")
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 583da3a236e..f8227f10163 100644
index 9a9acfdb623b..5536e61db2e4 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -126,6 +126,22 @@ mode_t FILE_umask = 0;
@ -71,7 +71,7 @@ index 583da3a236e..f8227f10163 100644
static inline ULONG get_file_attributes( const struct stat *st )
{
diff --git a/include/wine/port.h b/include/wine/port.h
index 5a805c11993..c0efa12fbde 100644
index e8434c73cca2..f0507efcc7e7 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -361,6 +361,14 @@ int usleep (unsigned int useconds);
@ -86,14 +86,14 @@ index 5a805c11993..c0efa12fbde 100644
+
+extern int xattr_fget( int filedes, const char *name, void *value, size_t size );
+
/* Interlocked functions */
#else /* NO_LIBWINE_PORT */
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable
diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in
index 695938ae434..9796bc40537 100644
index 1963afe24232..4b1ecab7516b 100644
--- a/libs/port/Makefile.in
+++ b/libs/port/Makefile.in
@@ -23,4 +23,5 @@ C_SRCS = \
@@ -22,4 +22,5 @@ C_SRCS = \
strnlen.c \
symlink.c \
usleep.c \
@ -102,7 +102,7 @@ index 695938ae434..9796bc40537 100644
+ xattr.c
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
new file mode 100644
index 00000000000..94b77132bbf
index 000000000000..94b77132bbf2
--- /dev/null
+++ b/libs/port/xattr.c
@@ -0,0 +1,39 @@
@ -146,5 +146,5 @@ index 00000000000..94b77132bbf
+#endif
+}
--
2.25.1
2.26.2

View File

@ -1,4 +1,4 @@
From 4f3272686f4ae084510f96baa5ad52bbf74d3d8d Mon Sep 17 00:00:00 2001
From 34ed49d7dbff7c5f0da8553330c3378b574429fc Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 20 Aug 2014 16:04:34 -0600
Subject: [PATCH] ntdll: Implement retrieving DOS attributes in
@ -11,10 +11,10 @@ Subject: [PATCH] ntdll: Implement retrieving DOS attributes in
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 43a13cd8fdf..74b346b51e8 100644
index 5536e61db2e4..2fd62ebfb802 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -183,7 +183,8 @@ int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULONG *attr
@@ -182,7 +182,8 @@ int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULONG *attr
int get_file_info( const char *path, struct stat *st, ULONG *attr )
{
char *parent_path;
@ -24,7 +24,7 @@ index 43a13cd8fdf..74b346b51e8 100644
*attr = 0;
ret = lstat( path, st );
@@ -216,6 +217,9 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr )
@@ -215,6 +216,9 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr )
RtlFreeHeap( GetProcessHeap(), 0, parent_path );
}
*attr |= get_file_attributes( st );
@ -35,19 +35,19 @@ index 43a13cd8fdf..74b346b51e8 100644
}
diff --git a/include/wine/port.h b/include/wine/port.h
index 8fec3a34591..570988a9422 100644
index f0507efcc7e7..6e81cb71a76d 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -363,6 +363,7 @@ extern int mkstemps(char *template, int suffix_len);
@@ -368,6 +368,7 @@ extern int mkstemps(char *template, int suffix_len);
#endif
extern int xattr_fget( int filedes, const char *name, void *value, size_t size );
+extern int xattr_get( const char *path, const char *name, void *value, size_t size );
/* Interlocked functions */
#else /* NO_LIBWINE_PORT */
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
index 94b77132bbf..88e900dac6d 100644
index 94b77132bbf2..88e900dac6d4 100644
--- a/libs/port/xattr.c
+++ b/libs/port/xattr.c
@@ -37,3 +37,13 @@ int xattr_fget( int filedes, const char *name, void *value, size_t size )
@ -65,5 +65,5 @@ index 94b77132bbf..88e900dac6d 100644
+#endif
+}
--
2.25.1
2.26.2

View File

@ -1,4 +1,4 @@
From b8d44b453c650178926c9d2a4eb44a3f05d34389 Mon Sep 17 00:00:00 2001
From 1a04bc9a0ef3cf03b89d50becee9240f8a195873 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 20 Aug 2014 00:08:52 -0600
Subject: [PATCH] ntdll: Implement storing DOS attributes in
@ -12,10 +12,10 @@ Subject: [PATCH] ntdll: Implement storing DOS attributes in
4 files changed, 60 insertions(+), 24 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 71706c832..674e0abea 100644
index 2fd62ebfb802..c077add9769e 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -169,6 +169,39 @@ int fd_get_file_info( int fd, struct stat *st, ULONG *attr )
@@ -178,6 +178,39 @@ int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULONG *attr
return ret;
}
@ -55,7 +55,7 @@ index 71706c832..674e0abea 100644
/* get the stat info and file attributes for a file (by name) */
int get_file_info( const char *path, struct stat *st, ULONG *attr )
{
@@ -3050,7 +3083,6 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
@@ -3240,7 +3273,6 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
case FileBasicInformation:
if (len >= sizeof(FILE_BASIC_INFORMATION))
{
@ -63,7 +63,7 @@ index 71706c832..674e0abea 100644
const FILE_BASIC_INFORMATION *info = ptr;
LARGE_INTEGER mtime, atime;
@@ -3064,25 +3096,7 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
@@ -3254,25 +3286,7 @@ NTSTATUS WINAPI NtSetInformationFile(HANDLE handle, PIO_STATUS_BLOCK io,
io->u.Status = set_file_times( fd, &mtime, &atime );
if (io->u.Status == STATUS_SUCCESS && info->FileAttributes)
@ -91,10 +91,10 @@ index 71706c832..674e0abea 100644
if (needs_close) close( fd );
}
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index cfc48c4ab..e59cdba5e 100644
index 0b05c39685cd..b49a9a4dbbda 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -1364,7 +1364,7 @@ static void test_file_basic_information(void)
@@ -1365,7 +1365,7 @@ static void test_file_basic_information(void)
memset(&fbi, 0, sizeof(fbi));
res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes\n");
@ -103,7 +103,7 @@ index cfc48c4ab..e59cdba5e 100644
/* Then HIDDEN */
memset(&fbi, 0, sizeof(fbi));
@@ -1377,7 +1377,7 @@ static void test_file_basic_information(void)
@@ -1378,7 +1378,7 @@ static void test_file_basic_information(void)
memset(&fbi, 0, sizeof(fbi));
res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes\n");
@ -112,7 +112,7 @@ index cfc48c4ab..e59cdba5e 100644
/* Check NORMAL last of all (to make sure we can clear attributes) */
memset(&fbi, 0, sizeof(fbi));
@@ -1434,7 +1434,7 @@ static void test_file_all_information(void)
@@ -1435,7 +1435,7 @@ static void test_file_all_information(void)
memset(&fai_buf.fai, 0, sizeof(fai_buf.fai));
res = pNtQueryInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes, res %x\n", res);
@ -121,7 +121,7 @@ index cfc48c4ab..e59cdba5e 100644
/* Then HIDDEN */
memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation));
@@ -1447,7 +1447,7 @@ static void test_file_all_information(void)
@@ -1448,7 +1448,7 @@ static void test_file_all_information(void)
memset(&fai_buf.fai, 0, sizeof(fai_buf.fai));
res = pNtQueryInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes\n");
@ -131,10 +131,10 @@ index cfc48c4ab..e59cdba5e 100644
/* Check NORMAL last of all (to make sure we can clear attributes) */
memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation));
diff --git a/include/wine/port.h b/include/wine/port.h
index d4fc47080..44375d94e 100644
index 6e81cb71a76d..f90396727d6d 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -351,6 +351,8 @@ extern int mkstemps(char *template, int suffix_len);
@@ -368,6 +368,8 @@ extern int mkstemps(char *template, int suffix_len);
#endif
extern int xattr_fget( int filedes, const char *name, void *value, size_t size );
@ -142,9 +142,9 @@ index d4fc47080..44375d94e 100644
+extern int xattr_fset( int filedes, const char *name, void *value, size_t size );
extern int xattr_get( const char *path, const char *name, void *value, size_t size );
/* Interlocked functions */
#else /* NO_LIBWINE_PORT */
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
index 88e900dac..6918c9956 100644
index 88e900dac6d4..6918c9956cc6 100644
--- a/libs/port/xattr.c
+++ b/libs/port/xattr.c
@@ -38,6 +38,26 @@ int xattr_fget( int filedes, const char *name, void *value, size_t size )
@ -175,5 +175,5 @@ index 88e900dac..6918c9956 100644
{
#if defined(HAVE_ATTR_XATTR_H)
--
2.22.0
2.26.2

View File

@ -1,20 +1,20 @@
From e8aeb367e785ab32686c94c11b18ddcee9911206 Mon Sep 17 00:00:00 2001
From 8fde8af21e169d9a48bab50bac4d6e24238141b6 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 20 Aug 2014 15:28:00 -0600
Subject: [PATCH] ntdll: Implement storing DOS attributes in NtCreateFile.
---
dlls/ntdll/file.c | 76 ++++++++++++++++++++++++++++----------------
dlls/ntdll/tests/directory.c | 24 +++++++-------
include/wine/port.h | 2 ++
libs/port/xattr.c | 20 ++++++++++++
dlls/ntdll/file.c | 76 +++++++++++++++++++++++-------------
dlls/ntdll/tests/directory.c | 24 ++++++------
include/wine/port.h | 2 +
libs/port/xattr.c | 20 ++++++++++
4 files changed, 82 insertions(+), 40 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index 38c555e..3a96d3b 100644
index c077add9769e..a596afed72e7 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -224,6 +224,21 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr )
@@ -255,6 +255,21 @@ int get_file_info( const char *path, struct stat *st, ULONG *attr )
return ret;
}
@ -36,7 +36,7 @@ index 38c555e..3a96d3b 100644
/**************************************************************************
* FILE_CreateFile (internal)
* Open a file.
@@ -235,6 +250,10 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT
@@ -266,6 +281,10 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT
ULONG attributes, ULONG sharing, ULONG disposition,
ULONG options, PVOID ea_buffer, ULONG ea_length )
{
@ -47,7 +47,7 @@ index 38c555e..3a96d3b 100644
ANSI_STRING unix_name;
BOOL created = FALSE;
@@ -278,37 +297,34 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT
@@ -309,37 +328,34 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT
io->u.Status = STATUS_SUCCESS;
}
@ -109,7 +109,7 @@ index 38c555e..3a96d3b 100644
if (io->u.Status == STATUS_SUCCESS)
{
@@ -330,6 +346,11 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT
@@ -361,6 +377,11 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT
io->Information = FILE_OVERWRITTEN;
break;
}
@ -121,7 +121,7 @@ index 38c555e..3a96d3b 100644
}
else if (io->u.Status == STATUS_TOO_MANY_OPENED_FILES)
{
@@ -337,6 +358,7 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT
@@ -368,6 +389,7 @@ static NTSTATUS FILE_CreateFile( PHANDLE handle, ACCESS_MASK access, POBJECT_ATT
if (!once++) ERR_(winediag)( "Too many open files, ulimit -n probably needs to be increased\n" );
}
@ -130,7 +130,7 @@ index 38c555e..3a96d3b 100644
}
diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c
index 2c6170b..0eed603 100644
index 4618f4eaff2b..44933c2153df 100644
--- a/dlls/ntdll/tests/directory.c
+++ b/dlls/ntdll/tests/directory.c
@@ -55,7 +55,6 @@ static NTSTATUS (WINAPI *pRtlWow64EnableFsRedirectionEx)( ULONG disable, ULONG *
@ -179,20 +179,20 @@ index 2c6170b..0eed603 100644
}
testfiles[i].nfound++;
diff --git a/include/wine/port.h b/include/wine/port.h
index e30a744..741cf27 100644
index f90396727d6d..7d2c73887073 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -401,6 +401,8 @@ extern int xattr_fget( int filedes, const char *name, void *value, size_t size )
@@ -371,6 +371,8 @@ extern int xattr_fget( int filedes, const char *name, void *value, size_t size )
extern int xattr_fremove( int filedes, const char *name );
extern int xattr_fset( int filedes, const char *name, void *value, size_t size );
extern int xattr_get( const char *path, const char *name, void *value, size_t size );
+extern int xattr_remove( const char *path, const char *name );
+extern int xattr_set( const char *path, const char *name, void *value, size_t size );
/* Interlocked functions */
#else /* NO_LIBWINE_PORT */
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
index 6918c99..683e7a6 100644
index 6918c9956cc6..683e7a615e2b 100644
--- a/libs/port/xattr.c
+++ b/libs/port/xattr.c
@@ -67,3 +67,23 @@ int xattr_get( const char *path, const char *name, void *value, size_t size )
@ -220,5 +220,5 @@ index 6918c99..683e7a6 100644
+#endif
+}
--
1.9.1
2.26.2

View File

@ -1,4 +1,4 @@
From 55a04c83c276864d4f442c3e9c33b36b4e9bdfb6 Mon Sep 17 00:00:00 2001
From 6c463b0bd58fb0830271582e5dd916f936084daf Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 30 May 2015 02:23:15 +0200
Subject: [PATCH] ntdll: Add support for hiding wine version information from
@ -10,10 +10,10 @@ Subject: [PATCH] ntdll: Add support for hiding wine version information from
2 files changed, 104 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 6ba7b15c09e..b90e1516614 100644
index 926098ebf50a..4cf7fed9e1b2 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -70,6 +70,7 @@ const WCHAR system_dir[] = {'C',':','\\','w','i','n','d','o','w','s','\\',
@@ -78,6 +78,7 @@ const WCHAR system_dir[] = {'C',':','\\','w','i','n','d','o','w','s','\\',
const WCHAR syswow64_dir[] = {'C',':','\\','w','i','n','d','o','w','s','\\',
's','y','s','w','o','w','6','4','\\',0};
@ -21,7 +21,7 @@ index 6ba7b15c09e..b90e1516614 100644
/* system search path */
static const WCHAR system_path[] =
{'C',':','\\','w','i','n','d','o','w','s','\\','s','y','s','t','e','m','3','2',';',
@@ -78,6 +79,9 @@ static const WCHAR system_path[] =
@@ -86,6 +87,9 @@ static const WCHAR system_path[] =
static const WCHAR dotW[] = {'.',0};
@ -31,7 +31,7 @@ index 6ba7b15c09e..b90e1516614 100644
static BOOL imports_fixup_done = FALSE; /* set once the imports have been fixed up, before attaching them */
static BOOL process_detaching = FALSE; /* set on process detach to avoid deadlocks with thread detach */
static int free_lib_count; /* recursion depth of LdrUnloadDll calls */
@@ -94,6 +98,8 @@ struct dll_dir_entry
@@ -102,6 +106,8 @@ struct dll_dir_entry
static struct list dll_dir_list = LIST_INIT( dll_dir_list ); /* extra dirs from LdrAddDllDirectory */
@ -40,7 +40,7 @@ index 6ba7b15c09e..b90e1516614 100644
struct ldr_notification
{
struct list entry;
@@ -1710,6 +1716,96 @@ NTSTATUS WINAPI LdrUnlockLoaderLock( ULONG flags, ULONG_PTR magic )
@@ -1872,6 +1878,96 @@ NTSTATUS WINAPI LdrUnlockLoaderLock( ULONG flags, ULONG_PTR magic )
}
@ -137,7 +137,7 @@ index 6ba7b15c09e..b90e1516614 100644
/******************************************************************
* LdrGetProcedureAddress (NTDLL.@)
*/
@@ -1730,7 +1826,7 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name,
@@ -1892,7 +1988,7 @@ NTSTATUS WINAPI LdrGetProcedureAddress(HMODULE module, const ANSI_STRING *name,
LPCWSTR load_path = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer;
void *proc = name ? find_named_export( module, exports, exp_size, name->Buffer, -1, load_path )
: find_ordinal_export( module, exports, exp_size, ord - exports->Base, load_path );
@ -146,7 +146,7 @@ index 6ba7b15c09e..b90e1516614 100644
{
*address = proc;
ret = STATUS_SUCCESS;
@@ -4349,6 +4445,8 @@ void __wine_process_init(void)
@@ -4739,6 +4835,8 @@ void __wine_process_init(void)
NtTerminateProcess( GetCurrentProcess(), status );
}
@ -156,12 +156,12 @@ index 6ba7b15c09e..b90e1516614 100644
/* elevate process if necessary */
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 84500602bb8..e8559c040a3 100644
index 7d631cb33ddb..8256ec710a00 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -274,6 +274,11 @@ extern SYSTEM_CPU_INFORMATION cpu_info DECLSPEC_HIDDEN;
NTSTATUS WINAPI RtlHashUnicodeString(PCUNICODE_STRING,BOOLEAN,ULONG,ULONG*);
void WINAPI LdrInitializeThunk(CONTEXT*,void**,ULONG_PTR,ULONG_PTR);
@@ -347,6 +347,11 @@ void WINAPI LdrInitializeThunk(CONTEXT*,void**,ULONG_PTR,ULONG_PTR);
#define InterlockedCompareExchange64(dest,xchg,cmp) RtlInterlockedCompareExchange64(dest,xchg,cmp)
#endif
+/* version */
+extern const char * CDECL NTDLL_wine_get_version(void);
@ -172,5 +172,5 @@ index 84500602bb8..e8559c040a3 100644
extern BOOL read_process_time(int unix_pid, int unix_tid, unsigned long clk_tck,
LARGE_INTEGER *kernel, LARGE_INTEGER *user) DECLSPEC_HIDDEN;
--
2.17.1
2.26.2

View File

@ -1,4 +1,4 @@
From 24ba9bf89a735ea3b9d7b775eb271b25d1d43ab3 Mon Sep 17 00:00:00 2001
From 9b9a9666a78c0cf0a8dda6f01103849a9e7422c3 Mon Sep 17 00:00:00 2001
From: Andrew Wesie <awesie@gmail.com>
Date: Fri, 27 Jul 2018 01:22:59 -0500
Subject: [PATCH] ntdll: Refactor RtlCreateUserThread into NtCreateThreadEx.
@ -12,7 +12,7 @@ reported version), and expects it to be called whenever a thread is created.
3 files changed, 187 insertions(+), 36 deletions(-)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 95ef2d5b744..b87e19cbf50 100644
index 82b1d58aff71..af8a14b50a67 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -182,7 +182,7 @@
@ -25,10 +25,10 @@ index 95ef2d5b744..b87e19cbf50 100644
@ stdcall NtCreateTimer(ptr long ptr long)
@ stub NtCreateToken
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 72c1d14a79a..45a943f5d21 100644
index 484e60fc21e9..605221ee144b 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -594,34 +594,18 @@ static void start_thread( struct startup_info *info )
@@ -409,34 +409,18 @@ static void start_thread( struct startup_info *info )
/***********************************************************************
* NtCreateThreadEx (NTDLL.@)
*/
@ -68,7 +68,7 @@ index 72c1d14a79a..45a943f5d21 100644
HANDLE handle = 0, actctx = 0;
TEB *teb = NULL;
DWORD tid = 0;
@@ -632,6 +616,33 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr,
@@ -447,6 +431,33 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr,
struct object_attributes *objattr = NULL;
INITIAL_TEB stack;
@ -102,7 +102,7 @@ index 72c1d14a79a..45a943f5d21 100644
if (process != NtCurrentProcess())
{
apc_call_t call;
@@ -657,12 +668,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr,
@@ -472,12 +483,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr,
return result.create_thread.status;
}
@ -116,7 +116,7 @@ index 72c1d14a79a..45a943f5d21 100644
if (server_pipe( request_pipe ) == -1)
{
@@ -674,7 +680,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr,
@@ -489,7 +495,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr,
SERVER_START_REQ( new_thread )
{
req->process = wine_server_obj_handle( process );
@ -125,7 +125,7 @@ index 72c1d14a79a..45a943f5d21 100644
req->suspend = suspended;
req->request_fd = request_pipe[0];
wine_server_add_data( req, objattr, len );
@@ -736,20 +742,20 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr,
@@ -548,20 +554,20 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr,
thread_data->wait_fd[1] = -1;
thread_data->start_stack = (char *)teb->Tib.StackBase;
@ -138,22 +138,22 @@ index 72c1d14a79a..45a943f5d21 100644
- pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM ); /* force creating a kernel thread */
+ pthread_attr_setguardsize( &pthread_attr, 0 );
+ pthread_attr_setscope( &pthread_attr, PTHREAD_SCOPE_SYSTEM ); /* force creating a kernel thread */
interlocked_xchg_add( &nb_threads, 1 );
InterlockedIncrement( &nb_threads );
- if (pthread_create( &pthread_id, &attr, (void * (*)(void *))start_thread, info ))
+ if (pthread_create( &pthread_id, &pthread_attr, (void * (*)(void *))start_thread, info ))
{
interlocked_xchg_add( &nb_threads, -1 );
InterlockedDecrement( &nb_threads );
- pthread_attr_destroy( &attr );
+ pthread_attr_destroy( &pthread_attr );
status = STATUS_NO_MEMORY;
goto error;
}
- pthread_attr_destroy( &attr );
+ pthread_attr_destroy( &pthread_attr );
+ pthread_attr_destroy( &nb_threads );
pthread_sigmask( SIG_SETMASK, &sigset, NULL );
if (id) id->UniqueThread = ULongToHandle(tid);
@@ -766,6 +772,124 @@ error:
@@ -578,6 +584,124 @@ error:
return status;
}
@ -279,10 +279,10 @@ index 72c1d14a79a..45a943f5d21 100644
/******************************************************************************
* RtlGetNtGlobalFlags (NTDLL.@)
diff --git a/include/winternl.h b/include/winternl.h
index 3ace4fcf25e..b6674d75dd9 100644
index 865e39d16e06..1d2d49414448 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2228,6 +2228,33 @@ typedef struct _NLSTABLEINFO
@@ -2251,6 +2251,33 @@ typedef struct _NLSTABLEINFO
USHORT *LowerCaseTable;
} NLSTABLEINFO, *PNLSTABLEINFO;
@ -317,5 +317,5 @@ index 3ace4fcf25e..b6674d75dd9 100644
* Loader structures
*
--
2.24.0
2.26.2

View File

@ -1,4 +1,4 @@
From f2ecf7649cac98316c6e7345c78c66b7afce4b27 Mon Sep 17 00:00:00 2001
From 944dfc453626ecd2e8856e6122164b96636a9999 Mon Sep 17 00:00:00 2001
From: Alex Henrie <alexhenrie24@gmail.com>
Date: Tue, 7 Apr 2020 21:22:52 -0600
Subject: [PATCH] ntdll: Implement RtlIpv6StringToAddress(Ex)[AW]
@ -6,14 +6,14 @@ Subject: [PATCH] ntdll: Implement RtlIpv6StringToAddress(Ex)[AW]
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
dlls/ntdll/ntdll.spec | 6 +-
dlls/ntdll/rtl.c | 221 +++++++++++++++++++++++++++++++++++++++---
2 files changed, 213 insertions(+), 14 deletions(-)
dlls/ntdll/rtl.c | 222 +++++++++++++++++++++++++++++++++++++++---
2 files changed, 213 insertions(+), 15 deletions(-)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index e61a2578da..b887e82b47 100644
index ffabd55b6dba..a88889f5d4ac 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -781,10 +781,10 @@
@@ -782,10 +782,10 @@
# @ stub RtlIpv6AddressToStringExA
# @ stub RtlIpv6AddressToStringExW
# @ stub RtlIpv6AddressToStringW
@ -28,13 +28,21 @@ index e61a2578da..b887e82b47 100644
@ stdcall RtlIsCriticalSectionLocked(ptr)
@ stdcall RtlIsCriticalSectionLockedByThread(ptr)
diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c
index 64853369a3..a4e220bcf2 100644
index ee33e3d82b16..e3311c06ba69 100644
--- a/dlls/ntdll/rtl.c
+++ b/dlls/ntdll/rtl.c
@@ -97,6 +97,16 @@ static const DWORD CRC_table[256] =
@@ -97,7 +97,6 @@ static const DWORD CRC_table[256] =
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
};
-
#if defined(_WIN64) && !defined(_MSC_VER)
static inline unsigned char _InterlockedCompareExchange128(__int64 *dest, __int64 xchg_high, __int64 xchg_low, __int64 *compare)
{
@@ -116,6 +115,16 @@ static inline unsigned char _InterlockedCompareExchange128(__int64 *dest, __int6
}
#endif
+static const int hex_table[] = {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x00-0x0F */
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x10-0x1F */
@ -48,7 +56,7 @@ index 64853369a3..a4e220bcf2 100644
/*
* resource functions
*/
@@ -885,15 +895,6 @@ void WINAPI RtlCopyLuidAndAttributesArray(
@@ -904,15 +913,6 @@ void WINAPI RtlCopyLuidAndAttributesArray(
static BOOL parse_ipv4_component(const WCHAR **str, BOOL strict, ULONG *value)
{
@ -64,7 +72,7 @@ index 64853369a3..a4e220bcf2 100644
int base = 10, d;
WCHAR c;
ULONG cur_value, prev_value = 0;
@@ -1073,13 +1074,211 @@ NTSTATUS WINAPI RtlIpv4StringToAddressA(const char *str, BOOLEAN strict, const c
@@ -1092,13 +1092,211 @@ NTSTATUS WINAPI RtlIpv4StringToAddressA(const char *str, BOOLEAN strict, const c
return ret;
}
@ -279,5 +287,5 @@ index 64853369a3..a4e220bcf2 100644
/***********************************************************************
--
2.26.0
2.26.2

View File

@ -1,4 +1,4 @@
From 097c8310c57f8f5cbcd83da40436a35703f9c1cf Mon Sep 17 00:00:00 2001
From 50638bb08f56b290bf0763181a25aa1b78c9fa19 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 9 Mar 2017 16:27:23 +0100
Subject: [PATCH] ntdll: Fill process kernel and user time.
@ -10,10 +10,10 @@ Subject: [PATCH] ntdll: Fill process kernel and user time.
3 files changed, 57 insertions(+), 37 deletions(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 9ab9be4d0ce..81ed188c8bb 100644
index 91362a21a767..8198e0298922 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -2645,6 +2645,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
@@ -2742,6 +2742,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
{
SYSTEM_PROCESS_INFORMATION* spi = SystemInformation;
SYSTEM_PROCESS_INFORMATION* last = NULL;
@ -21,7 +21,7 @@ index 9ab9be4d0ce..81ed188c8bb 100644
HANDLE hSnap = 0;
WCHAR procname[1024];
WCHAR* exename;
@@ -2682,7 +2683,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
@@ -2779,7 +2780,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
if (Length >= len + procstructlen)
{
@ -30,7 +30,7 @@ index 9ab9be4d0ce..81ed188c8bb 100644
* vmCounters, ioCounters
*/
@@ -2700,6 +2701,9 @@ NTSTATUS WINAPI NtQuerySystemInformation(
@@ -2797,6 +2798,9 @@ NTSTATUS WINAPI NtQuerySystemInformation(
/* spi->ti will be set later on */
@ -41,12 +41,12 @@ index 9ab9be4d0ce..81ed188c8bb 100644
len += procstructlen;
}
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 20feabf56b8..9a487a0520d 100644
index 514956e2d073..f45b6a08b978 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -270,6 +270,10 @@ extern SYSTEM_CPU_INFORMATION cpu_info DECLSPEC_HIDDEN;
NTSTATUS WINAPI RtlHashUnicodeString(PCUNICODE_STRING,BOOLEAN,ULONG,ULONG*);
void WINAPI LdrInitializeThunk(CONTEXT*,void**,ULONG_PTR,ULONG_PTR);
@@ -302,6 +302,10 @@ void WINAPI LdrInitializeThunk(CONTEXT*,void**,ULONG_PTR,ULONG_PTR);
#define InterlockedCompareExchange64(dest,xchg,cmp) RtlInterlockedCompareExchange64(dest,xchg,cmp)
#endif
+/* process / thread time */
+extern BOOL read_process_time(int unix_pid, int unix_tid, unsigned long clk_tck,
@ -56,10 +56,10 @@ index 20feabf56b8..9a487a0520d 100644
int __cdecl NTDLL_tolower( int c );
int __cdecl _stricmp( LPCSTR str1, LPCSTR str2 );
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 73e530da4f5..711a8bb1898 100644
index aa706beb2127..b79eb9791048 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -153,6 +153,53 @@ static ULONG_PTR get_image_addr(void)
@@ -156,6 +156,53 @@ static ULONG_PTR get_image_addr(void)
#endif
@ -113,7 +113,7 @@ index 73e530da4f5..711a8bb1898 100644
/***********************************************************************
* set_process_name
*
@@ -963,42 +1010,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
@@ -1025,42 +1072,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
#ifdef __linux__
/* only /proc provides exact values for a specific thread */
if (unix_pid != -1 && unix_tid != -1)
@ -158,5 +158,5 @@ index 73e530da4f5..711a8bb1898 100644
/* get values for current process instead */
--
2.25.1
2.26.2

View File

@ -1,4 +1,4 @@
From 67bbbb723dc971116a7b9569081baf2dc387e2ac Mon Sep 17 00:00:00 2001
From 91a597b6a9299483c29c2d79b7471735b3839009 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 25 Feb 2015 22:45:42 +0100
Subject: [PATCH] ntdll: Fix race-condition when threads are killed during
@ -15,14 +15,14 @@ only be executed safely when all other threads have terminated before. Most
likely there are more Wine bugs in this area, but the attached patch should
fix the most critical one (messed up refcounting of threads) for now.
---
dlls/ntdll/thread.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
dlls/ntdll/thread.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index c999d4b..5e02966 100644
index eda5d1cea12b..8a0b612b39a4 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -459,6 +459,7 @@ void exit_thread( int status )
@@ -429,6 +429,7 @@ void exit_thread( int status )
void WINAPI RtlExitUserThread( ULONG status )
{
static void *prev_teb;
@ -30,27 +30,18 @@ index c999d4b..5e02966 100644
TEB *teb;
if (status) /* send the exit code to the server (0 is already the default) */
@@ -472,7 +473,7 @@ void WINAPI RtlExitUserThread( ULONG status )
SERVER_END_REQ;
}
- if (interlocked_xchg_add( &nb_threads, -1 ) <= 1)
+ if (interlocked_xchg_add( &nb_threads, 0 ) <= 1)
{
LdrShutdownProcess();
pthread_sigmask( SIG_BLOCK, &server_block_set, NULL );
@@ -495,6 +496,11 @@ void WINAPI RtlExitUserThread( ULONG status )
@@ -465,6 +466,11 @@ void WINAPI RtlExitUserThread( ULONG status )
}
}
+ sigemptyset( &sigset );
+ sigaddset( &sigset, SIGQUIT );
+ pthread_sigmask( SIG_BLOCK, &sigset, NULL );
+ if (interlocked_xchg_add( &nb_threads, -1 ) <= 1) _exit( status );
+ if (InterlockedDecrement( &nb_threads ) <= 1) _exit( status );
+
signal_exit_thread( status );
}
--
2.7.4
2.26.2

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "0c27d244f76ad90301c5db09d738b3a0389bcdac"
echo "4e2ad334b5881af7661be4d6df3c51aae92ca4a2"
}
# Show version information
@ -4428,15 +4428,13 @@ fi
# Patchset ntdll-CriticalSection
# |
# | Modified files:
# | * dlls/ntdll/critsection.c, dlls/ntdll/heap.c, dlls/ntdll/ntdll_misc.h, dlls/ntdll/threadpool.c, include/wine/port.h
# | * dlls/ntdll/heap.c, dlls/ntdll/ntdll_misc.h, dlls/ntdll/threadpool.c
# |
if test "$enable_ntdll_CriticalSection" -eq 1; then
patch_apply ntdll-CriticalSection/0001-include-Move-interlocked_inc-dec-to-port.h.patch
patch_apply ntdll-CriticalSection/0002-ntdll-Add-inline-versions-of-RtlEnterCriticalSection.patch
patch_apply ntdll-CriticalSection/0003-ntdll-Use-fast-CS-functions-for-heap-locking.patch
patch_apply ntdll-CriticalSection/0004-ntdll-Use-fast-CS-functions-for-threadpool-locking.patch
(
printf '%s\n' '+ { "Sebastian Lackner", "include: Move interlocked_inc/dec to port.h.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Add inline versions of RtlEnterCriticalSection / RtlLeaveCriticalSections.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Use fast CS functions for heap locking.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Use fast CS functions for threadpool locking.", 1 },';

View File

@ -1,4 +1,4 @@
From 86bfe6daff2fffab7c987b5c1becf154d660ad5f Mon Sep 17 00:00:00 2001
From 0329ba2101bf6667bdfaa66bd70253b57ca4fdd1 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,10 +20,10 @@ 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 d63aaae824f..1dfc421cbf7 100644
index d83166a0ffc9..f57189112a0c 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -131,6 +131,7 @@ extern int server_pipe( int fd[2] ) DECLSPEC_HIDDEN;
@@ -140,6 +140,7 @@ extern int server_pipe( int fd[2] ) DECLSPEC_HIDDEN;
extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_attributes **ret,
data_size_t *ret_len ) DECLSPEC_HIDDEN;
extern NTSTATUS validate_open_object_attributes( const OBJECT_ATTRIBUTES *attr ) DECLSPEC_HIDDEN;
@ -32,10 +32,10 @@ index d63aaae824f..1dfc421cbf7 100644
/* module handling */
extern LIST_ENTRY tls_links DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index c0dd0f35fc3..19b88a32a5d 100644
index 2ebc39e03e25..f004ed07d27e 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -1061,6 +1061,66 @@ done:
@@ -1149,6 +1149,66 @@ done:
}
@ -102,7 +102,7 @@ index c0dd0f35fc3..19b88a32a5d 100644
/***********************************************************************
* wine_server_fd_to_handle (NTDLL.@)
*
@@ -1601,6 +1661,10 @@ size_t server_init_thread( void *entry_point, BOOL *suspend )
@@ -2011,6 +2071,10 @@ size_t server_init_thread( void *entry_point, BOOL *suspend )
}
SERVER_END_REQ;
@ -114,10 +114,10 @@ index c0dd0f35fc3..19b88a32a5d 100644
ntdll_get_thread_data()->wow64_redir = is_wow64;
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 9c7b326bc09..c3959ae3166 100644
index 8a0b612b39a4..464e01b1e305 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -533,6 +533,7 @@ void exit_thread( int status )
@@ -429,6 +429,7 @@ void exit_thread( int status )
void WINAPI RtlExitUserThread( ULONG status )
{
static void *prev_teb;
@ -125,18 +125,18 @@ index 9c7b326bc09..c3959ae3166 100644
sigset_t sigset;
TEB *teb;
@@ -557,6 +558,9 @@ void WINAPI RtlExitUserThread( ULONG status )
@@ -453,6 +454,9 @@ void WINAPI RtlExitUserThread( ULONG status )
LdrShutdownThread();
RtlFreeThreadActivationContextStack();
+ shmlocal = interlocked_xchg_ptr( &NtCurrentTeb()->Reserved5[2], NULL );
+ shmlocal = InterlockedExchangePointer( &NtCurrentTeb()->Reserved5[2], NULL );
+ if (shmlocal) NtUnmapViewOfSection( NtCurrentProcess(), shmlocal );
+
pthread_sigmask( SIG_BLOCK, &server_block_set, NULL );
if ((teb = interlocked_xchg_ptr( &prev_teb, NtCurrentTeb() )))
if ((teb = InterlockedExchangePointer( &prev_teb, NtCurrentTeb() )))
diff --git a/include/wine/server.h b/include/wine/server.h
index ac5dcc6f8bc..5a845f424c2 100644
index ac5dcc6f8bcd..5a845f424c28 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 ac5dcc6f8bc..5a845f424c2 100644
/* macros for server requests */
diff --git a/include/winternl.h b/include/winternl.h
index a6e5be3a261..68343276e6b 100644
index 1d2d49414448..39c269d29163 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -403,7 +403,7 @@ typedef struct _TEB
@ -171,7 +171,7 @@ index a6e5be3a261..68343276e6b 100644
#ifdef _WIN64
PVOID DeallocationBStore; /* /1788 */
diff --git a/server/fd.c b/server/fd.c
index 405240e14d8..cc8df828a65 100644
index 405240e14d84..cc8df828a653 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -2704,6 +2704,33 @@ DECL_HANDLER(write)
@ -209,10 +209,10 @@ index 405240e14d8..cc8df828a65 100644
DECL_HANDLER(ioctl)
{
diff --git a/server/file.h b/server/file.h
index 7395814dadd..1ea6e8e8e8d 100644
index d577aaed3cfa..399f512cf49e 100644
--- a/server/file.h
+++ b/server/file.h
@@ -180,6 +180,14 @@ extern struct object *create_mailslot_device( struct object *root, const struct
@@ -182,6 +182,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,7 +228,7 @@ index 7395814dadd..1ea6e8e8e8d 100644
extern void do_change_notify( int unix_fd );
diff --git a/server/main.c b/server/main.c
index 2b5065e1852..483a0c85580 100644
index 2b5065e18526..483a0c855808 100644
--- a/server/main.c
+++ b/server/main.c
@@ -146,6 +146,7 @@ int main( int argc, char *argv[] )
@ -240,7 +240,7 @@ index 2b5065e1852..483a0c85580 100644
return 0;
}
diff --git a/server/mapping.c b/server/mapping.c
index 6990a1913d7..3d794bfaaf9 100644
index d73d8de9c283..6c79f7d18a6f 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -29,8 +29,32 @@
@ -276,7 +276,7 @@ index 6990a1913d7..3d794bfaaf9 100644
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
@@ -190,6 +214,10 @@ static const struct fd_ops mapping_fd_ops =
@@ -191,6 +215,10 @@ static const struct fd_ops mapping_fd_ops =
static size_t page_mask;
@ -287,7 +287,7 @@ index 6990a1913d7..3d794bfaaf9 100644
#define ROUND_SIZE(size) (((size) + page_mask) & ~page_mask)
@@ -261,6 +289,52 @@ static int check_current_dir_for_exec(void)
@@ -262,6 +290,52 @@ static int check_current_dir_for_exec(void)
return (ret != MAP_FAILED);
}
@ -341,7 +341,7 @@ index 6990a1913d7..3d794bfaaf9 100644
static int create_temp_file( file_pos_t size )
{
diff --git a/server/protocol.def b/server/protocol.def
index 1ea80c8ba99..c2d671d4b15 100644
index 197a48592e0a..99651c9ed534 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -69,6 +69,15 @@ struct request_max_size
@ -360,7 +360,7 @@ index 1ea80c8ba99..c2d671d4b15 100644
/* debug event data */
typedef union
@@ -1334,6 +1343,12 @@ enum server_fd_type
@@ -1335,6 +1344,12 @@ enum server_fd_type
@END
@ -374,10 +374,10 @@ index 1ea80c8ba99..c2d671d4b15 100644
@REQ(flush)
async_data_t async; /* async I/O parameters */
diff --git a/server/thread.c b/server/thread.c
index 6be0495a556..5b176f1b67d 100644
index 987da2f7c4ff..233320c78ad5 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -203,6 +203,8 @@ static inline void init_thread_structure( struct thread *thread )
@@ -239,6 +239,8 @@ static inline void init_thread_structure( struct thread *thread )
thread->desc = NULL;
thread->desc_len = 0;
thread->exit_poll = NULL;
@ -386,7 +386,7 @@ index 6be0495a556..5b176f1b67d 100644
thread->creation_time = current_time;
thread->exit_time = 0;
@@ -338,7 +340,10 @@ static void cleanup_thread( struct thread *thread )
@@ -409,7 +411,10 @@ static void cleanup_thread( struct thread *thread )
thread->inflight[i].client = thread->inflight[i].server = -1;
}
}
@ -397,7 +397,7 @@ index 6be0495a556..5b176f1b67d 100644
thread->req_data = NULL;
thread->reply_data = NULL;
thread->request_fd = NULL;
@@ -348,6 +353,8 @@ static void cleanup_thread( struct thread *thread )
@@ -418,6 +423,8 @@ static void cleanup_thread( struct thread *thread )
thread->desktop = 0;
thread->desc = NULL;
thread->desc_len = 0;
@ -407,7 +407,7 @@ index 6be0495a556..5b176f1b67d 100644
/* destroy a thread when its refcount is 0 */
diff --git a/server/thread.h b/server/thread.h
index 7b4d4cb72ba..8029d65df44 100644
index 912df68eaf63..00f6f7c64a93 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -91,6 +91,8 @@ struct thread
@ -420,5 +420,5 @@ index 7b4d4cb72ba..8029d65df44 100644
struct thread_snapshot
--
2.26.1
2.26.2

View File

@ -45,9 +45,9 @@ index 356d631..381d5aa 100644
+ if (!fd_cache[entry]) continue;
+ for (idx = 0; idx < FD_CACHE_BLOCK_SIZE; idx++)
+ {
+ cache.data = interlocked_cmpxchg64( &fd_cache[entry][idx].data, 0, 0 );
+ cache.data = InterlockedCompareExchange64( &fd_cache[entry][idx].data, 0, 0 );
+ if (cache.s.type != type || cache.s.fd == 0) continue;
+ if (interlocked_cmpxchg64( &fd_cache[entry][idx].data, 0, cache.data ) != cache.data) continue;
+ if (InterlockedCompareExchange64( &fd_cache[entry][idx].data, 0, cache.data ) != cache.data) continue;
+ close( cache.s.fd - 1 );
+ }
+ }