summaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-06-18 12:25:20 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-06-18 12:25:20 -0400
commit3c8a9043b6fc8fafbeac16e8f9199a0d12870549 (patch)
treed3efa261e61f19b3aea254409cb2c144886f5d05 /Assistant
parent0ecc7dc8927b3840d6a7ba4d39c344f3e962580e (diff)
skeleton C library for calling kqueue
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/Watcher.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/Assistant/Watcher.hs b/Assistant/Watcher.hs
index 1d35b5c1e..7c913d98c 100644
--- a/Assistant/Watcher.hs
+++ b/Assistant/Watcher.hs
@@ -33,12 +33,15 @@ import qualified Data.ByteString.Lazy as L
import Utility.Inotify
import System.INotify
#endif
+#ifdef WITH_KQUEUE
+import Utility.Kqueue
+#endif
type Handler = FilePath -> Maybe FileStatus -> DaemonStatusHandle -> Annex (Maybe Change)
checkCanWatch :: Annex ()
checkCanWatch = do
-#ifdef WITH_INOTIFY
+#if (WITH_INOTIFY || WITH_KQUEUE)
unlessM (liftIO (inPath "lsof") <||> Annex.getState Annex.force) $
needLsof
#else
@@ -82,8 +85,13 @@ watchThread st dstatus changechan = withINotify $ \i -> do
, errHook = hook onErr
}
#else
+#ifdef WITH_KQUEUE
+watchThread st dstatus changechan = do
+ print =<< waitChange [stdError, stdOutput]
+#else
watchThread = undefined
-#endif
+#endif /* WITH_KQUEUE */
+#endif /* WITH_INOTIFY */
ignored :: FilePath -> Bool
ignored ".git" = True