Rebase against 7ca1c4900e42d608150822ef87a7ce2847a59b6f.

This commit is contained in:
Zebediah Figura
2019-12-05 22:31:23 -06:00
parent 3a14d63abf
commit cb9aa710d5
4 changed files with 49 additions and 55 deletions

View File

@@ -1,8 +1,8 @@
From 2ca666409e42b5ecf78b32a583d3ba95cbcce356 Mon Sep 17 00:00:00 2001
From 31b8b93cd83da65ee4439f0f06fb673257f1850c Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Sun, 10 Jun 2018 23:12:16 -0500
Subject: [PATCH 41/83] server: Allocate shared memory segments for semaphores
and mutexes.
Subject: [PATCH] server: Allocate shared memory segments for semaphores and
mutexes.
As has been described in the README, these two objects have state that can't
be expressed (or read from) the eventfd descriptor. Namely, for semaphores
@@ -16,17 +16,17 @@ We use the WINEPREFIX dir to discriminate shm sections for simultaneously
running servers; this is based off of code in libwine (specifically
init_server_dir()).
---
server/esync.c | 65 +++++++++++++++++++++++++++++++++++++++++++++
server/esync.c | 64 +++++++++++++++++++++++++++++++++++++++++++++
server/esync.h | 1 +
server/main.c | 4 +++
server/protocol.def | 2 ++
4 files changed, 72 insertions(+)
4 files changed, 71 insertions(+)
diff --git a/server/esync.c b/server/esync.c
index 5dd38c42a..e9a1ec15e 100644
index 5dd38c42a..fb9d02fc7 100644
--- a/server/esync.c
+++ b/server/esync.c
@@ -21,17 +21,26 @@
@@ -21,12 +21,20 @@
#include "config.h"
#include "wine/port.h"
@@ -47,13 +47,7 @@ index 5dd38c42a..e9a1ec15e 100644
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winternl.h"
+#include "wine/library.h"
#include "handle.h"
#include "request.h"
@@ -52,11 +61,46 @@ int do_esync(void)
@@ -52,11 +60,46 @@ int do_esync(void)
#endif
}
@@ -72,8 +66,8 @@ index 5dd38c42a..e9a1ec15e 100644
+{
+ struct stat st;
+
+ if (stat( wine_get_config_dir(), &st ) == -1)
+ fatal_error( "cannot stat %s\n", wine_get_config_dir() );
+ if (fstat( config_dir_fd, &st ) == -1)
+ fatal_error( "cannot stat config dir\n" );
+
+ if (st.st_ino != (unsigned long)st.st_ino)
+ sprintf( shm_name, "/wine-%lx%08lx-esync", (unsigned long)((unsigned long long)st.st_ino >> 32), (unsigned long)st.st_ino );
@@ -100,7 +94,7 @@ index 5dd38c42a..e9a1ec15e 100644
};
static void esync_dump( struct object *obj, int verbose );
@@ -146,6 +190,25 @@ static struct esync *create_esync( struct object *root, const struct unicode_str
@@ -146,6 +189,25 @@ static struct esync *create_esync( struct object *root, const struct unicode_str
return NULL;
}
esync->type = type;
@@ -126,7 +120,7 @@ index 5dd38c42a..e9a1ec15e 100644
}
else
{
@@ -247,6 +310,7 @@ DECL_HANDLER(create_esync)
@@ -247,6 +309,7 @@ DECL_HANDLER(create_esync)
req->access, objattr->attributes );
reply->type = esync->type;
@@ -134,7 +128,7 @@ index 5dd38c42a..e9a1ec15e 100644
send_client_fd( current->process, esync->fd, reply->handle );
release_object( esync );
}
@@ -278,6 +342,7 @@ DECL_HANDLER(open_esync)
@@ -278,6 +341,7 @@ DECL_HANDLER(open_esync)
}
reply->type = esync->type;
@@ -155,7 +149,7 @@ index 2687c72e4..aeb58c546 100644
void esync_wake_up( struct object *obj );
void esync_clear( int fd );
diff --git a/server/main.c b/server/main.c
index 13af3b9fe..2a91f5ec8 100644
index 57463aecc..2f4b3411b 100644
--- a/server/main.c
+++ b/server/main.c
@@ -36,6 +36,7 @@
@@ -163,10 +157,10 @@ index 13af3b9fe..2a91f5ec8 100644
#include "thread.h"
#include "request.h"
+#include "esync.h"
#include "wine/library.h"
/* command-line options */
@@ -142,6 +143,9 @@ int main( int argc, char *argv[] )
int debug_level = 0;
@@ -141,6 +142,9 @@ int main( int argc, char *argv[] )
sock_init();
open_master_socket();
@@ -177,10 +171,10 @@ index 13af3b9fe..2a91f5ec8 100644
init_scheduler();
init_signals();
diff --git a/server/protocol.def b/server/protocol.def
index d14fdb607..c2b554490 100644
index f0dc0d24d..88a443de4 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -4052,6 +4052,7 @@ struct handle_info
@@ -4040,6 +4040,7 @@ struct handle_info
@REPLY
obj_handle_t handle; /* handle to the object */
int type; /* type of esync object (see below) */
@@ -188,7 +182,7 @@ index d14fdb607..c2b554490 100644
@END
/* Open an esync object */
@@ -4064,6 +4065,7 @@ struct handle_info
@@ -4052,6 +4053,7 @@ struct handle_info
@REPLY
obj_handle_t handle; /* handle to the event */
int type; /* type of esync object (above) */
@@ -197,5 +191,5 @@ index d14fdb607..c2b554490 100644
/* Retrieve the esync fd for an object. */
--
2.20.1
2.23.0