… | |
… | |
357 | |
357 | |
358 | #ifndef EV_HEAP_CACHE_AT |
358 | #ifndef EV_HEAP_CACHE_AT |
359 | # define EV_HEAP_CACHE_AT EV_FEATURE_DATA |
359 | # define EV_HEAP_CACHE_AT EV_FEATURE_DATA |
360 | #endif |
360 | #endif |
361 | |
361 | |
|
|
362 | #ifdef ANDROID |
|
|
363 | /* supposedly, android doesn't typedef fd_mask */ |
|
|
364 | # undef EV_USE_SELECT |
|
|
365 | # define EV_USE_SELECT 0 |
|
|
366 | /* supposedly, we need to include syscall.h, not sys/syscall.h, so just disable */ |
|
|
367 | # undef EV_USE_CLOCK_SYSCALL |
|
|
368 | # define EV_USE_CLOCK_SYSCALL 0 |
|
|
369 | #endif |
|
|
370 | |
|
|
371 | /* aix's poll.h seems to cause lots of trouble */ |
|
|
372 | #ifdef _AIX |
|
|
373 | /* AIX has a completely broken poll.h header */ |
|
|
374 | # undef EV_USE_POLL |
|
|
375 | # define EV_USE_POLL 0 |
|
|
376 | #endif |
|
|
377 | |
362 | /* on linux, we can use a (slow) syscall to avoid a dependency on pthread, */ |
378 | /* on linux, we can use a (slow) syscall to avoid a dependency on pthread, */ |
363 | /* which makes programs even slower. might work on other unices, too. */ |
379 | /* which makes programs even slower. might work on other unices, too. */ |
364 | #if EV_USE_CLOCK_SYSCALL |
380 | #if EV_USE_CLOCK_SYSCALL |
365 | # include <sys/syscall.h> |
381 | # include <sys/syscall.h> |
366 | # ifdef SYS_clock_gettime |
382 | # ifdef SYS_clock_gettime |
… | |
… | |
372 | # define EV_USE_CLOCK_SYSCALL 0 |
388 | # define EV_USE_CLOCK_SYSCALL 0 |
373 | # endif |
389 | # endif |
374 | #endif |
390 | #endif |
375 | |
391 | |
376 | /* this block fixes any misconfiguration where we know we run into trouble otherwise */ |
392 | /* this block fixes any misconfiguration where we know we run into trouble otherwise */ |
377 | |
|
|
378 | #ifdef _AIX |
|
|
379 | /* AIX has a completely broken poll.h header */ |
|
|
380 | # undef EV_USE_POLL |
|
|
381 | # define EV_USE_POLL 0 |
|
|
382 | #endif |
|
|
383 | |
393 | |
384 | #ifndef CLOCK_MONOTONIC |
394 | #ifndef CLOCK_MONOTONIC |
385 | # undef EV_USE_MONOTONIC |
395 | # undef EV_USE_MONOTONIC |
386 | # define EV_USE_MONOTONIC 0 |
396 | # define EV_USE_MONOTONIC 0 |
387 | #endif |
397 | #endif |
… | |
… | |
3893 | # define EV_INOTIFY_BUFSIZE (sizeof (struct inotify_event) * 2 + NAME_MAX) |
3903 | # define EV_INOTIFY_BUFSIZE (sizeof (struct inotify_event) * 2 + NAME_MAX) |
3894 | |
3904 | |
3895 | static void noinline |
3905 | static void noinline |
3896 | infy_add (EV_P_ ev_stat *w) |
3906 | infy_add (EV_P_ ev_stat *w) |
3897 | { |
3907 | { |
3898 | w->wd = inotify_add_watch (fs_fd, w->path, IN_ATTRIB | IN_DELETE_SELF | IN_MOVE_SELF | IN_MODIFY | IN_DONT_FOLLOW | IN_MASK_ADD); |
3908 | w->wd = inotify_add_watch (fs_fd, w->path, |
|
|
3909 | IN_ATTRIB | IN_DELETE_SELF | IN_MOVE_SELF | IN_MODIFY |
|
|
3910 | | IN_CREATE | IN_DELETE | IN_MOVED_FROM | IN_MOVED_TO |
|
|
3911 | | IN_DONT_FOLLOW | IN_MASK_ADD); |
3899 | |
3912 | |
3900 | if (w->wd >= 0) |
3913 | if (w->wd >= 0) |
3901 | { |
3914 | { |
3902 | struct statfs sfs; |
3915 | struct statfs sfs; |
3903 | |
3916 | |
… | |
… | |
3907 | |
3920 | |
3908 | if (!fs_2625) |
3921 | if (!fs_2625) |
3909 | w->timer.repeat = w->interval ? w->interval : DEF_STAT_INTERVAL; |
3922 | w->timer.repeat = w->interval ? w->interval : DEF_STAT_INTERVAL; |
3910 | else if (!statfs (w->path, &sfs) |
3923 | else if (!statfs (w->path, &sfs) |
3911 | && (sfs.f_type == 0x1373 /* devfs */ |
3924 | && (sfs.f_type == 0x1373 /* devfs */ |
|
|
3925 | || sfs.f_type == 0x4006 /* fat */ |
|
|
3926 | || sfs.f_type == 0x4d44 /* msdos */ |
3912 | || sfs.f_type == 0xEF53 /* ext2/3 */ |
3927 | || sfs.f_type == 0xEF53 /* ext2/3 */ |
|
|
3928 | || sfs.f_type == 0x72b6 /* jffs2 */ |
|
|
3929 | || sfs.f_type == 0x858458f6 /* ramfs */ |
|
|
3930 | || sfs.f_type == 0x5346544e /* ntfs */ |
3913 | || sfs.f_type == 0x3153464a /* jfs */ |
3931 | || sfs.f_type == 0x3153464a /* jfs */ |
|
|
3932 | || sfs.f_type == 0x9123683e /* btrfs */ |
3914 | || sfs.f_type == 0x52654973 /* reiser3 */ |
3933 | || sfs.f_type == 0x52654973 /* reiser3 */ |
3915 | || sfs.f_type == 0x01021994 /* tempfs */ |
3934 | || sfs.f_type == 0x01021994 /* tmpfs */ |
3916 | || sfs.f_type == 0x58465342 /* xfs */)) |
3935 | || sfs.f_type == 0x58465342 /* xfs */)) |
3917 | w->timer.repeat = 0.; /* filesystem is local, kernel new enough */ |
3936 | w->timer.repeat = 0.; /* filesystem is local, kernel new enough */ |
3918 | else |
3937 | else |
3919 | w->timer.repeat = w->interval ? w->interval : NFS_STAT_INTERVAL; /* remote, use reduced frequency */ |
3938 | w->timer.repeat = w->interval ? w->interval : NFS_STAT_INTERVAL; /* remote, use reduced frequency */ |
3920 | } |
3939 | } |