working on OSX port

This commit is contained in:
Axel Kittenberger 2010-11-29 17:45:04 +00:00
parent b73bbe3287
commit cfc233f37e
3 changed files with 23 additions and 15 deletions

View File

@ -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 */

View File

@ -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;
}

View File

@ -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.")