From fb0f87b6d705397160288232a297ea9785fa7258 Mon Sep 17 00:00:00 2001 From: Gireesh Punathil Date: Fri, 2 Dec 2016 22:28:22 -0500 Subject: [PATCH] aix: re-enable fs watch facility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On AIX, watch feature depends on AHAFS based Event infrastructure. While in principle the watch use case is same across platforms, there are subtle differences in the way AIX deals with this, with few behavioral changes (external). This commit opens up the AIX code for watch feature which was masked under a macro HAVE_SYS_AHAFS_EVPRODS_H and addresses an assertion failure on folder watch. PR-URL: https://github.com/libuv/libuv/pull/1156 Reviewed-By: Ben Noordhuis Reviewed-By: Saúl Ibarra Corretgé Reviewed-By: Michael Dawson --- Makefile.am | 6 +++++- src/unix/aix.c | 7 +++++++ uv.gyp | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 2637ef3f..036464e7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -316,7 +316,11 @@ test_run_tests_CFLAGS += -D_UNIX03_THREADS \ endif if AIX -libuv_la_CFLAGS += -D_ALL_SOURCE -D_XOPEN_SOURCE=500 -D_LINUX_SOURCE_COMPAT -D_THREAD_SAFE +libuv_la_CFLAGS += -D_ALL_SOURCE \ + -D_XOPEN_SOURCE=500 \ + -D_LINUX_SOURCE_COMPAT \ + -D_THREAD_SAFE \ + -DHAVE_SYS_AHAFS_EVPRODS_H include_HEADERS += include/uv-aix.h libuv_la_SOURCES += src/unix/aix.c endif diff --git a/src/unix/aix.c b/src/unix/aix.c index 80d63301..1d2cd4a8 100644 --- a/src/unix/aix.c +++ b/src/unix/aix.c @@ -758,6 +758,13 @@ static void uv__ahafs_event(uv_loop_t* loop, uv__io_t* event_watch, unsigned int assert((bytes >= 0) && "uv__ahafs_event - Error reading monitor file"); + /* In file / directory move cases, AIX Event infrastructure + * produces a second event with no data. + * Ignore it and return gracefully. + */ + if(bytes == 0) + return; + /* Parse the data */ if(bytes > 0) rc = uv__parse_data(result_data, &events, handle); diff --git a/uv.gyp b/uv.gyp index 60fd5c12..49d5d22f 100644 --- a/uv.gyp +++ b/uv.gyp @@ -277,6 +277,7 @@ '_XOPEN_SOURCE=500', '_LINUX_SOURCE_COMPAT', '_THREAD_SAFE', + 'HAVE_SYS_AHAFS_EVPRODS_H', ], 'link_settings': { 'libraries': [