Changeset 481 for trunk/src/sh_inotify.c


Ignore:
Timestamp:
Jul 18, 2015, 5:06:52 PM (9 years ago)
Author:
katerina
Message:

Enhancements and fixes for tickets #374, #375, #376, #377, #378, and #379.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_inotify.c

    r474 r481  
    135135  int    class;
    136136  int    rdepth;
    137   unsigned long check_mask;
     137  unsigned long check_flags;
    138138  char * file;
    139139} sh_watch;
     
    236236  int     ifd = sh_inotify_getfd();
    237237
    238   len = sl_read_timeout_fd (ifd, buffer, count, timeout, SL_FALSE);
     238  len = sl_read_timeout_fd (ifd, buffer, count, timeout, S_FALSE);
    239239
    240240  return len;
     
    364364
    365365char * sh_inotify_pop_dormant(sh_watches * watches,
    366                               int * class, unsigned long * check_mask,
     366                              int * class, unsigned long * check_flags,
    367367                              int * type, int * rdepth)
    368368{
     
    384384      *type   = this->watch->type;
    385385      *rdepth = this->watch->rdepth;
    386       *check_mask = this->watch->check_mask;
     386      *check_flags = this->watch->check_flags;
    387387      popret  = sh_util_strdup_track(this->watch->file, __FILE__, __LINE__);
    388388
     
    424424static zAVLKey sh_inotify_getkey(void const *item)
    425425{
    426   return (&((sh_watch *)item)->watch);
     426  return (&((const sh_watch *)item)->watch);
    427427}
    428428
     
    490490int sh_inotify_add_watch_later(const char * filename, sh_watches * watches,
    491491                               int * errnum,
    492                                int class, unsigned long check_mask, int type,
     492                               int class, unsigned long check_flags, int type,
    493493                               int rdepth)
    494494{
     
    500500  item->type       = (short) type;
    501501  item->rdepth     = (short) rdepth;
    502   item->check_mask = check_mask;
     502  item->check_flags = check_flags;
    503503
    504504  sh_inotify_add_dormant(watches, item);
     
    548548
    549549  extern void sh_fInotify_report_add(char * path,
    550                                      int class, unsigned long check_mask);
     550                                     int class, unsigned long check_flags);
    551551
    552552  sh_dummy_litem = (void*) &litem;
     
    575575              SH_MUTEX_UNLOCK(mutex_watches);
    576576
    577               sh_fInotify_report_add(litem->file, litem->class, litem->check_mask);
     577              sh_fInotify_report_add(litem->file, litem->class, litem->check_flags);
    578578
    579579              litem = sh_inotify_list_del_cur(&listcursor, save);
     
    592592 */
    593593int sh_inotify_add_watch(char * filename, sh_watches * watches, int * errnum,
    594                          int class, unsigned long check_mask, int type, int rdepth)
     594                         int class, unsigned long check_flags, int type, int rdepth)
    595595{
    596596  volatile int retval = 0;
     
    637637          item->type       = type;
    638638          item->rdepth     = rdepth;
    639           item->check_mask = check_mask;
     639          item->check_flags = check_flags;
    640640         
    641641          if (NULL == watches->list_of_watches)
     
    692692
    693693char * sh_inotify_search_item(sh_watches * watches, int watch,
    694                               int * class, unsigned long * check_mask,
     694                              int * class, unsigned long * check_flags,
    695695                              int * type, int * rdepth)
    696696{
     
    709709    {
    710710      *class      = item->class;
    711       *check_mask = item->check_mask;
     711      *check_flags = item->check_flags;
    712712      *type       = item->type;
    713713      *rdepth     = item->rdepth;
     
    882882
    883883int sh_inotify_add_watch(char * filename, sh_watches * watches, int  * errnum,
    884                          int class, unsigned long check_mask, int type, int rdepth)
     884                         int class, unsigned long check_flags, int type, int rdepth)
    885885{
    886886  (void) filename;
    887887  (void) watches;
    888888  (void) class;
    889   (void) check_mask;
     889  (void) check_flags;
    890890  (void) type;
    891891  (void) rdepth;
     
    898898int sh_inotify_add_watch_later(const char * filename, sh_watches * watches,
    899899                               int  * errnum,
    900                                int class, unsigned long check_mask, int type, int rdepth)
     900                               int class, unsigned long check_flags, int type, int rdepth)
    901901{
    902902  (void) filename;
    903903  (void) watches;
    904904  (void) class;
    905   (void) check_mask;
     905  (void) check_flags;
    906906  (void) type;
    907907  (void) rdepth;
     
    927927  int type;
    928928  int rdepth;
    929   unsigned long check_mask;
     929  unsigned long check_flags;
    930930  int           nrun = 0;
    931931
     
    10221022    CuAssertIntEquals(tc, count, 5);
    10231023   
    1024     p = sh_inotify_pop_dormant(&twatch, &class, &check_mask, &type, &rdepth);
     1024    p = sh_inotify_pop_dormant(&twatch, &class, &check_flags, &type, &rdepth);
    10251025    CuAssertStrEquals(tc, p, "a5");
    10261026   
    1027     p = sh_inotify_pop_dormant(&twatch, &class, &check_mask, &type, &rdepth);
     1027    p = sh_inotify_pop_dormant(&twatch, &class, &check_flags, &type, &rdepth);
    10281028    CuAssertStrEquals(tc, p, "a3");
    10291029    CuAssertIntEquals(tc, class, 3);
    10301030   
    1031     p = sh_inotify_pop_dormant(&twatch, &class, &check_mask, &type, &rdepth);
     1031    p = sh_inotify_pop_dormant(&twatch, &class, &check_flags, &type, &rdepth);
    10321032    CuAssertTrue(tc, NULL == p);
    10331033    CuAssertTrue(tc, NULL == twatch.dormant_watches);
Note: See TracChangeset for help on using the changeset viewer.