Changeset 371 for trunk/src/sh_fInotify.c
- Timestamp:
- Oct 31, 2011, 9:42:22 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_fInotify.c
r368 r371 143 143 } 144 144 } 145 else if (arg != NULL && arg->initval < 0 && 146 (sh.flag.isdaemon != S_TRUE && sh.flag.loop != S_TRUE)) 147 { 148 sh.flag.inotify = 0; 149 return SH_MOD_FAILED; 150 } 145 151 else if (arg != NULL && arg->initval == SH_MOD_THREAD && 146 152 (sh.flag.isdaemon == S_TRUE || sh.flag.loop == S_TRUE)) … … 162 168 ssize_t len = -1; 163 169 char * buffer = SH_ALLOC(16384); 170 static int count = 0; 164 171 165 172 if (ShfInotifyActive == S_FALSE) … … 175 182 /* Blocking read from inotify file descriptor. 176 183 */ 177 len = sh_inotify_read (buffer, 16384);184 len = sh_inotify_read_timeout(buffer, 16384, 1); 178 185 179 186 if (len > 0) … … 203 210 */ 204 211 sh_inotify_recheck_watches (&sh_file_watches, &sh_file_missing); 212 213 ++count; 214 215 if (count >= 10) 216 { 217 count = 0; /* Re-expand glob patterns to discover added files */ 218 sh_files_check_globFilePatterns(); 219 } 205 220 206 221 return 0; … … 274 289 SH_MUTEX_LOCK(mutex_thread_nolog); 275 290 sh_error_handle((-1), FIL__, __LINE__, 0, MSG_E_SUBGEN, 276 _("Cannot set max_user_watches"), _("sh_fInotify_set_nwatches")); 291 _("Cannot set max_user_watches"), 292 _("sh_fInotify_set_nwatches")); 277 293 SH_MUTEX_UNLOCK(mutex_thread_nolog); 278 294 return; … … 353 369 unsigned long check_mask; 354 370 char * filename; 371 extern int flag_err_debug; 372 373 if (flag_err_debug == SL_TRUE) 374 { 375 char dbgbuf[256]; 376 sl_strlcpy (dbgbuf, "inotify mask: ", sizeof(dbgbuf)); 377 if (event->mask & IN_ACCESS) sl_strlcat(dbgbuf, "IN_ACCESS ", sizeof(dbgbuf)); 378 if (event->mask & IN_ATTRIB) sl_strlcat(dbgbuf, "IN_ATTRIB ", sizeof(dbgbuf)); 379 if (event->mask & IN_CLOSE_WRITE) sl_strlcat(dbgbuf, "IN_CLOSE_WRITE ", sizeof(dbgbuf)); 380 if (event->mask & IN_CLOSE_NOWRITE) sl_strlcat(dbgbuf, "IN_CLOSE_NOWRITE ", sizeof(dbgbuf)); 381 if (event->mask & IN_CREATE) sl_strlcat(dbgbuf, "IN_CREATE ", sizeof(dbgbuf)); 382 if (event->mask & IN_DELETE) sl_strlcat(dbgbuf, "IN_DELETE ", sizeof(dbgbuf)); 383 if (event->mask & IN_DELETE_SELF) sl_strlcat(dbgbuf, "IN_DELETE_SELF ", sizeof(dbgbuf)); 384 if (event->mask & IN_MODIFY) sl_strlcat(dbgbuf, "IN_MODIFY ", sizeof(dbgbuf)); 385 if (event->mask & IN_MOVE_SELF) sl_strlcat(dbgbuf, "IN_MOVE_SELF ", sizeof(dbgbuf)); 386 if (event->mask & IN_MOVED_FROM) sl_strlcat(dbgbuf, "IN_MOVED_FROM ", sizeof(dbgbuf)); 387 if (event->mask & IN_MOVED_TO) sl_strlcat(dbgbuf, "IN_MOVED_TO ", sizeof(dbgbuf)); 388 if (event->mask & IN_OPEN) sl_strlcat(dbgbuf, "IN_OPEN ", sizeof(dbgbuf)); 389 if (event->mask & IN_IGNORED) sl_strlcat(dbgbuf, "IN_IGNORED ", sizeof(dbgbuf)); 390 if (event->mask & IN_ISDIR) sl_strlcat(dbgbuf, "IN_ISDIR ", sizeof(dbgbuf)); 391 if (event->mask & IN_Q_OVERFLOW) sl_strlcat(dbgbuf, "IN_Q_OVERFLOW ", sizeof(dbgbuf)); 392 if (event->mask & IN_UNMOUNT) sl_strlcat(dbgbuf, "IN_UNMOUNT ", sizeof(dbgbuf)); 393 SH_MUTEX_LOCK(mutex_thread_nolog); 394 sh_error_handle(SH_ERR_ALL, FIL__, __LINE__, 0, MSG_E_SUBGEN, 395 dbgbuf, _("sh_fInotify_process")); 396 SH_MUTEX_UNLOCK(mutex_thread_nolog); 397 } 398 355 399 356 400 if (event->wd >= 0) … … 438 482 } 439 483 440 if ( (event->mask & (IN_A CCESS|IN_MODIFY)) != 0)484 if ( (event->mask & (IN_ATTRIB|IN_MODIFY)) != 0) 441 485 { 442 486 sh_files_search_file(path, &class, &check_mask, &reported); … … 477 521 if (S_FALSE == sh_ignore_chk_new(path)) 478 522 { 523 int ret; 524 479 525 sh_files_clear_file_reported(path); 480 526 481 sh_files_search_file(path, &class, &check_mask, &reported);527 ret = sh_files_search_file(path, &class, &check_mask, &reported); 482 528 483 529 sh_files_filecheck (class, check_mask, filename, … … 486 532 if (SH_FFLAG_REPORTED_SET(reported)) 487 533 sh_files_set_file_reported(path); 534 535 if (ret != 0) 536 { 537 sh_inotify_add_watch(path, &sh_file_watches, &ret, 538 class, check_mask); 539 } 488 540 } 489 541 }
Note:
See TracChangeset
for help on using the changeset viewer.