server-Shared_Memory: Add a winediag warning message when shared memory is used.

This commit is contained in:
Sebastian Lackner 2015-03-21 00:14:26 +01:00
parent e2c1e62662
commit d7d95ca4b6
8 changed files with 57 additions and 75 deletions

View File

@ -3841,7 +3841,6 @@ if test "$enable_server_Shared_Memory" -eq 1; then
patch_apply server-Shared_Memory/0004-user32-Avoid-unnecessary-wineserver-calls-in-PeekMes.patch
patch_apply server-Shared_Memory/0005-user32-Get-rid-of-wineserver-call-for-GetLastInputIn.patch
patch_apply server-Shared_Memory/0006-ntdll-Only-enable-wineserver-shared-memory-communica.patch
patch_apply server-Shared_Memory/0007-server-Use-syscall-number-from-sys-syscall.h-if-poss.patch
(
echo '+ { "Sebastian Lackner", "ntdll: Implement virtual_map_shared_memory.", 1 },';
echo '+ { "Michael Müller", "server: Implement support for global and local shared memory blocks based on memfd.", 1 },';
@ -3849,7 +3848,6 @@ if test "$enable_server_Shared_Memory" -eq 1; then
echo '+ { "Sebastian Lackner", "user32: Avoid unnecessary wineserver calls in PeekMessage/GetMessage.", 1 },';
echo '+ { "Michael Müller", "user32: Get rid of wineserver call for GetLastInputInfo.", 1 },';
echo '+ { "Sebastian Lackner", "ntdll: Only enable wineserver shared memory communication when a special environment variable is set.", 1 },';
echo '+ { "Sebastian Lackner", "server: Use syscall number from sys/syscall.h if possible.", 1 },';
) >> "$patchlist"
fi

View File

@ -1,4 +1,4 @@
From 3298a6ca8d888b2636c870d34cb4f78272409bfd Mon Sep 17 00:00:00 2001
From bbcb2837fc29e7823c89f408611dfc6c8700d058 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 18 Mar 2015 23:03:01 +0100
Subject: ntdll: Implement virtual_map_shared_memory.
@ -22,10 +22,10 @@ index 674fcbc..41ef5cb 100644
extern BOOL virtual_handle_stack_fault( void *addr ) DECLSPEC_HIDDEN;
extern BOOL virtual_is_valid_code_address( const void *addr, SIZE_T size ) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index ab6bf9b..eb81294 100644
index 9d29c33..bfe7266 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -2739,6 +2739,58 @@ done:
@@ -2758,6 +2758,58 @@ done:
/***********************************************************************

View File

@ -1,4 +1,4 @@
From 52d65729080fcbc24bda5578d81eff7414d9ca5e Mon Sep 17 00:00:00 2001
From d4226297d14857b3b5d069af8ba7437fc2504939 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: server: Implement support for global and local shared memory blocks
@ -6,18 +6,18 @@ Subject: server: Implement support for global and local shared memory blocks
---
dlls/ntdll/ntdll_misc.h | 1 +
dlls/ntdll/server.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/thread.c | 4 ++++
include/wine/server.h | 11 +++++++++
dlls/ntdll/server.c | 64 ++++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/thread.c | 4 +++
include/wine/server.h | 11 ++++++++
include/winternl.h | 2 +-
server/fd.c | 27 +++++++++++++++++++++
server/file.h | 8 +++++++
server/fd.c | 27 ++++++++++++++++++
server/file.h | 8 ++++++
server/main.c | 1 +
server/mapping.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++
server/protocol.def | 15 ++++++++++++
server/thread.c | 7 ++++++
server/mapping.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++
server/protocol.def | 15 ++++++++++
server/thread.c | 7 +++++
server/thread.h | 2 ++
12 files changed, 205 insertions(+), 1 deletion(-)
12 files changed, 215 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 41ef5cb..18e00c9 100644
@ -240,31 +240,43 @@ index 7aed338..f984bfc 100644
return 0;
}
diff --git a/server/mapping.c b/server/mapping.c
index 64b3003..be624e5 100644
index 64b3003..063dbb8 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -31,6 +31,20 @@
@@ -29,8 +29,32 @@
#ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif
+#ifdef HAVE_SYS_SYSCALL_H
+# include <sys/syscall.h>
+#endif
#include <unistd.h>
+#if defined(__linux__) && (defined(__i386__) || defined(__x86_64__))
+
+/* __NR_memfd_create might not yet be available when buildservers use an old kernel */
+#ifndef __NR_memfd_create
+#ifdef __x86_64__
+#define __NR_memfd_create 319
+#else
+#define __NR_memfd_create 356
+#endif
+#endif
+
+/* the following declarations are only available in linux/fcntl.h, but not fcntl.h */
+#define F_LINUX_SPECIFIC_BASE 1024
+#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
+#define MFD_ALLOW_SEALING 0x0002U
+#define F_SEAL_SEAL 0x0001
+#define F_SEAL_SHRINK 0x0002
+#define F_SEAL_GROW 0x0004
+
+#endif
+
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
@@ -112,6 +126,10 @@ static struct list shared_list = LIST_INIT(shared_list);
@@ -112,6 +136,10 @@ static struct list shared_list = LIST_INIT(shared_list);
static size_t page_mask;
@ -275,7 +287,7 @@ index 64b3003..be624e5 100644
#define ROUND_SIZE(size) (((size) + page_mask) & ~page_mask)
@@ -156,6 +174,52 @@ static int check_current_dir_for_exec(void)
@@ -156,6 +184,52 @@ static int check_current_dir_for_exec(void)
return (ret != MAP_FAILED);
}

View File

@ -1,4 +1,4 @@
From 494442ff993ad741dda2f6676e4d7d0cd7294ae8 Mon Sep 17 00:00:00 2001
From 8a1c06c34baa7e2d2b6f0186932d86c0a9597824 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 19 Mar 2015 01:32:51 +0100
Subject: user32: Get rid of wineserver call for GetInputState.

View File

@ -1,4 +1,4 @@
From 07da6f20d2cb5decee8362297af6c27a83da0137 Mon Sep 17 00:00:00 2001
From de18d43e05db389d2d9d8d8e92e68bce609f720b Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 19 Mar 2015 02:07:24 +0100
Subject: user32: Avoid unnecessary wineserver calls in PeekMessage/GetMessage.

View File

@ -1,4 +1,4 @@
From 4ea257275cb1453288507cf536974ee3c013d449 Mon Sep 17 00:00:00 2001
From 23feeb06aebf6f8f040fb3b31d5088354284f976 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 19 Mar 2015 02:18:37 +0100
Subject: user32: Get rid of wineserver call for GetLastInputInfo.

View File

@ -1,18 +1,26 @@
From c7b1b681995a397cfc3fa9e9bba3415102217da1 Mon Sep 17 00:00:00 2001
From 43b9d13abbf16e59eb7e4b807a68a3c2426c2698 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 19 Mar 2015 02:55:36 +0100
Subject: ntdll: Only enable wineserver shared memory communication when a
special environment variable is set.
---
dlls/ntdll/server.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
dlls/ntdll/server.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index 0b8e007..349fcc7 100644
index 0b8e007..6155b6e 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -968,6 +968,21 @@ static int server_get_shared_memory_fd( HANDLE thread, int *unix_fd )
@@ -81,6 +81,7 @@
#include "ntdll_misc.h"
WINE_DEFAULT_DEBUG_CHANNEL(server);
+WINE_DECLARE_DEBUG_CHANNEL(winediag);
/* Some versions of glibc don't define this */
#ifndef SCM_RIGHTS
@@ -968,6 +969,21 @@ static int server_get_shared_memory_fd( HANDLE thread, int *unix_fd )
return ret;
}
@ -34,7 +42,7 @@ index 0b8e007..349fcc7 100644
/***********************************************************************
* server_get_shared_memory
@@ -980,6 +995,9 @@ void *server_get_shared_memory( HANDLE thread )
@@ -980,6 +996,9 @@ void *server_get_shared_memory( HANDLE thread )
void *mem = NULL;
int fd = -1;
@ -44,6 +52,17 @@ index 0b8e007..349fcc7 100644
/* The global memory block is only requested once. No locking is
* required because this function is called very early during the
* process initialization for the first time. */
@@ -994,7 +1013,10 @@ void *server_get_shared_memory( HANDLE thread )
}
if (!thread)
+ {
+ if (mem) WARN_(winediag)("Using shared memory wineserver communication\n");
shmglobal = mem;
+ }
return mem;
}
--
2.3.2

View File

@ -1,47 +0,0 @@
From 3fa7e694712c386d6dc6e3e4d708d2d8ad529bfe Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 19 Mar 2015 03:08:35 +0100
Subject: server: Use syscall number from sys/syscall.h if possible.
---
server/mapping.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/server/mapping.c b/server/mapping.c
index be624e5..063dbb8 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -29,20 +29,30 @@
#ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif
+#ifdef HAVE_SYS_SYSCALL_H
+# include <sys/syscall.h>
+#endif
#include <unistd.h>
#if defined(__linux__) && (defined(__i386__) || defined(__x86_64__))
+
+/* __NR_memfd_create might not yet be available when buildservers use an old kernel */
+#ifndef __NR_memfd_create
#ifdef __x86_64__
#define __NR_memfd_create 319
#else
#define __NR_memfd_create 356
#endif
+#endif
+
+/* the following declarations are only available in linux/fcntl.h, but not fcntl.h */
#define F_LINUX_SPECIFIC_BASE 1024
#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
#define MFD_ALLOW_SEALING 0x0002U
#define F_SEAL_SEAL 0x0001
#define F_SEAL_SHRINK 0x0002
#define F_SEAL_GROW 0x0004
+
#endif
#include "ntstatus.h"
--
2.3.2