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

version» Context lines:

pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:936:    }   }      //! Inotify-accellerated @[Monitor].   protected class InotifyMonitor   {    inherit Monitor;       protected int wd = -1;    int `accellerated() { return wd != -1; } +  protected int(0..) out_of_inotify_space;       protected void file_exists(string path, Stdio.Stat st)    {    ::file_exists(path, st);    if ((last_change != 0x7fffffff) && (wd != -1)) {    // Not stable yet.    int t = time(1) - last_change;    if (t < 0) t = 0;    (backend || Pike.DefaultBackend)->    call_out(check, (stable_time || global::stable_time) + 1 - t);
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:1009: Inside #if undefined(INHIBIT_INOTIFY_MONITOR)
   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 |    System.Inotify.IN_CLOSE_WRITE);       if (new_wd != -1) {    MON_WERR("Registered %O with %O ==> %d.\n", path, instance, new_wd); +  out_of_inotify_space = 0;    // We shouldn't need to be polled.    if (!initial) {    MON_WERR("Unregistering from polling.\n");    release_monitor(this);    }    wd = new_wd;    monitors[inotify_cookie(wd)] = this;    if (initial) {    // NB: Inotify seems to not notify on preexisting paths,    // so we need to strap it along.    check();    }    }    }) { -  +  if (!has_value(lower_case(describe_error(err)), "no space left")) {    master()->handle_error (err); -  +  } else if (!(out_of_inotify_space++ % 100)) { +  werror("Out of inotify space (%d attempts):\n", out_of_inotify_space); +  master()->handle_error (err); +  werror("Consider increasing '/proc/sys/fs/inotify/max_user_watches'.\n");    }    } -  +  }       if (st && !err)    return; // Return early if setup was successful, i.e. avoid    // registering a polling monitor.      #endif /* !INHIBIT_INOTIFY_MONITOR */    MON_WERR("Registering %O for polling.\n", path);    ::register_path(initial);    }