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

Comparing libev/ev.c (file contents):
Revision 1.318 by root, Tue Nov 17 00:22:28 2009 UTC vs.
Revision 1.320 by root, Fri Dec 4 20:25:06 2009 UTC

153 153
154#endif 154#endif
155 155
156#include <math.h> 156#include <math.h>
157#include <stdlib.h> 157#include <stdlib.h>
158#include <string.h>
158#include <fcntl.h> 159#include <fcntl.h>
159#include <stddef.h> 160#include <stddef.h>
160 161
161#include <stdio.h> 162#include <stdio.h>
162 163
3100static void noinline 3101static void noinline
3101stat_timer_cb (EV_P_ ev_timer *w_, int revents) 3102stat_timer_cb (EV_P_ ev_timer *w_, int revents)
3102{ 3103{
3103 ev_stat *w = (ev_stat *)(((char *)w_) - offsetof (ev_stat, timer)); 3104 ev_stat *w = (ev_stat *)(((char *)w_) - offsetof (ev_stat, timer));
3104 3105
3105 /* we copy this here each the time so that */ 3106 ev_statdata prev = w->attr;
3106 /* prev has the old value when the callback gets invoked */
3107 w->prev = w->attr;
3108 ev_stat_stat (EV_A_ w); 3107 ev_stat_stat (EV_A_ w);
3109 3108
3110 /* memcmp doesn't work on netbsd, they.... do stuff to their struct stat */ 3109 /* memcmp doesn't work on netbsd, they.... do stuff to their struct stat */
3111 if ( 3110 if (
3112 w->prev.st_dev != w->attr.st_dev 3111 prev.st_dev != w->attr.st_dev
3113 || w->prev.st_ino != w->attr.st_ino 3112 || prev.st_ino != w->attr.st_ino
3114 || w->prev.st_mode != w->attr.st_mode 3113 || prev.st_mode != w->attr.st_mode
3115 || w->prev.st_nlink != w->attr.st_nlink 3114 || prev.st_nlink != w->attr.st_nlink
3116 || w->prev.st_uid != w->attr.st_uid 3115 || prev.st_uid != w->attr.st_uid
3117 || w->prev.st_gid != w->attr.st_gid 3116 || prev.st_gid != w->attr.st_gid
3118 || w->prev.st_rdev != w->attr.st_rdev 3117 || prev.st_rdev != w->attr.st_rdev
3119 || w->prev.st_size != w->attr.st_size 3118 || prev.st_size != w->attr.st_size
3120 || w->prev.st_atime != w->attr.st_atime 3119 || prev.st_atime != w->attr.st_atime
3121 || w->prev.st_mtime != w->attr.st_mtime 3120 || prev.st_mtime != w->attr.st_mtime
3122 || w->prev.st_ctime != w->attr.st_ctime 3121 || prev.st_ctime != w->attr.st_ctime
3123 ) { 3122 ) {
3123 /* we only update w->prev on actual differences */
3124 /* in case we test more often than invoke the callback, */
3125 /* to ensure that prev is always different to attr */
3126 w->prev = prev;
3127
3124 #if EV_USE_INOTIFY 3128 #if EV_USE_INOTIFY
3125 if (fs_fd >= 0) 3129 if (fs_fd >= 0)
3126 { 3130 {
3127 infy_del (EV_A_ w); 3131 infy_del (EV_A_ w);
3128 infy_add (EV_A_ w); 3132 infy_add (EV_A_ w);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines