class INotify::Notifier
def initialize
-
(SystemCallError)
- if inotify failed to initialize for some reason
Returns:
-
(Notifier)
-
def initialize @running = Mutex.new @pipe = IO.pipe # JRuby shutdown sometimes runs IO finalizers before all threads finish. if RUBY_ENGINE == 'jruby' @pipe[0].autoclose = false @pipe[1].autoclose = false end @watchers = {} fd = Native.inotify_init unless fd < 0 @handle = IO.new(fd) @handle.autoclose = false if RUBY_ENGINE == 'jruby' return end raise SystemCallError.new( "Failed to initialize inotify" + case FFI.errno when Errno::EMFILE::Errno; ": the user limit on the total number of inotify instances has been reached." when Errno::ENFILE::Errno; ": the system limit on the total number of file descriptors has been reached." when Errno::ENOMEM::Errno; ": insufficient kernel memory is available." else; "" end, FFI.errno) end