diff --git a/fsevents.c b/fsevents.c index 90a95d1..1ed51e4 100644 --- a/fsevents.c +++ b/fsevents.c @@ -171,7 +171,6 @@ fsevents_tidy(struct observance *obs) exit(-1); // ERRNO } close(fsevents_fd); - } @@ -188,7 +187,9 @@ register_fsevents(lua_State *L) { * opens and initalizes fsevents. */ extern void -open_fsevents(lua_State *L) { +open_fsevents(lua_State *L) +{ + return; int8_t event_list[] = { // action to take for each event FSE_REPORT, /* FSE_CREATE_FILE */ diff --git a/lsyncd.c b/lsyncd.c index 0533b00..842c33f 100644 --- a/lsyncd.c +++ b/lsyncd.c @@ -716,8 +716,19 @@ l_realdir(lua_State *L) const char *rdir = luaL_checkstring(L, 1); /* use c-library to get absolute path */ +#ifdef _GNU_SOURCE cbuf = realpath(rdir, NULL); - if (cbuf == NULL) { +#else +# warning must use oldstyle realpath() + { + char *ccbuf = s_calloc(sizeof(char), PATH_MAX); + cbuf = realpath(rdir, ccbuf); + if (!cbuf) { + free(ccbuf); + } + } +#endif + if (!cbuf) { printlogf(L, "Error", "failure getting absolute path of [%s]", rdir); return 0; } diff --git a/lsyncd.lua b/lsyncd.lua index 9edb282..1b21f86 100644 --- a/lsyncd.lua +++ b/lsyncd.lua @@ -1589,7 +1589,7 @@ local Syncs = (function() config.monitor = settings.monitor or config.monitor or Monitors.default() if config.monitor ~= "inotify" --- and config.monitor ~= "fanotify" + and config.monitor ~= "fsevents" then local info = debug.getinfo(3, "Sl") log("Error", info.short_src, ":", info.currentline, @@ -1873,14 +1873,11 @@ local Inotify = (function() end)() ----- --- Interface to fanotify, watches a whole filesystems +-- Interface to OSX /dev/fsevents, watches the whole filesystems -- --- NOT USED. +-- All fsevents specific implementation should be enclosed here. -- --- All fanotify specific implementation should be enclosed here. --- ---[[ -local Fanotify = (function() +local Fsevents = (function() ----- -- A list indexed by sync's containing the root path this -- sync is interested in. @@ -1913,7 +1910,7 @@ local Fanotify = (function() -- @param filename2 -- local function event(etype, isdir, time, filename, filename2) - print("FANOTIFY", etype, isdir, time, filename, filename2) + print("FSEVENTS", etype, isdir, time, filename, filename2) end ----- @@ -1930,7 +1927,6 @@ local Fanotify = (function() statusReport = statusReport } end)() -]]-- ----- -- Holds information about the event monitor capabilities @@ -2514,7 +2510,7 @@ end function runner.initialize() -- creates settings if user didnt settings = settings or {} - + -- From this point on, no globals may be created anymore lockGlobals() @@ -2592,8 +2588,8 @@ function runner.initialize() for _, s in Syncs.iwalk() do if s.config.monitor == "inotify" then Inotify.addSync(s, s.source) --- elseif s.config.monitor == "fanotify" then --- Fanotify.addSync(s, s.source) + elseif s.config.monitor == "fanotify" then + Fsevents.addSync(s, s.source) else error("sync "..s.config.name.. " has no known event monitor interface.")