@Test public void testKevent() { if(!isBSD()) return; System.out.println("kevent"); int kq = BSD.kqueue(); int tmpDirFD = BSD.open("/tmp", BSD.O_RDONLY, 0); BSD.kevent change = new BSD.kevent(); change.set_flags((short)(BSD.EV_ADD | BSD.EV_CLEAR)); change.set_ident(tmpDirFD); change.set_filter(BSD.EVFILT_VNODE); change.set_fflags(BSD.NOTE_DELETE | BSD.NOTE_WRITE | BSD.NOTE_EXTEND | BSD.NOTE_ATTRIB | BSD.NOTE_LINK | BSD.NOTE_RENAME | BSD.NOTE_REVOKE); kevent[] changelist = { change }; int result = BSD.kevent(kq, changelist, null, null); if(result == -1) { String errorMsg = BSD.strerror(BSD.errno()); System.out.println(errorMsg); } assertTrue(result == 0); kevent[] events = new kevent[16]; { result = BSD.kevent(kq, null, null, null); assertEquals(0, result); result = BSD.kevent(-1, null, null, null); assertEquals(-1, result); assertEquals(BSD.errno(), BSD.EBADF); result = BSD.kevent(kq, null, null, null); assertEquals(0, result); boolean nullPointerExceptionThrown = false; try { BSD.kevent(kq, new kevent[1], null, null); } catch(NullPointerException npx){ nullPointerExceptionThrown = true; } assertTrue(nullPointerExceptionThrown); } }
public static native int kevent(int kq, kevent[] changelist, kevent[] eventlist, timespec timeout);
BSD extends Unix { public static native int kevent(int kq, kevent[] changelist, kevent[] eventlist, timespec timeout); }
BSD extends Unix { public static native int kevent(int kq, kevent[] changelist, kevent[] eventlist, timespec timeout);  }
BSD extends Unix { public static native int kevent(int kq, kevent[] changelist, kevent[] eventlist, timespec timeout);  static native int kqueue(); static native int kevent(int kq, kevent[] changelist, kevent[] eventlist, timespec timeout); }
BSD extends Unix { public static native int kevent(int kq, kevent[] changelist, kevent[] eventlist, timespec timeout);  static native int kqueue(); static native int kevent(int kq, kevent[] changelist, kevent[] eventlist, timespec timeout); static final short EV_ADD; static final short EV_ENABLE; static final short EV_DISABLE; static final short EV_DELETE; static final short EV_ONESHOT; static final short EV_CLEAR; static final short EV_EOF; static final short EV_ERROR; static final short EVFILT_VNODE; static final short EVFILT_PROC; static final int NOTE_DELETE; static final int NOTE_WRITE; static final int NOTE_EXTEND; static final int NOTE_ATTRIB; static final int NOTE_LINK; static final int NOTE_RENAME; static final int NOTE_REVOKE; static final int NOTE_EXIT; static final int NOTE_FORK; static final int NOTE_EXEC; static final int NOTE_TRACK; static final int NOTE_TRACKERR; }