예제 #1
0
            public VnodeMonitor(string path, VnodeMonitorKind vnodeKind, DispatchQueue queue = null)
            {
                if (path == null)
                {
                    throw new ArgumentNullException("path");
                }

                fd = open(path, O_EVTONLY);
                if (fd == -1)
                {
                    throw new IOException("Failure to open the file", Marshal.GetLastWin32Error());
                }
                if (type_vnode == IntPtr.Zero)
                {
                    type_vnode = Dlfcn.dlsym(Libraries.System.Handle, "_dispatch_source_type_vnode");
                }
                this.queue = queue;

                var handle = dispatch_source_create(type_vnode,
                                                    handle: (IntPtr)fd,
                                                    mask:   (IntPtr)vnodeKind,
                                                    queue:  queue == null ? IntPtr.Zero : queue.Handle);

                if (handle != IntPtr.Zero)
                {
                    InitializeHandle(handle);
                }
            }
예제 #2
0
 public VnodeMonitor(int fileDescriptor, VnodeMonitorKind vnodeKind, DispatchQueue queue = null)
 {
     if (type_vnode == IntPtr.Zero)
     {
         type_vnode = Dlfcn.dlsym(Libraries.System.Handle, "_dispatch_source_type_vnode");
     }
     this.queue = queue;
     fd         = -1;
     handle     = dispatch_source_create(type_vnode,
                                         handle: (IntPtr)fileDescriptor,
                                         mask:   (IntPtr)vnodeKind,
                                         queue:  queue == null ? IntPtr.Zero : queue.Handle);
 }
예제 #3
0
            public VnodeMonitor(string path, VnodeMonitorKind vnodeKind, DispatchQueue queue = null)
            {
                if (path == null)
                    throw new ArgumentNullException ("path");

                fd = open (path, O_EVTONLY);
                if (fd == -1)
                    throw new IOException ("Failure to open the file", Marshal.GetLastWin32Error ());
                if (type_vnode == IntPtr.Zero)
                    type_vnode = Dlfcn.dlsym (Libraries.System.Handle, "_dispatch_source_type_vnode");
                this.queue = queue;

                handle = dispatch_source_create (type_vnode,
                                 handle: (IntPtr) fd,
                                 mask:   (IntPtr) vnodeKind,
                                 queue:  queue == null ? IntPtr.Zero : queue.Handle);
            }
예제 #4
0
 public VnodeMonitor(int fileDescriptor, VnodeMonitorKind vnodeKind, DispatchQueue queue = null)
 {
     if (type_vnode == IntPtr.Zero)
         type_vnode = Dlfcn.dlsym (Libraries.System.Handle, "_dispatch_source_type_vnode");
     this.queue = queue;
     fd = -1;
     handle = dispatch_source_create (type_vnode,
                      handle: (IntPtr) fileDescriptor,
                      mask:   (IntPtr) vnodeKind,
                      queue:  queue == null ? IntPtr.Zero : queue.Handle);
 }