diff options
author | Kai Tietz <kai.tietz@onevision.com> | 2009-04-01 09:05:13 +0000 |
---|---|---|
committer | Kai Tietz <ktietz@gcc.gnu.org> | 2009-04-01 11:05:13 +0200 |
commit | 73d21f56d15101ef12c3d5eede5d49ac0c662946 (patch) | |
tree | 55748baa20c6fd24c55c41441364e8daea37ab2b /gcc | |
parent | 03742a9b0159abadf88dc259d1331b48cf102e73 (diff) | |
download | gcc-73d21f56d15101ef12c3d5eede5d49ac0c662946.zip gcc-73d21f56d15101ef12c3d5eede5d49ac0c662946.tar.gz gcc-73d21f56d15101ef12c3d5eede5d49ac0c662946.tar.bz2 |
host-mingw32.c (mingw32_gt_pch_use_address): Make object_name unique for each process.
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.
Co-Authored-By: Andrey Galkin <agalkin@hypercom.com>
From-SVN: r145394
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/i386/host-mingw32.c | 15 |
2 files changed, 20 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bbb7af8..3209852 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +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. + 2009-04-01 Jakub Jelinek <jakub@redhat.com> PR other/39591 diff --git a/gcc/config/i386/host-mingw32.c b/gcc/config/i386/host-mingw32.c index ed8ab10..1d2e59a 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 |