… | |
… | |
1270 | /* kqueue is borked on everything but netbsd apparently */ |
1270 | /* kqueue is borked on everything but netbsd apparently */ |
1271 | /* it usually doesn't work correctly on anything but sockets and pipes */ |
1271 | /* it usually doesn't work correctly on anything but sockets and pipes */ |
1272 | flags &= ~EVBACKEND_KQUEUE; |
1272 | flags &= ~EVBACKEND_KQUEUE; |
1273 | #endif |
1273 | #endif |
1274 | #ifdef __APPLE__ |
1274 | #ifdef __APPLE__ |
1275 | // flags &= ~EVBACKEND_KQUEUE; for documentation |
1275 | // flags &= ~EVBACKEND_KQUEUE & ~EVBACKEND_POLL; for documentation |
1276 | flags &= ~EVBACKEND_POLL; |
1276 | flags &= ~EVBACKEND_SELECT; |
1277 | #endif |
1277 | #endif |
1278 | |
1278 | |
1279 | return flags; |
1279 | return flags; |
1280 | } |
1280 | } |
1281 | |
1281 | |
… | |
… | |
2478 | int mask = IN_MASK_ADD | IN_DELETE_SELF | IN_MOVE_SELF |
2478 | int mask = IN_MASK_ADD | IN_DELETE_SELF | IN_MOVE_SELF |
2479 | | (errno == EACCES ? IN_ATTRIB : IN_CREATE | IN_MOVED_TO); |
2479 | | (errno == EACCES ? IN_ATTRIB : IN_CREATE | IN_MOVED_TO); |
2480 | |
2480 | |
2481 | char *pend = strrchr (path, '/'); |
2481 | char *pend = strrchr (path, '/'); |
2482 | |
2482 | |
2483 | if (!pend) |
2483 | if (!pend || pend == path) |
2484 | break; /* whoops, no '/', complain to your admin */ |
2484 | break; |
2485 | |
2485 | |
2486 | *pend = 0; |
2486 | *pend = 0; |
2487 | w->wd = inotify_add_watch (fs_fd, path, mask); |
2487 | w->wd = inotify_add_watch (fs_fd, path, mask); |
2488 | } |
2488 | } |
2489 | while (w->wd < 0 && (errno == ENOENT || errno == EACCES)); |
2489 | while (w->wd < 0 && (errno == ENOENT || errno == EACCES)); |
2490 | } |
2490 | } |
2491 | } |
2491 | } |
2492 | else |
2492 | |
|
|
2493 | if (w->wd >= 0) |
2493 | { |
2494 | { |
2494 | wlist_add (&fs_hash [w->wd & (EV_INOTIFY_HASHSIZE - 1)].head, (WL)w); |
2495 | wlist_add (&fs_hash [w->wd & (EV_INOTIFY_HASHSIZE - 1)].head, (WL)w); |
2495 | |
2496 | |
2496 | /* now local changes will be tracked by inotify, but remote changes won't */ |
2497 | /* now local changes will be tracked by inotify, but remote changes won't */ |
2497 | /* unless the filesystem it known to be local, we therefore still poll */ |
2498 | /* unless the filesystem it known to be local, we therefore still poll */ |
… | |
… | |
2547 | |
2548 | |
2548 | if (w->wd == wd || wd == -1) |
2549 | if (w->wd == wd || wd == -1) |
2549 | { |
2550 | { |
2550 | if (ev->mask & (IN_IGNORED | IN_UNMOUNT | IN_DELETE_SELF)) |
2551 | if (ev->mask & (IN_IGNORED | IN_UNMOUNT | IN_DELETE_SELF)) |
2551 | { |
2552 | { |
|
|
2553 | wlist_del (&fs_hash [slot & (EV_INOTIFY_HASHSIZE - 1)].head, (WL)w); |
2552 | w->wd = -1; |
2554 | w->wd = -1; |
2553 | infy_add (EV_A_ w); /* re-add, no matter what */ |
2555 | infy_add (EV_A_ w); /* re-add, no matter what */ |
2554 | } |
2556 | } |
2555 | |
2557 | |
2556 | stat_timer_cb (EV_A_ &w->timer, 0); |
2558 | stat_timer_cb (EV_A_ &w->timer, 0); |
… | |
… | |
2903 | static void |
2905 | static void |
2904 | embed_fork_cb (EV_P_ ev_fork *fork_w, int revents) |
2906 | embed_fork_cb (EV_P_ ev_fork *fork_w, int revents) |
2905 | { |
2907 | { |
2906 | ev_embed *w = (ev_embed *)(((char *)fork_w) - offsetof (ev_embed, fork)); |
2908 | ev_embed *w = (ev_embed *)(((char *)fork_w) - offsetof (ev_embed, fork)); |
2907 | |
2909 | |
|
|
2910 | ev_embed_stop (EV_A_ w); |
|
|
2911 | |
2908 | { |
2912 | { |
2909 | struct ev_loop *loop = w->other; |
2913 | struct ev_loop *loop = w->other; |
2910 | |
2914 | |
2911 | ev_loop_fork (EV_A); |
2915 | ev_loop_fork (EV_A); |
|
|
2916 | ev_loop (EV_A_ EVLOOP_NONBLOCK); |
2912 | } |
2917 | } |
|
|
2918 | |
|
|
2919 | ev_embed_start (EV_A_ w); |
2913 | } |
2920 | } |
2914 | |
2921 | |
2915 | #if 0 |
2922 | #if 0 |
2916 | static void |
2923 | static void |
2917 | embed_idle_cb (EV_P_ ev_idle *idle, int revents) |
2924 | embed_idle_cb (EV_P_ ev_idle *idle, int revents) |