ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.h
(Generate patch)

Comparing libev/ev.h (file contents):
Revision 1.73 by root, Tue Nov 27 19:41:52 2007 UTC vs.
Revision 1.76 by root, Thu Nov 29 17:28:13 2007 UTC

64# define EV_EMBED_ENABLE 1 64# define EV_EMBED_ENABLE 1
65#endif 65#endif
66 66
67/*****************************************************************************/ 67/*****************************************************************************/
68 68
69#include <stddef.h> /* for size_t */
70
71#if EV_STAT_ENABLE 69#if EV_STAT_ENABLE
72# include <sys/stat.h> 70# include <sys/stat.h>
73#endif 71#endif
74 72
75/* support multiple event loops? */ 73/* support multiple event loops? */
218 int rstatus; /* rw, holds the exit status, use the macros from sys/wait.h */ 216 int rstatus; /* rw, holds the exit status, use the macros from sys/wait.h */
219} ev_child; 217} ev_child;
220 218
221#if EV_STAT_ENABLE 219#if EV_STAT_ENABLE
222/* st_nlink = 0 means missing file or other error */ 220/* st_nlink = 0 means missing file or other error */
223#ifdef _WIN32 221# ifdef _WIN32
224typedef struct _stati64 ev_statdata; 222typedef struct _stati64 ev_statdata;
225#else 223# else
226typedef struct stat ev_statdata; 224typedef struct stat ev_statdata;
227#endif 225# endif
228 226
229/* invoked each time the stat data changes for a given path */ 227/* invoked each time the stat data changes for a given path */
230/* revent EV_STAT */ 228/* revent EV_STAT */
231typedef struct ev_stat 229typedef struct ev_stat
232{ 230{
233 EV_WATCHER (ev_stat) 231 EV_WATCHER_LIST (ev_stat)
234 232
235 ev_timer timer; /* private */ 233 ev_timer timer; /* private */
236 ev_tstamp interval; /* ro */ 234 ev_tstamp interval; /* ro */
237 const char *path; /* ro */ 235 const char *path; /* ro */
238 ev_statdata prev; /* ro */ 236 ev_statdata prev; /* ro */
239 ev_statdata attr; /* ro */ 237 ev_statdata attr; /* ro */
238
239 int wd; /* wd for inotify, fd for kqueue */
240} ev_stat; 240} ev_stat;
241#endif 241#endif
242 242
243/* invoked when the nothing else needs to be done, keeps the process from blocking */ 243/* invoked when the nothing else needs to be done, keeps the process from blocking */
244/* revent EV_IDLE */ 244/* revent EV_IDLE */
310/* bits for ev_default_loop and ev_loop_new */ 310/* bits for ev_default_loop and ev_loop_new */
311/* the default */ 311/* the default */
312#define EVFLAG_AUTO 0x00000000UL /* not quite a mask */ 312#define EVFLAG_AUTO 0x00000000UL /* not quite a mask */
313/* flag bits */ 313/* flag bits */
314#define EVFLAG_NOENV 0x01000000UL /* do NOT consult environment */ 314#define EVFLAG_NOENV 0x01000000UL /* do NOT consult environment */
315#define EVFLAG_FORKCHECK 0x02000000UL /* check for a fork in each iteration */
315/* method bits to be ored together */ 316/* method bits to be ored together */
316#define EVBACKEND_SELECT 0x00000001UL /* about anywhere */ 317#define EVBACKEND_SELECT 0x00000001UL /* about anywhere */
317#define EVBACKEND_POLL 0x00000002UL /* !win */ 318#define EVBACKEND_POLL 0x00000002UL /* !win */
318#define EVBACKEND_EPOLL 0x00000004UL /* linux */ 319#define EVBACKEND_EPOLL 0x00000004UL /* linux */
319#define EVBACKEND_KQUEUE 0x00000008UL /* bsd */ 320#define EVBACKEND_KQUEUE 0x00000008UL /* bsd */
334 * It is used to allocate and free memory. 335 * It is used to allocate and free memory.
335 * If it returns zero when memory needs to be allocated, the library might abort 336 * If it returns zero when memory needs to be allocated, the library might abort
336 * or take some potentially destructive action. 337 * or take some potentially destructive action.
337 * The default is your system realloc function. 338 * The default is your system realloc function.
338 */ 339 */
339void ev_set_allocator (void *(*cb)(void *ptr, size_t size)); 340void ev_set_allocator (void *(*cb)(void *ptr, long size));
340 341
341/* set the callback function to call on a 342/* set the callback function to call on a
342 * retryable syscall error 343 * retryable syscall error
343 * (such as failed select, poll, epoll_wait) 344 * (such as failed select, poll, epoll_wait)
344 */ 345 */
424#define ev_io_set(ev,fd_,events_) do { (ev)->fd = (fd_); (ev)->events = (events_); } while (0) 425#define ev_io_set(ev,fd_,events_) do { (ev)->fd = (fd_); (ev)->events = (events_); } while (0)
425#define ev_timer_set(ev,after_,repeat_) do { (ev)->at = (after_); (ev)->repeat = (repeat_); } while (0) 426#define ev_timer_set(ev,after_,repeat_) do { (ev)->at = (after_); (ev)->repeat = (repeat_); } while (0)
426#define ev_periodic_set(ev,at_,ival_,res_) do { (ev)->at = (at_); (ev)->interval = (ival_); (ev)->reschedule_cb= (res_); } while (0) 427#define ev_periodic_set(ev,at_,ival_,res_) do { (ev)->at = (at_); (ev)->interval = (ival_); (ev)->reschedule_cb= (res_); } while (0)
427#define ev_signal_set(ev,signum_) do { (ev)->signum = (signum_); } while (0) 428#define ev_signal_set(ev,signum_) do { (ev)->signum = (signum_); } while (0)
428#define ev_child_set(ev,pid_) do { (ev)->pid = (pid_); } while (0) 429#define ev_child_set(ev,pid_) do { (ev)->pid = (pid_); } while (0)
429#define ev_stat_set(ev,path_,interval_) do { (ev)->path = (path_); (ev)->interval = (interval_); } while (0) 430#define ev_stat_set(ev,path_,interval_) do { (ev)->path = (path_); (ev)->interval = (interval_); (ev)->wd = -2; } while (0)
430#define ev_idle_set(ev) /* nop, yes, this is a serious in-joke */ 431#define ev_idle_set(ev) /* nop, yes, this is a serious in-joke */
431#define ev_prepare_set(ev) /* nop, yes, this is a serious in-joke */ 432#define ev_prepare_set(ev) /* nop, yes, this is a serious in-joke */
432#define ev_check_set(ev) /* nop, yes, this is a serious in-joke */ 433#define ev_check_set(ev) /* nop, yes, this is a serious in-joke */
433#define ev_embed_set(ev,loop_) do { (ev)->loop = (loop_); } while (0) 434#define ev_embed_set(ev,loop_) do { (ev)->loop = (loop_); } while (0)
434#define ev_fork_set(ev) /* nop, yes, this is a serious in-joke */ 435#define ev_fork_set(ev) /* nop, yes, this is a serious in-joke */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines