| 40 | } |
| 41 | |
| 42 | WatcherKqueue::WatcherKqueue( WatchID watchid, const std::string& dirname, |
| 43 | FileWatchListener* listener, bool recursive, |
| 44 | FileWatcherKqueue* watcher, WatcherKqueue* parent ) : |
| 45 | Watcher( watchid, dirname, listener, recursive ), |
| 46 | mLastWatchID( 0 ), |
| 47 | mChangeListCount( 0 ), |
| 48 | mKqueue( kqueue() ), |
| 49 | mWatcher( watcher ), |
| 50 | mParent( parent ), |
| 51 | mInitOK( true ), |
| 52 | mErrno( 0 ) { |
| 53 | if ( -1 == mKqueue ) { |
| 54 | efDEBUG( |
| 55 | "kqueue() returned invalid descriptor for directory %s. File descriptors count: %ld\n", |
| 56 | Directory.c_str(), mWatcher->mFileDescriptorCount ); |
| 57 | |
| 58 | mInitOK = false; |
| 59 | mErrno = errno; |
| 60 | } else { |
| 61 | mWatcher->addFD(); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | WatcherKqueue::~WatcherKqueue() { |
| 66 | // Remove the children watchers ( sub-folders watches ) |