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

Comparing libev/ev.c (file contents):
Revision 1.268 by root, Mon Oct 27 13:39:18 2008 UTC vs.
Revision 1.271 by root, Mon Nov 3 12:13:15 2008 UTC

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
388{ 389{
389 syserr_cb = cb; 390 syserr_cb = cb;
390} 391}
391 392
392static void noinline 393static void noinline
393syserr (const char *msg) 394ev_syserr (const char *msg)
394{ 395{
395 if (!msg) 396 if (!msg)
396 msg = "(libev) system error"; 397 msg = "(libev) system error";
397 398
398 if (syserr_cb) 399 if (syserr_cb)
450{ 451{
451 WL head; 452 WL head;
452 unsigned char events; 453 unsigned char events;
453 unsigned char reify; 454 unsigned char reify;
454 unsigned char emask; /* the epoll backend stores the actual kernel mask in here */ 455 unsigned char emask; /* the epoll backend stores the actual kernel mask in here */
456 unsigned char unused;
457#if EV_USE_EPOLL
455 unsigned char egen; /* generation counter to counter epoll bugs */ 458 unsigned int egen; /* generation counter to counter epoll bugs */
459#endif
456#if EV_SELECT_IS_WINSOCKET 460#if EV_SELECT_IS_WINSOCKET
457 SOCKET handle; 461 SOCKET handle;
458#endif 462#endif
459} ANFD; 463} ANFD;
460 464
998 } 1002 }
999 else 1003 else
1000#endif 1004#endif
1001 { 1005 {
1002 while (pipe (evpipe)) 1006 while (pipe (evpipe))
1003 syserr ("(libev) error creating signal/async pipe"); 1007 ev_syserr ("(libev) error creating signal/async pipe");
1004 1008
1005 fd_intern (evpipe [0]); 1009 fd_intern (evpipe [0]);
1006 fd_intern (evpipe [1]); 1010 fd_intern (evpipe [1]);
1007 ev_io_set (&pipeev, evpipe [0], EV_READ); 1011 ev_io_set (&pipeev, evpipe [0], EV_READ);
1008 } 1012 }
1656{ 1660{
1657#if EV_MULTIPLICITY 1661#if EV_MULTIPLICITY
1658 struct ev_loop *loop = ev_default_loop_ptr; 1662 struct ev_loop *loop = ev_default_loop_ptr;
1659#endif 1663#endif
1660 1664
1661 if (backend)
1662 postfork = 1; /* must be in line with ev_loop_fork */ 1665 postfork = 1; /* must be in line with ev_loop_fork */
1663} 1666}
1664 1667
1665/*****************************************************************************/ 1668/*****************************************************************************/
1666 1669
1667void 1670void
2430 if (w->wd < 0) 2433 if (w->wd < 0)
2431 { 2434 {
2432 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 */
2433 2436
2434 /* monitor some parent directory for speedup hints */ 2437 /* monitor some parent directory for speedup hints */
2435 /* note that exceeding the hardcoded limit is not a correctness issue, */ 2438 /* note that exceeding the hardcoded path limit is not a correctness issue, */
2436 /* but an efficiency issue only */ 2439 /* but an efficiency issue only */
2437 if ((errno == ENOENT || errno == EACCES) && strlen (w->path) < 4096) 2440 if ((errno == ENOENT || errno == EACCES) && strlen (w->path) < 4096)
2438 { 2441 {
2439 char path [4096]; 2442 char path [4096];
2440 strcpy (path, w->path); 2443 strcpy (path, w->path);
2454 } 2457 }
2455 while (w->wd < 0 && (errno == ENOENT || errno == EACCES)); 2458 while (w->wd < 0 && (errno == ENOENT || errno == EACCES));
2456 } 2459 }
2457 } 2460 }
2458 else 2461 else
2462 todo, on nfs etc., we need to poll every 60s or so
2459 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 */
2460 2464
2461 if (w->wd >= 0) 2465 if (w->wd >= 0)
2462 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);
2463} 2467}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines