Some bug fixes for Windows (#7374)

* Fix MAP_SHARED check in sys/mman.h

* Fix missing :platform_shims dependency for ray_util

* dlmalloc patch for Arrow
This commit is contained in:
mehrdadn
2020-02-28 10:22:32 -08:00
committed by GitHub
parent 0efaa9b310
commit 5fb5be0ba5
4 changed files with 19 additions and 1 deletions
+1
View File
@@ -837,6 +837,7 @@ cc_library(
],
visibility = ["//visibility:public"],
deps = [
":platform_shims",
":sha256",
"@boost//:asio",
"@com_github_google_glog//:glog",
+1
View File
@@ -188,6 +188,7 @@ def ray_deps_setup():
"//thirdparty/patches:arrow-windows-poll.patch",
"//thirdparty/patches:arrow-windows-sigpipe.patch",
"//thirdparty/patches:arrow-windows-socket.patch",
"//thirdparty/patches:arrow-windows-dlmalloc.patch",
],
)
+1 -1
View File
@@ -19,7 +19,7 @@ EXTERN_C WINBASEAPI void *WINAPI MapViewOfFile(HANDLE hFileMappingObject,
EXTERN_C WINBASEAPI BOOL WINAPI UnmapViewOfFile(void const *lpBaseAddress);
static void *mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off) {
void *result = (void *)(-1);
if (!addr && prot == MAP_SHARED) {
if (!addr && (flags & MAP_SHARED)) {
/* HACK: we're assuming handle sizes can't exceed 32 bits, which is wrong...
* but works for now. */
void *ptr = MapViewOfFile((HANDLE)(intptr_t)fd, FILE_MAP_ALL_ACCESS,
+16
View File
@@ -0,0 +1,16 @@
diff --git cpp/src/plasma/dlmalloc.cc cpp/src/plasma/dlmalloc.cc
--- cpp/src/plasma/dlmalloc.cc
+++ cpp/src/plasma/dlmalloc.cc
@@ -76,5 +76,8 @@ int create_buffer(int64_t size) {
- if (!CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
- (DWORD)((uint64_t)size >> (CHAR_BIT * sizeof(DWORD))),
- (DWORD)(uint64_t)size, NULL)) {
+ HANDLE h = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
+ (DWORD)((uint64_t)size >> (CHAR_BIT * sizeof(DWORD))),
+ (DWORD)(uint64_t)size, NULL);
+ if (h) {
+ fd = reinterpret_cast<int>(h);
+ } else {
fd = -1;
}
--