… | |
… | |
287 | # endif |
287 | # endif |
288 | #endif |
288 | #endif |
289 | |
289 | |
290 | #if EV_USE_INOTIFY |
290 | #if EV_USE_INOTIFY |
291 | # include <sys/utsname.h> |
291 | # include <sys/utsname.h> |
|
|
292 | # include <sys/statfs.h> |
292 | # include <sys/inotify.h> |
293 | # include <sys/inotify.h> |
293 | /* some very old inotify.h headers don't have IN_DONT_FOLLOW */ |
294 | /* some very old inotify.h headers don't have IN_DONT_FOLLOW */ |
294 | # ifndef IN_DONT_FOLLOW |
295 | # ifndef IN_DONT_FOLLOW |
295 | # undef EV_USE_INOTIFY |
296 | # undef EV_USE_INOTIFY |
296 | # define EV_USE_INOTIFY 0 |
297 | # define EV_USE_INOTIFY 0 |
… | |
… | |
2432 | if (w->wd < 0) |
2433 | if (w->wd < 0) |
2433 | { |
2434 | { |
2434 | ev_timer_start (EV_A_ &w->timer); /* this is not race-free, so we still need to recheck periodically */ |
2435 | ev_timer_start (EV_A_ &w->timer); /* this is not race-free, so we still need to recheck periodically */ |
2435 | |
2436 | |
2436 | /* monitor some parent directory for speedup hints */ |
2437 | /* monitor some parent directory for speedup hints */ |
2437 | /* note that exceeding the hardcoded limit is not a correctness issue, */ |
2438 | /* note that exceeding the hardcoded path limit is not a correctness issue, */ |
2438 | /* but an efficiency issue only */ |
2439 | /* but an efficiency issue only */ |
2439 | if ((errno == ENOENT || errno == EACCES) && strlen (w->path) < 4096) |
2440 | if ((errno == ENOENT || errno == EACCES) && strlen (w->path) < 4096) |
2440 | { |
2441 | { |
2441 | char path [4096]; |
2442 | char path [4096]; |
2442 | strcpy (path, w->path); |
2443 | strcpy (path, w->path); |
… | |
… | |
2456 | } |
2457 | } |
2457 | while (w->wd < 0 && (errno == ENOENT || errno == EACCES)); |
2458 | while (w->wd < 0 && (errno == ENOENT || errno == EACCES)); |
2458 | } |
2459 | } |
2459 | } |
2460 | } |
2460 | else |
2461 | else |
|
|
2462 | todo, on nfs etc., we need to poll every 60s or so |
2461 | ev_timer_stop (EV_A_ &w->timer); /* we can watch this in a race-free way */ |
2463 | ev_timer_stop (EV_A_ &w->timer); /* we can watch this in a race-free way */ |
2462 | |
2464 | |
2463 | if (w->wd >= 0) |
2465 | if (w->wd >= 0) |
2464 | wlist_add (&fs_hash [w->wd & (EV_INOTIFY_HASHSIZE - 1)].head, (WL)w); |
2466 | wlist_add (&fs_hash [w->wd & (EV_INOTIFY_HASHSIZE - 1)].head, (WL)w); |
2465 | } |
2467 | } |