equal
deleted
inserted
replaced
82 static long getEvent(long address, int i) { |
82 static long getEvent(long address, int i) { |
83 return address + (SIZEOF_KQUEUEEVENT*i); |
83 return address + (SIZEOF_KQUEUEEVENT*i); |
84 } |
84 } |
85 |
85 |
86 /** |
86 /** |
87 * Returns the file descriptor from a kevent (assuming to be in ident field) |
87 * Returns the file descriptor from a kevent (assuming it is in the ident field) |
88 */ |
88 */ |
89 static int getDescriptor(long address) { |
89 static int getDescriptor(long address) { |
90 return unsafe.getInt(address + OFFSET_IDENT); |
90 return unsafe.getInt(address + OFFSET_IDENT); |
91 } |
91 } |
92 |
92 |
93 static int getFilter(long address) { |
93 static short getFilter(long address) { |
94 return unsafe.getShort(address + OFFSET_FILTER); |
94 return unsafe.getShort(address + OFFSET_FILTER); |
95 } |
95 } |
96 |
96 |
97 static int getFlags(long address) { |
97 static short getFlags(long address) { |
98 return unsafe.getShort(address + OFFSET_FLAGS); |
98 return unsafe.getShort(address + OFFSET_FLAGS); |
99 } |
99 } |
100 |
100 |
101 // -- Native methods -- |
101 // -- Native methods -- |
102 |
102 |
106 |
106 |
107 private static native int filterOffset(); |
107 private static native int filterOffset(); |
108 |
108 |
109 private static native int flagsOffset(); |
109 private static native int flagsOffset(); |
110 |
110 |
111 static native int kqueue() throws IOException; |
111 static native int create() throws IOException; |
112 |
112 |
113 static native int keventRegister(int kqpfd, int fd, int filter, int flags); |
113 static native int register(int kqfd, int fd, int filter, int flags); |
114 |
114 |
115 static native int keventPoll(int kqpfd, long pollAddress, int nevents) |
115 static native int poll(int kqfd, long pollAddress, int nevents, long timeout) |
116 throws IOException; |
116 throws IOException; |
117 |
117 |
118 static { |
118 static { |
119 IOUtil.load(); |
119 IOUtil.load(); |
120 } |
120 } |