diff --git a/dlls/ntdll/esync.c b/dlls/ntdll/esync.c index eb4b07edf5a0..04d0cde8b3ef 100644 --- a/dlls/ntdll/esync.c +++ b/dlls/ntdll/esync.c @@ -30,11 +30,9 @@ # include #endif #include +#include #include #include -#ifdef HAVE_SYS_EVENTFD_H -# include -#endif #ifdef HAVE_SYS_MMAN_H # include #endif @@ -51,10 +49,6 @@ #include "ntdll_misc.h" #include "esync.h" -#ifndef EFD_SEMAPHORE -#define EFD_SEMAPHORE 1 -#endif - WINE_DEFAULT_DEBUG_CHANNEL(esync); int do_esync(void) @@ -115,7 +109,7 @@ static int shm_addrs_size; /* length of the allocated shm_addrs array */ static long pagesize; static NTSTATUS create_esync( enum esync_type type, HANDLE *handle, - ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, int initval, int flags ); + ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, int initval ); void esync_init(void) { @@ -127,7 +121,7 @@ void esync_init(void) HANDLE handle; NTSTATUS ret; - ret = create_esync( 0, &handle, 0, NULL, 0, 0 ); + ret = create_esync( 0, &handle, 0, NULL, 0 ); if (ret != STATUS_NOT_IMPLEMENTED) { ERR("Server is running with WINEESYNC but this process is not, please enable WINEESYNC or restart wineserver.\n"); @@ -326,7 +320,7 @@ NTSTATUS esync_close( HANDLE handle ) } static NTSTATUS create_esync( enum esync_type type, HANDLE *handle, - ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, int initval, int flags ) + ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr, int initval ) { NTSTATUS ret; data_size_t len; @@ -345,7 +339,6 @@ static NTSTATUS create_esync( enum esync_type type, HANDLE *handle, { req->access = access; req->initval = initval; - req->flags = flags; req->type = type; wine_server_add_data( req, objattr, len ); ret = wine_server_call( req ); @@ -437,7 +430,7 @@ NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access, * before anyone else can open the object. */ RtlEnterCriticalSection( &shm_init_section ); - ret = create_esync( ESYNC_SEMAPHORE, handle, access, attr, initial, EFD_SEMAPHORE ); + ret = create_esync( ESYNC_SEMAPHORE, handle, access, attr, initial ); if (!ret) { /* Initialize the shared memory portion. @@ -538,7 +531,7 @@ NTSTATUS esync_create_event( HANDLE *handle, ACCESS_MASK access, RtlEnterCriticalSection( &shm_init_section ); - ret = create_esync( type, handle, access, attr, initial, 0 ); + ret = create_esync( type, handle, access, attr, initial ); if (!ret) { @@ -735,7 +728,7 @@ NTSTATUS esync_create_mutex( HANDLE *handle, ACCESS_MASK access, RtlEnterCriticalSection( &shm_init_section ); - ret = create_esync( ESYNC_MUTEX, handle, access, attr, initial ? 0 : 1, 0 ); + ret = create_esync( ESYNC_MUTEX, handle, access, attr, initial ? 0 : 1 ); if (!ret) { /* Initialize the shared memory portion. */ diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 8fdbd3793823..2c21e18b55b8 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -5802,10 +5802,8 @@ struct create_esync_request struct request_header __header; unsigned int access; int initval; - int flags; int type; /* VARARG(objattr,object_attributes); */ - char __pad_28[4]; }; struct create_esync_reply { @@ -6791,6 +6789,6 @@ union generic_reply struct get_esync_apc_fd_reply get_esync_apc_fd_reply; }; -#define SERVER_PROTOCOL_VERSION 606 +#define SERVER_PROTOCOL_VERSION 607 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/esync.c b/server/esync.c index 8b4ce83c0525..d3cdcd54c1be 100644 --- a/server/esync.c +++ b/server/esync.c @@ -178,7 +178,7 @@ static int type_matches( enum esync_type type1, enum esync_type type2 ) } static struct esync *create_esync( struct object *root, const struct unicode_str *name, - unsigned int attr, int initval, int flags, enum esync_type type, + unsigned int attr, int initval, enum esync_type type, const struct security_descriptor *sd ) { #ifdef HAVE_SYS_EVENTFD_H @@ -188,8 +188,13 @@ static struct esync *create_esync( struct object *root, const struct unicode_str { if (get_error() != STATUS_OBJECT_NAME_EXISTS) { + int flags = EFD_CLOEXEC | EFD_NONBLOCK; + + if (type == ESYNC_SEMAPHORE) + flags |= EFD_SEMAPHORE; + /* initialize it if it didn't already exist */ - esync->fd = eventfd( initval, flags | EFD_CLOEXEC | EFD_NONBLOCK ); + esync->fd = eventfd( initval, flags ); if (esync->fd == -1) { perror( "eventfd" ); @@ -407,7 +412,7 @@ DECL_HANDLER(create_esync) if (!objattr) return; - if ((esync = create_esync( root, &name, objattr->attributes, req->initval, req->flags, req->type, sd ))) + if ((esync = create_esync( root, &name, objattr->attributes, req->initval, req->type, sd ))) { if (get_error() == STATUS_OBJECT_NAME_EXISTS) reply->handle = alloc_handle( current->process, esync, req->access, objattr->attributes ); diff --git a/server/protocol.def b/server/protocol.def index 73ec69cbde34..efb4e672718b 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -3961,7 +3961,6 @@ struct handle_info @REQ(create_esync) unsigned int access; /* wanted access rights */ int initval; /* initial value */ - int flags; /* flags (EFD_SEMAPHORE or 0) */ int type; /* type of esync object (see below) */ VARARG(objattr,object_attributes); /* object attributes */ @REPLY diff --git a/server/request.h b/server/request.h index 53c08c3a8cd4..cc8e8ca046e5 100644 --- a/server/request.h +++ b/server/request.h @@ -2455,9 +2455,8 @@ C_ASSERT( FIELD_OFFSET(struct resume_process_request, handle) == 12 ); C_ASSERT( sizeof(struct resume_process_request) == 16 ); C_ASSERT( FIELD_OFFSET(struct create_esync_request, access) == 12 ); C_ASSERT( FIELD_OFFSET(struct create_esync_request, initval) == 16 ); -C_ASSERT( FIELD_OFFSET(struct create_esync_request, flags) == 20 ); -C_ASSERT( FIELD_OFFSET(struct create_esync_request, type) == 24 ); -C_ASSERT( sizeof(struct create_esync_request) == 32 ); +C_ASSERT( FIELD_OFFSET(struct create_esync_request, type) == 20 ); +C_ASSERT( sizeof(struct create_esync_request) == 24 ); C_ASSERT( FIELD_OFFSET(struct create_esync_reply, handle) == 8 ); C_ASSERT( FIELD_OFFSET(struct create_esync_reply, type) == 12 ); C_ASSERT( FIELD_OFFSET(struct create_esync_reply, shm_idx) == 16 ); diff --git a/server/trace.c b/server/trace.c index 3cb00e6854ab..6de71512bdd0 100644 --- a/server/trace.c +++ b/server/trace.c @@ -4612,7 +4612,6 @@ static void dump_create_esync_request( const struct create_esync_request *req ) { fprintf( stderr, " access=%08x", req->access ); fprintf( stderr, ", initval=%d", req->initval ); - fprintf( stderr, ", flags=%d", req->flags ); fprintf( stderr, ", type=%d", req->type ); dump_varargs_object_attributes( ", objattr=", cur_size ); } @@ -5632,6 +5631,7 @@ static const struct { "INVALID_LOCK_SEQUENCE", STATUS_INVALID_LOCK_SEQUENCE }, { "INVALID_OWNER", STATUS_INVALID_OWNER }, { "INVALID_PARAMETER", STATUS_INVALID_PARAMETER }, + { "INVALID_PARAMETER_4", STATUS_INVALID_PARAMETER_4 }, { "INVALID_PIPE_STATE", STATUS_INVALID_PIPE_STATE }, { "INVALID_READ_MODE", STATUS_INVALID_READ_MODE }, { "INVALID_SECURITY_DESCR", STATUS_INVALID_SECURITY_DESCR },