summaryrefslogtreecommitdiff
path: root/gcc/config/i386
diff options
context:
space:
mode:
authorktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-01 09:05:13 +0000
committerktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-01 09:05:13 +0000
commit4ccce1021256dbef696b9206e02ff4140876a30f (patch)
tree55748baa20c6fd24c55c41441364e8daea37ab2b /gcc/config/i386
parent4a04f4b4ef151f7daac789989104d7a55f434f0b (diff)
downloadgcc-4ccce1021256dbef696b9206e02ff4140876a30f.tar.gz
2009-04-01 Kai Tietz <kai.tietz@onevision.com>
Andrey Galkin <agalkin@hypercom.com> PR/39492 * config/i386/host-mingw32.c (mingw32_gt_pch_use_address): Make object_name unique for each process. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145394 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/i386')
-rw-r--r--gcc/config/i386/host-mingw32.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/config/i386/host-mingw32.c b/gcc/config/i386/host-mingw32.c
index ed8ab1008ee..1d2e59ab576 100644
--- a/gcc/config/i386/host-mingw32.c
+++ b/gcc/config/i386/host-mingw32.c
@@ -120,8 +120,19 @@ mingw32_gt_pch_use_address (void *addr, size_t size, int fd,
namespace when running an application in a Terminal Server
session. This causes failure since, by default, applications
don't get SeCreateGlobalPrivilege. We don't need global
- memory sharing so explicitly put object into Local namespace. */
- const char object_name[] = "Local\\MinGWGCCPCH";
+ memory sharing so explicitly put object into Local namespace.
+
+ There is also another issue, which appears if multiple concurrent
+ GCC processes are using PCH functionality. MapViewOfFileEx returns
+ "Access Denied" error. So we need to make the session-wide mapping
+ name unique. Let's use current process ID for that. */
+#define OBJECT_NAME_FMT "Local\\MinGWGCCPCH-"
+
+ /* Allocate enough space for name prefix and max possible DWORD
+ hexadecimal representation. */
+ char object_name[sizeof (OBJECT_NAME_FMT) + sizeof (DWORD) * 2];
+ snprintf (object_name, sizeof (object_name), OBJECT_NAME_FMT "%lx",
+ GetCurrentProcessId());
/* However, the documentation for CreateFileMapping says that on NT4
and earlier, backslashes are invalid in object name. So, we need