|
a/src/index/rclmonrcv.cpp |
|
b/src/index/rclmonrcv.cpp |
|
... |
|
... |
177 |
LOGDEB(("rclMonRcvRun: walking %s\n", it->c_str()));
|
177 |
LOGDEB(("rclMonRcvRun: walking %s\n", it->c_str()));
|
178 |
if (walker.walk(*it, walkcb) != FsTreeWalker::FtwOk) {
|
178 |
if (walker.walk(*it, walkcb) != FsTreeWalker::FtwOk) {
|
179 |
LOGERR(("rclMonRcvRun: tree walk failed\n"));
|
179 |
LOGERR(("rclMonRcvRun: tree walk failed\n"));
|
180 |
goto terminate;
|
180 |
goto terminate;
|
181 |
}
|
181 |
}
|
|
|
182 |
if (walker.getErrCnt() > 0) {
|
|
|
183 |
LOGINFO(("rclMonRcvRun: fs walker errors: %s\n",
|
|
|
184 |
walker.getReason().c_str()));
|
|
|
185 |
}
|
182 |
}
|
186 |
}
|
183 |
|
187 |
|
184 |
{
|
188 |
{
|
185 |
bool dobeagle = false;
|
189 |
bool dobeagle = false;
|
186 |
lconfig.getConfParam("processbeaglequeue", &dobeagle);
|
190 |
lconfig.getConfParam("processbeaglequeue", &dobeagle);
|
|
... |
|
... |
216 |
if (!walker.inSkippedNames(path_getsimple(ev.m_path)) &&
|
220 |
if (!walker.inSkippedNames(path_getsimple(ev.m_path)) &&
|
217 |
!walker.inSkippedPaths(ev.m_path)) {
|
221 |
!walker.inSkippedPaths(ev.m_path)) {
|
218 |
LOGDEB(("rclMonRcvRun: walking new dir %s\n",
|
222 |
LOGDEB(("rclMonRcvRun: walking new dir %s\n",
|
219 |
ev.m_path.c_str()));
|
223 |
ev.m_path.c_str()));
|
220 |
if (walker.walk(ev.m_path, walkcb) != FsTreeWalker::FtwOk) {
|
224 |
if (walker.walk(ev.m_path, walkcb) != FsTreeWalker::FtwOk) {
|
221 |
LOGERR(("rclMonRcvRun: failed walking new dir %s\n",
|
225 |
LOGERR(("rclMonRcvRun: walking new dir %s: %s\n",
|
222 |
ev.m_path.c_str()));
|
226 |
ev.m_path.c_str(), walker.getReason().c_str()));
|
223 |
goto terminate;
|
227 |
goto terminate;
|
|
|
228 |
}
|
|
|
229 |
if (walker.getErrCnt() > 0) {
|
|
|
230 |
LOGINFO(("rclMonRcvRun: fs walker errors: %s\n",
|
|
|
231 |
walker.getReason().c_str()));
|
224 |
}
|
232 |
}
|
225 |
}
|
233 |
}
|
226 |
}
|
234 |
}
|
227 |
|
235 |
|
228 |
if (ev.m_etyp != RclMonEvent::RCLEVT_NONE)
|
236 |
if (ev.m_etyp != RclMonEvent::RCLEVT_NONE)
|
|
... |
|
... |
239 |
// Utility routine used by both the fam/gamin and inotify versions to get
|
247 |
// Utility routine used by both the fam/gamin and inotify versions to get
|
240 |
// rid of the id-path translation for a moved dir
|
248 |
// rid of the id-path translation for a moved dir
|
241 |
bool eraseWatchSubTree(map<int, string>& idtopath, const string& top)
|
249 |
bool eraseWatchSubTree(map<int, string>& idtopath, const string& top)
|
242 |
{
|
250 |
{
|
243 |
bool found = false;
|
251 |
bool found = false;
|
244 |
LOGDEB0(("Clearing map for [%s]\n", top.c_str()));
|
252 |
MONDEB(("Clearing map for [%s]\n", top.c_str()));
|
245 |
map<int,string>::iterator it = idtopath.begin();
|
253 |
map<int,string>::iterator it = idtopath.begin();
|
246 |
while (it != idtopath.end()) {
|
254 |
while (it != idtopath.end()) {
|
247 |
if (it->second.find(top) == 0) {
|
255 |
if (it->second.find(top) == 0) {
|
248 |
found = true;
|
256 |
found = true;
|
249 |
idtopath.erase(it++);
|
257 |
idtopath.erase(it++);
|
|
... |
|
... |
459 |
case FAMMoved:
|
467 |
case FAMMoved:
|
460 |
case FAMDeleted:
|
468 |
case FAMDeleted:
|
461 |
ev.m_etyp = RclMonEvent::RCLEVT_DELETE;
|
469 |
ev.m_etyp = RclMonEvent::RCLEVT_DELETE;
|
462 |
// We would like to signal a directory here to enable cleaning
|
470 |
// We would like to signal a directory here to enable cleaning
|
463 |
// the subtree (on a dir move), but can't test the actual file
|
471 |
// the subtree (on a dir move), but can't test the actual file
|
464 |
// which is gone. Let's rely on the fact that a directory
|
472 |
// which is gone, and fam doesn't tell us if it's a dir or reg.
|
465 |
// should be watched
|
473 |
// Let's rely on the fact that a directory should be watched
|
466 |
if (eraseWatchSubTree(m_idtopath, ev.m_path))
|
474 |
if (eraseWatchSubTree(m_idtopath, ev.m_path))
|
467 |
ev.m_etyp |= RclMonEvent::RCLEVT_ISDIR;
|
475 |
ev.m_etyp |= RclMonEvent::RCLEVT_ISDIR;
|
468 |
break;
|
476 |
break;
|
469 |
|
477 |
|
470 |
case FAMStartExecuting:
|
478 |
case FAMStartExecuting:
|