1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien.syntax system sequences vocabs.loader words ;
6 << "unix.kqueue." os word-name append require >>
8 FUNCTION: int kqueue ( ) ;
11 : EV_ADD HEX: 1 ; inline ! add event to kq (implies enable)
12 : EV_DELETE HEX: 2 ; inline ! delete event from kq
13 : EV_ENABLE HEX: 4 ; inline ! enable event
14 : EV_DISABLE HEX: 8 ; inline ! disable event (not reported)
17 : EV_ONESHOT HEX: 10 ; inline ! only report one occurrence
18 : EV_CLEAR HEX: 20 ; inline ! clear event state after reporting
20 : EV_SYSFLAGS HEX: f000 ; inline ! reserved by system
21 : EV_FLAG0 HEX: 1000 ; inline ! filter-specific flag
22 : EV_FLAG1 HEX: 2000 ; inline ! filter-specific flag
25 : EV_EOF HEX: 8000 ; inline ! EOF detected
26 : EV_ERROR HEX: 4000 ; inline ! error, data contains errno
28 : EV_POLL EV_FLAG0 ; inline
29 : EV_OOBAND EV_FLAG1 ; inline
31 : NOTE_LOWAT HEX: 00000001 ; inline ! low water mark
33 : NOTE_DELETE HEX: 00000001 ; inline ! vnode was removed
34 : NOTE_WRITE HEX: 00000002 ; inline ! data contents changed
35 : NOTE_EXTEND HEX: 00000004 ; inline ! size increased
36 : NOTE_ATTRIB HEX: 00000008 ; inline ! attributes changed
37 : NOTE_LINK HEX: 00000010 ; inline ! link count changed
38 : NOTE_RENAME HEX: 00000020 ; inline ! vnode was renamed
39 : NOTE_REVOKE HEX: 00000040 ; inline ! vnode access was revoked
41 : NOTE_EXIT HEX: 80000000 ; inline ! process exited
42 : NOTE_FORK HEX: 40000000 ; inline ! process forked
43 : NOTE_EXEC HEX: 20000000 ; inline ! process exec'd
44 : NOTE_PCTRLMASK HEX: f0000000 ; inline ! mask for hint bits
45 : NOTE_PDATAMASK HEX: 000fffff ; inline ! mask for pid
47 : NOTE_SECONDS HEX: 00000001 ; inline ! data is seconds
48 : NOTE_USECONDS HEX: 00000002 ; inline ! data is microseconds
49 : NOTE_NSECONDS HEX: 00000004 ; inline ! data is nanoseconds
50 : NOTE_ABSOLUTE HEX: 00000008 ; inline ! absolute timeout
52 : NOTE_TRACK HEX: 00000001 ; inline ! follow across forks
53 : NOTE_TRACKERR HEX: 00000002 ; inline ! could not track child
54 : NOTE_CHILD HEX: 00000004 ; inline ! am a child process