Changeset 371 for trunk/src/sh_inotify.c
- Timestamp:
- Oct 31, 2011, 9:42:22 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_inotify.c
r369 r371 213 213 ssize_t sh_inotify_read(char * buffer, size_t count) 214 214 { 215 ssize_t len = -1; 216 int ifd = sh_inotify_getfd(); 217 218 do { 219 len = read (ifd, buffer, count); 220 } while (len < 0 && (errno == EINTR || errno == EAGAIN)); 221 222 return len; 223 } 224 225 ssize_t sh_inotify_read_timeout(char * buffer, size_t count, int timeout) 226 { 215 227 ssize_t len; 216 228 int ifd = sh_inotify_getfd(); 217 229 218 do { 219 len = read (ifd, buffer, count); 220 } while (len < 0 || errno == EINTR); 230 len = sl_read_timeout_fd (ifd, buffer, count, timeout, SL_FALSE); 221 231 222 232 return len; 223 233 } 234 224 235 225 236 static void sh_inotify_free_watch(void * item) … … 287 298 { 288 299 listcursor->curnode = listcursor->curnode->next; 289 return listcursor->curnode->watch; 300 if (listcursor->curnode) 301 return listcursor->curnode->watch; 302 else 303 return NULL; 290 304 } 291 305 … … 512 526 int ifd = sh_get_inotify_fd(); 513 527 514 extern void sh_fInotify_report_add(char * path, int class, unsigned long check_mask); 528 extern void sh_fInotify_report_add(char * path, 529 int class, unsigned long check_mask); 515 530 516 531 sh_dummy_litem = (void*) &litem; … … 520 535 SH_MUTEX_LOCK(mutex_list_dormant); 521 536 522 for (litem = sh_inotify_list_first(&listcursor, save); litem; 523 litem = sh_inotify_list_next(&listcursor, save)) 537 litem = sh_inotify_list_first(&listcursor, save); 538 539 while (litem) 524 540 { 525 541 have_next: … … 545 561 } 546 562 } 563 litem = sh_inotify_list_next(&listcursor, save); 547 564 } 548 565 SH_MUTEX_UNLOCK(mutex_list_dormant); … … 725 742 /* -- Blocking read on inotify file descriptor 726 743 */ 727 sh_inotify_read(buffer, sizeof(buffer));744 len = sh_inotify_read(buffer, sizeof(buffer)); 728 745 729 746 if (len > 0)
Note:
See TracChangeset
for help on using the changeset viewer.