mirror of
https://github.com/octoleo/lsyncd.git
synced 2025-01-23 07:08:33 +00:00
working on OSX port
This commit is contained in:
parent
b73bbe3287
commit
cfc233f37e
@ -171,7 +171,6 @@ fsevents_tidy(struct observance *obs)
|
|||||||
exit(-1); // ERRNO
|
exit(-1); // ERRNO
|
||||||
}
|
}
|
||||||
close(fsevents_fd);
|
close(fsevents_fd);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -188,7 +187,9 @@ register_fsevents(lua_State *L) {
|
|||||||
* opens and initalizes fsevents.
|
* opens and initalizes fsevents.
|
||||||
*/
|
*/
|
||||||
extern void
|
extern void
|
||||||
open_fsevents(lua_State *L) {
|
open_fsevents(lua_State *L)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
|
||||||
int8_t event_list[] = { // action to take for each event
|
int8_t event_list[] = { // action to take for each event
|
||||||
FSE_REPORT, /* FSE_CREATE_FILE */
|
FSE_REPORT, /* FSE_CREATE_FILE */
|
||||||
|
13
lsyncd.c
13
lsyncd.c
@ -716,8 +716,19 @@ l_realdir(lua_State *L)
|
|||||||
const char *rdir = luaL_checkstring(L, 1);
|
const char *rdir = luaL_checkstring(L, 1);
|
||||||
|
|
||||||
/* use c-library to get absolute path */
|
/* use c-library to get absolute path */
|
||||||
|
#ifdef _GNU_SOURCE
|
||||||
cbuf = realpath(rdir, NULL);
|
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);
|
printlogf(L, "Error", "failure getting absolute path of [%s]", rdir);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
18
lsyncd.lua
18
lsyncd.lua
@ -1589,7 +1589,7 @@ local Syncs = (function()
|
|||||||
config.monitor =
|
config.monitor =
|
||||||
settings.monitor or config.monitor or Monitors.default()
|
settings.monitor or config.monitor or Monitors.default()
|
||||||
if config.monitor ~= "inotify"
|
if config.monitor ~= "inotify"
|
||||||
-- and config.monitor ~= "fanotify"
|
and config.monitor ~= "fsevents"
|
||||||
then
|
then
|
||||||
local info = debug.getinfo(3, "Sl")
|
local info = debug.getinfo(3, "Sl")
|
||||||
log("Error", info.short_src, ":", info.currentline,
|
log("Error", info.short_src, ":", info.currentline,
|
||||||
@ -1873,14 +1873,11 @@ local Inotify = (function()
|
|||||||
end)()
|
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 Fsevents = (function()
|
||||||
--
|
|
||||||
--[[
|
|
||||||
local Fanotify = (function()
|
|
||||||
-----
|
-----
|
||||||
-- A list indexed by sync's containing the root path this
|
-- A list indexed by sync's containing the root path this
|
||||||
-- sync is interested in.
|
-- sync is interested in.
|
||||||
@ -1913,7 +1910,7 @@ local Fanotify = (function()
|
|||||||
-- @param filename2
|
-- @param filename2
|
||||||
--
|
--
|
||||||
local function event(etype, isdir, time, filename, filename2)
|
local function event(etype, isdir, time, filename, filename2)
|
||||||
print("FANOTIFY", etype, isdir, time, filename, filename2)
|
print("FSEVENTS", etype, isdir, time, filename, filename2)
|
||||||
end
|
end
|
||||||
|
|
||||||
-----
|
-----
|
||||||
@ -1930,7 +1927,6 @@ local Fanotify = (function()
|
|||||||
statusReport = statusReport
|
statusReport = statusReport
|
||||||
}
|
}
|
||||||
end)()
|
end)()
|
||||||
]]--
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Holds information about the event monitor capabilities
|
-- Holds information about the event monitor capabilities
|
||||||
@ -2592,8 +2588,8 @@ function runner.initialize()
|
|||||||
for _, s in Syncs.iwalk() do
|
for _, s in Syncs.iwalk() do
|
||||||
if s.config.monitor == "inotify" then
|
if s.config.monitor == "inotify" then
|
||||||
Inotify.addSync(s, s.source)
|
Inotify.addSync(s, s.source)
|
||||||
-- elseif s.config.monitor == "fanotify" then
|
elseif s.config.monitor == "fanotify" then
|
||||||
-- Fanotify.addSync(s, s.source)
|
Fsevents.addSync(s, s.source)
|
||||||
else
|
else
|
||||||
error("sync "..s.config.name..
|
error("sync "..s.config.name..
|
||||||
" has no known event monitor interface.")
|
" has no known event monitor interface.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user