Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederik Carlier <frederik.carlier@quamotion.mobi>2017-02-07 20:01:35 +0300
committerFrederik Carlier <frederik.carlier@quamotion.mobi>2017-02-07 20:05:44 +0300
commitb95c212f6219c36566a076417113fc1013e70f85 (patch)
treef5c9a68bbece308fa90094150b0729fe23837a29
parentc932468fc4021d0ce3ae20564bbc2f12499a2158 (diff)
Support unsigned wd in inotify_rm_watch
-rw-r--r--src/Native/Unix/Common/pal_config.h.in1
-rw-r--r--src/Native/Unix/System.Native/pal_io.cpp8
-rw-r--r--src/Native/Unix/configure.cmake13
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(