Module: wine Branch: master Commit: 7b96e82fd569bc3b261be147abe49a822f14d4e0 URL: https://source.winehq.org/git/wine.git/?a=commit;h=7b96e82fd569bc3b261be147a...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Sep 2 16:29:35 2020 +0200
ntdll: Make the reserved area functions static.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntdll/unix/loader.c | 59 +++--------------------------------------- dlls/ntdll/unix/unix_private.h | 5 ---- dlls/ntdll/unix/virtual.c | 12 +++++---- 3 files changed, 11 insertions(+), 65 deletions(-)
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 73d4ceee14..dcbe4eff0f 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1406,43 +1406,12 @@ static void start_main_thread(void)
#ifdef __APPLE__ -struct apple_stack_info -{ - void *stack; - size_t desired_size; -}; - static void *apple_wine_thread( void *arg ) { start_main_thread(); return NULL; }
-/*********************************************************************** - * apple_alloc_thread_stack - * - * Callback for mmap_enum_reserved_areas to allocate space for - * the secondary thread's stack. - */ -#ifndef _WIN64 -static int CDECL apple_alloc_thread_stack( void *base, size_t size, void *arg ) -{ - struct apple_stack_info *info = arg; - - /* For mysterious reasons, putting the thread stack at the very top - * of the address space causes subsequent execs to fail, even on the - * child side of a fork. Avoid the top 16MB. */ - char * const limit = (char*)0xff000000; - if ((char *)base >= limit) return 0; - if (size > limit - (char*)base) - size = limit - (char*)base; - if (size < info->desired_size) return 0; - info->stack = wine_anon_mmap( (char *)base + size - info->desired_size, - info->desired_size, PROT_READ|PROT_WRITE, MAP_FIXED ); - return (info->stack != (void *)-1); -} -#endif - /*********************************************************************** * apple_create_wine_thread * @@ -1453,33 +1422,13 @@ static int CDECL apple_alloc_thread_stack( void *base, size_t size, void *arg ) */ static void apple_create_wine_thread( void *arg ) { - int success = 0; pthread_t thread; pthread_attr_t attr;
- if (!pthread_attr_init( &attr )) - { -#ifndef _WIN64 - struct apple_stack_info info; - - /* Try to put the new thread's stack in the reserved area. If this - * fails, just let it go wherever. It'll be a waste of space, but we - * can go on. */ - if (!pthread_attr_getstacksize( &attr, &info.desired_size ) && - mmap_enum_reserved_areas( apple_alloc_thread_stack, &info, 1 )) - { - mmap_remove_reserved_area( info.stack, info.desired_size ); - pthread_attr_setstackaddr( &attr, (char*)info.stack + info.desired_size ); - } -#endif - - if (!pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE ) && - !pthread_create( &thread, &attr, apple_wine_thread, NULL )) - success = 1; - - pthread_attr_destroy( &attr ); - } - if (!success) exit(1); + pthread_attr_init( &attr ); + pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE ); + if (pthread_create( &thread, &attr, apple_wine_thread, NULL )) exit(1); + pthread_attr_destroy( &attr ); }
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 0a21a059b4..f71963f4a9 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -103,11 +103,6 @@ extern LONGLONG CDECL fast_RtlGetSystemTimePrecise(void) DECLSPEC_HIDDEN; extern NTSTATUS CDECL fast_wait_cv( RTL_CONDITION_VARIABLE *variable, const void *value, const LARGE_INTEGER *timeout ) DECLSPEC_HIDDEN;
-void CDECL mmap_add_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN; -void CDECL mmap_remove_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN; -int CDECL mmap_is_in_reserved_area( void *addr, SIZE_T size ) DECLSPEC_HIDDEN; -int CDECL mmap_enum_reserved_areas( int (CDECL *enum_func)(void *base, SIZE_T size, void *arg), void *arg, - int top_down ) DECLSPEC_HIDDEN; extern NTSTATUS CDECL get_initial_environment( WCHAR **wargv[], WCHAR *env, SIZE_T *size ) DECLSPEC_HIDDEN; extern NTSTATUS CDECL get_startup_info( startup_info_t *info, SIZE_T *total_size, SIZE_T *info_size ) DECLSPEC_HIDDEN; extern NTSTATUS CDECL get_dynamic_environment( WCHAR *env, SIZE_T *size ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 58c84caab5..3eba5c0a9d 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -212,6 +212,8 @@ static inline BOOL is_inside_signal_stack( void *ptr ) }
+static void mmap_add_reserved_area( void *addr, SIZE_T size ); + static void reserve_area( void *addr, void *end ) { #ifdef __APPLE__ @@ -351,7 +353,7 @@ static void mmap_init( const struct preload_info *preload_info ) #endif }
-void CDECL mmap_add_reserved_area( void *addr, SIZE_T size ) +static void mmap_add_reserved_area( void *addr, SIZE_T size ) { struct reserved_area *area; struct list *ptr; @@ -400,7 +402,7 @@ void CDECL mmap_add_reserved_area( void *addr, SIZE_T size ) } }
-void CDECL mmap_remove_reserved_area( void *addr, SIZE_T size ) +static void mmap_remove_reserved_area( void *addr, SIZE_T size ) { struct reserved_area *area; struct list *ptr; @@ -460,7 +462,7 @@ void CDECL mmap_remove_reserved_area( void *addr, SIZE_T size ) } }
-int CDECL mmap_is_in_reserved_area( void *addr, SIZE_T size ) +static int mmap_is_in_reserved_area( void *addr, SIZE_T size ) { struct reserved_area *area; struct list *ptr; @@ -477,8 +479,8 @@ int CDECL mmap_is_in_reserved_area( void *addr, SIZE_T size ) return 0; }
-int CDECL mmap_enum_reserved_areas( int (CDECL *enum_func)(void *base, SIZE_T size, void *arg), - void *arg, int top_down ) +static int mmap_enum_reserved_areas( int (CDECL *enum_func)(void *base, SIZE_T size, void *arg), + void *arg, int top_down ) { int ret = 0; struct list *ptr;