diff options
| author | Ed Maste <emaste@FreeBSD.org> | 2013-11-06 16:48:53 +0000 |
|---|---|---|
| committer | Ed Maste <emaste@FreeBSD.org> | 2013-11-06 16:48:53 +0000 |
| commit | f21a844f60ae6c74fcf1fddca32461acce3c1ee0 (patch) | |
| tree | 56d79f94966870db1cecd65a7264510a25fd1cba /source/Core/ConnectionSharedMemory.cpp | |
| parent | 37d22554be9f5a677dad2a95b7ef22fe59c66a8a (diff) | |
Notes
Diffstat (limited to 'source/Core/ConnectionSharedMemory.cpp')
| -rw-r--r-- | source/Core/ConnectionSharedMemory.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/source/Core/ConnectionSharedMemory.cpp b/source/Core/ConnectionSharedMemory.cpp index 625f17a0985b0..cd708c4868c9c 100644 --- a/source/Core/ConnectionSharedMemory.cpp +++ b/source/Core/ConnectionSharedMemory.cpp @@ -11,12 +11,15 @@ // C Includes #include <errno.h> -#include <pthread.h> #include <stdlib.h> +#ifdef _WIN32 +#include "lldb/Host/windows/windows.h" +#else #include <sys/file.h> #include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> +#endif // C++ Includes // Other libraries and framework includes @@ -73,7 +76,12 @@ ConnectionSharedMemory::Disconnect (Error *error_ptr) m_mmap.Clear(); if (!m_name.empty()) { +#ifdef _WIN32 + close(m_fd); + m_fd = -1; +#else shm_unlink (m_name.c_str()); +#endif m_name.clear(); } return eConnectionStatusSuccess; @@ -114,6 +122,16 @@ ConnectionSharedMemory::Open (bool create, const char *name, size_t size, Error } m_name.assign (name); + +#ifdef _WIN32 + HANDLE handle; + if (create) + handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, (DWORD)(size >> 32), (DWORD)(size), name); + else + handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, name); + + m_fd = _open_osfhandle((intptr_t)handle, 0); +#else int oflag = O_RDWR; if (create) oflag |= O_CREAT; @@ -121,6 +139,7 @@ ConnectionSharedMemory::Open (bool create, const char *name, size_t size, Error if (create) ::ftruncate (m_fd, size); +#endif if (m_mmap.MemoryMapFromFileDescriptor(m_fd, 0, size, true, false) == size) return eConnectionStatusSuccess; |
