/*****************************************************************************/
-#include <stddef.h> /* for size_t */
-
#if EV_STAT_ENABLE
# include <sys/stat.h>
#endif
#if EV_STAT_ENABLE
/* st_nlink = 0 means missing file or other error */
-#ifdef _WIN32
+# ifdef _WIN32
typedef struct _stati64 ev_statdata;
-#else
+# else
typedef struct stat ev_statdata;
-#endif
+# endif
/* invoked each time the stat data changes for a given path */
/* revent EV_STAT */
typedef struct ev_stat
{
- EV_WATCHER (ev_stat)
+ EV_WATCHER_LIST (ev_stat)
ev_timer timer; /* private */
ev_tstamp interval; /* ro */
const char *path; /* ro */
ev_statdata prev; /* ro */
ev_statdata attr; /* ro */
+
+ int wd; /* wd for inotify, fd for kqueue */
} ev_stat;
#endif
#define EVFLAG_AUTO 0x00000000UL /* not quite a mask */
/* flag bits */
#define EVFLAG_NOENV 0x01000000UL /* do NOT consult environment */
+#define EVFLAG_FORKCHECK 0x02000000UL /* check for a fork in each iteration */
/* method bits to be ored together */
#define EVBACKEND_SELECT 0x00000001UL /* about anywhere */
#define EVBACKEND_POLL 0x00000002UL /* !win */
* or take some potentially destructive action.
* The default is your system realloc function.
*/
-void ev_set_allocator (void *(*cb)(void *ptr, size_t size));
+void ev_set_allocator (void *(*cb)(void *ptr, long size));
/* set the callback function to call on a
* retryable syscall error
void ev_default_fork (void);
unsigned int ev_backend (EV_P);
+unsigned int ev_loop_count (EV_P);
#endif
#define EVLOOP_NONBLOCK 1 /* do not block/wait */
#define ev_periodic_set(ev,at_,ival_,res_) do { (ev)->at = (at_); (ev)->interval = (ival_); (ev)->reschedule_cb= (res_); } while (0)
#define ev_signal_set(ev,signum_) do { (ev)->signum = (signum_); } while (0)
#define ev_child_set(ev,pid_) do { (ev)->pid = (pid_); } while (0)
-#define ev_stat_set(ev,path_,interval_) do { (ev)->path = (path_); (ev)->interval = (interval_); } while (0)
+#define ev_stat_set(ev,path_,interval_) do { (ev)->path = (path_); (ev)->interval = (interval_); (ev)->wd = -2; } while (0)
#define ev_idle_set(ev) /* nop, yes, this is a serious in-joke */
#define ev_prepare_set(ev) /* nop, yes, this is a serious in-joke */
#define ev_check_set(ev) /* nop, yes, this is a serious in-joke */