virtual bool DoAdd(wxSharedPtr<wxFSWatchEntryKq> watch) { wxCHECK_MSG( IsOk(), false, "Kqueue not initialized or invalid kqueue descriptor" ); struct kevent event; int action = EV_ADD | EV_ENABLE | EV_CLEAR | EV_ERROR; int flags = Watcher2NativeFlags(watch->GetFlags()); EV_SET( &event, watch->GetFileDescriptor(), EVFILT_VNODE, action, flags, 0, watch.get() ); // TODO more error conditions according to man // TODO best deal with the error here int ret = kevent(m_kfd, &event, 1, NULL, 0, NULL); if (ret == -1) { wxLogSysError(_("Unable to add kqueue watch")); return false; } return true; }