"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "dlls/ntdll/unix/server.c" between
wine-5.12.tar.xz and wine-5.13.tar.xz

About: Wine is an Open Source implementation of the MS Windows API on top of X, OpenGL, and Unix. Think of Wine as a compatibility layer for running Windows programs. Development release.

server.c  (wine-5.12.tar.xz):server.c  (wine-5.13.tar.xz)
skipping to change at line 526 skipping to change at line 526
case APC_UNMAP_VIEW: case APC_UNMAP_VIEW:
result->type = call->type; result->type = call->type;
addr = wine_server_get_ptr( call->unmap_view.addr ); addr = wine_server_get_ptr( call->unmap_view.addr );
if ((ULONG_PTR)addr == call->unmap_view.addr) if ((ULONG_PTR)addr == call->unmap_view.addr)
result->unmap_view.status = NtUnmapViewOfSection( NtCurrentProcess() , addr ); result->unmap_view.status = NtUnmapViewOfSection( NtCurrentProcess() , addr );
else else
result->unmap_view.status = STATUS_INVALID_PARAMETER; result->unmap_view.status = STATUS_INVALID_PARAMETER;
break; break;
case APC_CREATE_THREAD: case APC_CREATE_THREAD:
{ {
PS_ATTRIBUTE_LIST attr = { sizeof(attr) }; ULONG_PTR buffer[offsetof( PS_ATTRIBUTE_LIST, Attributes[2] ) / sizeof(U
LONG_PTR)];
PS_ATTRIBUTE_LIST *attr = (PS_ATTRIBUTE_LIST *)buffer;
CLIENT_ID id; CLIENT_ID id;
HANDLE handle; HANDLE handle;
TEB *teb;
SIZE_T reserve = call->create_thread.reserve; SIZE_T reserve = call->create_thread.reserve;
SIZE_T commit = call->create_thread.commit; SIZE_T commit = call->create_thread.commit;
void *func = wine_server_get_ptr( call->create_thread.func ); void *func = wine_server_get_ptr( call->create_thread.func );
void *arg = wine_server_get_ptr( call->create_thread.arg ); void *arg = wine_server_get_ptr( call->create_thread.arg );
result->type = call->type; result->type = call->type;
if (reserve == call->create_thread.reserve && commit == call->create_thr ead.commit && if (reserve == call->create_thread.reserve && commit == call->create_thr ead.commit &&
(ULONG_PTR)func == call->create_thread.func && (ULONG_PTR)arg == cal l->create_thread.arg) (ULONG_PTR)func == call->create_thread.func && (ULONG_PTR)arg == cal l->create_thread.arg)
{ {
attr.Attributes[0].Attribute = PS_ATTRIBUTE_CLIENT_ID; attr->TotalLength = sizeof(buffer);
attr.Attributes[0].Size = sizeof(id); attr->Attributes[0].Attribute = PS_ATTRIBUTE_CLIENT_ID;
attr.Attributes[0].ValuePtr = &id; attr->Attributes[0].Size = sizeof(id);
attr->Attributes[0].ValuePtr = &id;
attr->Attributes[0].ReturnLength = NULL;
attr->Attributes[1].Attribute = PS_ATTRIBUTE_TEB_ADDRESS;
attr->Attributes[1].Size = sizeof(teb);
attr->Attributes[1].ValuePtr = &teb;
attr->Attributes[1].ReturnLength = NULL;
result->create_thread.status = NtCreateThreadEx( &handle, THREAD_ALL _ACCESS, NULL, result->create_thread.status = NtCreateThreadEx( &handle, THREAD_ALL _ACCESS, NULL,
NtCurrentProcess(), func, arg, NtCurrentProcess(), func, arg,
call->create_thread .flags, 0, call->create_thread .flags, 0,
commit, reserve, &a ttr ); commit, reserve, at tr );
result->create_thread.handle = wine_server_obj_handle( handle ); result->create_thread.handle = wine_server_obj_handle( handle );
result->create_thread.pid = HandleToULong(id.UniqueProcess); result->create_thread.pid = HandleToULong(id.UniqueProcess);
result->create_thread.tid = HandleToULong(id.UniqueThread); result->create_thread.tid = HandleToULong(id.UniqueThread);
result->create_thread.teb = wine_server_client_ptr( teb );
} }
else result->create_thread.status = STATUS_INVALID_PARAMETER; else result->create_thread.status = STATUS_INVALID_PARAMETER;
break; break;
} }
case APC_BREAK_PROCESS: case APC_BREAK_PROCESS:
{ {
HANDLE handle; HANDLE handle;
result->type = APC_BREAK_PROCESS; result->type = APC_BREAK_PROCESS;
result->break_process.status = NtCreateThreadEx( &handle, THREAD_ALL_ACC ESS, NULL, result->break_process.status = NtCreateThreadEx( &handle, THREAD_ALL_ACC ESS, NULL,
skipping to change at line 573 skipping to change at line 582
default: default:
server_protocol_error( "get_apc_request: bad type %d\n", call->type ); server_protocol_error( "get_apc_request: bad type %d\n", call->type );
break; break;
} }
} }
/*********************************************************************** /***********************************************************************
* server_select * server_select
*/ */
unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT flags, unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT flags,
timeout_t abs_timeout, CONTEXT *context, RTL_CRITICA L_SECTION *cs, timeout_t abs_timeout, CONTEXT *context, pthread_mut ex_t *mutex,
user_apc_t *user_apc ) user_apc_t *user_apc )
{ {
unsigned int ret; unsigned int ret;
int cookie; int cookie;
obj_handle_t apc_handle = 0; obj_handle_t apc_handle = 0;
context_t server_context; context_t server_context;
BOOL suspend_context = FALSE; BOOL suspend_context = FALSE;
apc_call_t call; apc_call_t call;
apc_result_t result; apc_result_t result;
sigset_t old_set; sigset_t old_set;
skipping to change at line 632 skipping to change at line 641
SERVER_END_REQ; SERVER_END_REQ;
if (ret != STATUS_KERNEL_APC) break; if (ret != STATUS_KERNEL_APC) break;
invoke_system_apc( &call, &result ); invoke_system_apc( &call, &result );
/* don't signal multiple times */ /* don't signal multiple times */
if (size >= sizeof(select_op->signal_and_wait) && select_op->op == S ELECT_SIGNAL_AND_WAIT) if (size >= sizeof(select_op->signal_and_wait) && select_op->op == S ELECT_SIGNAL_AND_WAIT)
size = offsetof( select_op_t, signal_and_wait.signal ); size = offsetof( select_op_t, signal_and_wait.signal );
} }
pthread_sigmask( SIG_SETMASK, &old_set, NULL ); pthread_sigmask( SIG_SETMASK, &old_set, NULL );
if (cs) if (mutex)
{ {
RtlLeaveCriticalSection( cs ); pthread_mutex_unlock( mutex );
cs = NULL; mutex = NULL;
} }
if (ret != STATUS_PENDING) break; if (ret != STATUS_PENDING) break;
ret = wait_select_reply( &cookie ); ret = wait_select_reply( &cookie );
} }
while (ret == STATUS_USER_APC || ret == STATUS_KERNEL_APC); while (ret == STATUS_USER_APC || ret == STATUS_KERNEL_APC);
if (ret == STATUS_USER_APC) *user_apc = call.user; if (ret == STATUS_USER_APC) *user_apc = call.user;
return ret; return ret;
} }
skipping to change at line 879 skipping to change at line 888
static inline unsigned int handle_to_index( HANDLE handle, unsigned int *entry ) static inline unsigned int handle_to_index( HANDLE handle, unsigned int *entry )
{ {
unsigned int idx = (wine_server_obj_handle(handle) >> 2) - 1; unsigned int idx = (wine_server_obj_handle(handle) >> 2) - 1;
*entry = idx / FD_CACHE_BLOCK_SIZE; *entry = idx / FD_CACHE_BLOCK_SIZE;
return idx % FD_CACHE_BLOCK_SIZE; return idx % FD_CACHE_BLOCK_SIZE;
} }
/*********************************************************************** /***********************************************************************
* add_fd_to_cache * add_fd_to_cache
* *
* Caller must hold fd_cache_section. * Caller must hold fd_cache_mutex.
*/ */
static BOOL add_fd_to_cache( HANDLE handle, int fd, enum server_fd_type type, static BOOL add_fd_to_cache( HANDLE handle, int fd, enum server_fd_type type,
unsigned int access, unsigned int options ) unsigned int access, unsigned int options )
{ {
unsigned int entry, idx = handle_to_index( handle, &entry ); unsigned int entry, idx = handle_to_index( handle, &entry );
union fd_cache_entry cache; union fd_cache_entry cache;
if (entry >= FD_CACHE_ENTRIES) if (entry >= FD_CACHE_ENTRIES)
{ {
FIXME( "too many allocated handles, not caching %p\n", handle ); FIXME( "too many allocated handles, not caching %p\n", handle );
skipping to change at line 1425 skipping to change at line 1434
if (server_pid != -1) prctl( 0x59616d61 /* PR_SET_PTRACER */, server_pid ); if (server_pid != -1) prctl( 0x59616d61 /* PR_SET_PTRACER */, server_pid );
#endif #endif
} }
/*********************************************************************** /***********************************************************************
* server_init_process_done * server_init_process_done
*/ */
void CDECL server_init_process_done( void *relay ) void CDECL server_init_process_done( void *relay )
{ {
PEB *peb = NtCurrentTeb()->Peb; PEB *peb = NtCurrentTeb()->Peb;
IMAGE_NT_HEADERS *nt = RtlImageNtHeader( peb->ImageBaseAddress ); IMAGE_NT_HEADERS *nt = get_exe_nt_header();
void *entry = (char *)peb->ImageBaseAddress + nt->OptionalHeader.AddressOfEn tryPoint; void *entry = (char *)peb->ImageBaseAddress + nt->OptionalHeader.AddressOfEn tryPoint;
NTSTATUS status; NTSTATUS status;
int suspend; int suspend;
#ifdef __APPLE__ #ifdef __APPLE__
send_server_task_port(); send_server_task_port();
#endif #endif
/* Install signal handlers; this cannot be done earlier, since we cannot /* Install signal handlers; this cannot be done earlier, since we cannot
* send exceptions to the debugger before the create process event that * send exceptions to the debugger before the create process event that
skipping to change at line 1469 skipping to change at line 1478
* *
* Send an init thread request. * Send an init thread request.
*/ */
size_t server_init_thread( void *entry_point, BOOL *suspend ) size_t server_init_thread( void *entry_point, BOOL *suspend )
{ {
static const char *cpu_names[] = { "x86", "x86_64", "PowerPC", "ARM", "ARM64 " }; static const char *cpu_names[] = { "x86", "x86_64", "PowerPC", "ARM", "ARM64 " };
const char *arch = getenv( "WINEARCH" ); const char *arch = getenv( "WINEARCH" );
int ret; int ret;
int reply_pipe[2]; int reply_pipe[2];
struct sigaction sig_act; struct sigaction sig_act;
stack_t ss;
size_t info_size; size_t info_size;
/* ignore SIGPIPE so that we get an EPIPE error instead */
sig_act.sa_handler = SIG_IGN; sig_act.sa_handler = SIG_IGN;
sig_act.sa_flags = 0; sig_act.sa_flags = 0;
sigemptyset( &sig_act.sa_mask ); sigemptyset( &sig_act.sa_mask );
/* ignore SIGPIPE so that we get an EPIPE error instead */
sigaction( SIGPIPE, &sig_act, NULL ); sigaction( SIGPIPE, &sig_act, NULL );
ss.ss_sp = get_signal_stack();
ss.ss_size = signal_stack_size;
ss.ss_flags = 0;
sigaltstack( &ss, NULL );
/* create the server->client communication pipes */ /* create the server->client communication pipes */
if (server_pipe( reply_pipe ) == -1) server_protocol_perror( "pipe" ); if (server_pipe( reply_pipe ) == -1) server_protocol_perror( "pipe" );
if (server_pipe( ntdll_get_thread_data()->wait_fd ) == -1) server_protocol_p error( "pipe" ); if (server_pipe( ntdll_get_thread_data()->wait_fd ) == -1) server_protocol_p error( "pipe" );
server_send_fd( reply_pipe[1] ); server_send_fd( reply_pipe[1] );
server_send_fd( ntdll_get_thread_data()->wait_fd[1] ); server_send_fd( ntdll_get_thread_data()->wait_fd[1] );
ntdll_get_thread_data()->reply_fd = reply_pipe[0]; ntdll_get_thread_data()->reply_fd = reply_pipe[0];
close( reply_pipe[1] ); close( reply_pipe[1] );
SERVER_START_REQ( init_thread ) SERVER_START_REQ( init_thread )
{ {
 End of changes. 14 change blocks. 
13 lines changed or deleted 28 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)