diff options
author | Stephen Toub <stoub@microsoft.com> | 2017-02-07 20:57:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-07 20:57:06 +0300 |
commit | 0e3fe2d4e207067d427f301b4533acb3e1c8c9f5 (patch) | |
tree | 5a264aa076200aac22511fbd66d17c7a8f8f67d5 | |
parent | 4677a0f7bf578cf39b2ca6ca86655ef7e449384a (diff) | |
parent | b95c212f6219c36566a076417113fc1013e70f85 (diff) |
Merge pull request #15911 from qmfrederik/android/inotify_rm_unsigned
Android - Support unsigned wd in inotify_rm_watchx
-rw-r--r-- | src/Native/Unix/Common/pal_config.h.in | 1 | ||||
-rw-r--r-- | src/Native/Unix/System.Native/pal_io.cpp | 8 | ||||
-rw-r--r-- | src/Native/Unix/configure.cmake | 13 |
3 files changed, 21 insertions, 1 deletions
diff --git a/src/Native/Unix/Common/pal_config.h.in b/src/Native/Unix/Common/pal_config.h.in index 2ef3d4f5da..15637f6bcf 100644 --- a/src/Native/Unix/Common/pal_config.h.in +++ b/src/Native/Unix/Common/pal_config.h.in @@ -72,6 +72,7 @@ #cmakedefine01 HAVE_MKSTEMP #cmakedefine01 IPV6MR_INTERFACE_UNSIGNED #cmakedefine01 BIND_ADDRLEN_UNSIGNED +#cmakedefine01 INOTIFY_RM_WATCH_WD_UNSIGNED // Mac OS X has stat64, but it is deprecated since plain stat now // provides the same 64-bit aware struct when targeting OS X > 10.5 diff --git a/src/Native/Unix/System.Native/pal_io.cpp b/src/Native/Unix/System.Native/pal_io.cpp index 6b0ac15638..91eddc761d 100644 --- a/src/Native/Unix/System.Native/pal_io.cpp +++ b/src/Native/Unix/System.Native/pal_io.cpp @@ -1193,7 +1193,13 @@ extern "C" int32_t SystemNative_INotifyRemoveWatch(intptr_t fd, int32_t wd) assert(wd >= 0); #if HAVE_INOTIFY - return inotify_rm_watch(ToFileDescriptor(fd), wd); + return inotify_rm_watch( + ToFileDescriptor(fd), +#if INOTIFY_RM_WATCH_WD_UNSIGNED + static_cast<uint32_t>(wd)); +#else + wd); +#endif #else (void)fd, (void)wd; errno = ENOTSUP; diff --git a/src/Native/Unix/configure.cmake b/src/Native/Unix/configure.cmake index 395ded203a..ef36d58d85 100644 --- a/src/Native/Unix/configure.cmake +++ b/src/Native/Unix/configure.cmake @@ -365,6 +365,19 @@ check_cxx_source_compiles( IPV6MR_INTERFACE_UNSIGNED ) +check_cxx_source_compiles( + " + #include <sys/inotify.h> + + int main() + { + intptr_t fd; + uint32_t wd; + return inotify_rm_watch(fd, wd); + } + " + INOTIFY_RM_WATCH_WD_UNSIGNED) + set (CMAKE_REQUIRED_FLAGS ${PREVIOUS_CMAKE_REQUIRED_FLAGS}) check_cxx_source_runs( |