pike.git / lib / modules / Filesystem.pmod / Monitor.pmod / basic.pike

version» Context lines:

pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:10:   //!   //! This module is intended to be used for incremental scanning of   //! a filesystem.   //!   //! Supports FSEvents on MacOS X and Inotify on Linux to provide low overhead monitoring; other   //! systems use a less efficient polling approach.      //   // some necessary setup activities for systems that provide filesystem event monitoring   // - #if constant(Public.System.FSEvents.EventStream) + #if constant(System.FSEvents.EventStream)   #define HAVE_EVENTSTREAM 1   #endif    - #if constant(Public.System.___Inotify) + #if constant(System.Inotify)   #define HAVE_INOTIFY 1   #endif      #if HAVE_EVENTSTREAM    System.FSEvents.EventStream eventstream = System.FSEvents.EventStream(({}), 3.0, System.FSEvents.kFSEventStreamEventIdSinceNow, System.FSEvents.kFSEventStreamCreateFlagNone);    array eventstream_paths = ({});       // This function is called when the FSEvents EventStream detects a change in one of the monitored directories.    void eventstream_callback(string path, int flags, int event_id)    {
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:258: Inside #if HAVE_EVENTSTREAM
   already_added = 1;    }    if(already_added) return;    eventstream_paths += ({path});    if(eventstream->is_started())    eventstream->stop();    eventstream->add_path(path);    eventstream->start();   #elseif HAVE_INOTIFY    wd = instance->add_watch(path, -  Inotify.IN_MOVED_FROM | Inotify.IN_UNMOUNT | -  Inotify.IN_MOVED_TO | Inotify.IN_MASK_ADD | -  Inotify.IN_MOVE_SELF | Inotify.IN_DELETE | -  Inotify.IN_MOVE | Inotify.IN_MODIFY | -  Inotify.IN_ATTRIB | Inotify.IN_DELETE_SELF | -  Inotify.IN_CREATE); +  System.Inotify.IN_MOVED_FROM | System.Inotify.IN_UNMOUNT | +  System.Inotify.IN_MOVED_TO | System.Inotify.IN_MASK_ADD | +  System.Inotify.IN_MOVE_SELF | System.Inotify.IN_DELETE | +  System.Inotify.IN_MOVE | System.Inotify.IN_MODIFY | +  System.Inotify.IN_ATTRIB | System.Inotify.IN_DELETE_SELF | +  System.Inotify.IN_CREATE);   #endif    }       void destroy()    {   #if HAVE_INOTIFY    instance->rm_watch(wd);   #endif /* HAVE_INOTIFY */    }   
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:772:   //!   //! @param stable_time   //! Override of @[default_stable_time].   protected void create(int|void max_dir_check_interval,    int|void file_interval_factor,    int|void stable_time)   {   #if HAVE_EVENTSTREAM    eventstream->callback_func = eventstream_callback;   #elseif HAVE_INOTIFY -  instance = Inotify._Instance(); -  file = Stdio.File(instance->get_fd(), "r"); +  instance = System.Inotify._Instance(); +  file = Stdio.File(); +  file->assign(instance->fd());    file->set_nonblocking();    file->set_read_callback(inotify_parse);   #endif       if (max_dir_check_interval > 0) {    this_program::max_dir_check_interval = max_dir_check_interval;    }    if (file_interval_factor > 0) {    this_program::file_interval_factor = file_interval_factor;    }