Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 68cce53

Browse files
authored
Merge pull request #1809 from Calrama/freebsd
Update core.sys.freebsd.sys.event merged-on-behalf-of: Martin Nowak <code@dawg.eu>
2 parents 3802d59 + f0365f2 commit 68cce53

File tree

1 file changed

+33
-14
lines changed

1 file changed

+33
-14
lines changed

src/core/sys/freebsd/sys/event.d

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ module core.sys.freebsd.sys.event;
1515

1616
version (FreeBSD):
1717
extern (C):
18+
nothrow:
19+
@nogc:
1820

1921
import core.stdc.stdint; // intptr_t, uintptr_t
2022
import core.sys.posix.time; // timespec
@@ -28,10 +30,11 @@ enum
2830
EVFILT_PROC = -5, /* attached to struct proc */
2931
EVFILT_SIGNAL = -6, /* attached to struct proc */
3032
EVFILT_TIMER = -7, /* timers */
31-
// EVFILT_NETDEV = -8, /* no longer supported */
33+
EVFILT_PROCDESC = -8, /* attached to process descriptors */
3234
EVFILT_FS = -9, /* filesystem events */
3335
EVFILT_LIO = -10, /* attached to lio requests */
3436
EVFILT_USER = -11, /* User events */
37+
EVFILT_SENDFILE = -12, /* attached to sendfile requests */
3538
EVFILT_SYSCOUNT = 11,
3639
}
3740

@@ -53,23 +56,26 @@ struct kevent_t
5356
enum
5457
{
5558
/* actions */
56-
EV_ADD = 0x0001, /* add event to kq (implies enable) */
57-
EV_DELETE = 0x0002, /* delete event from kq */
58-
EV_ENABLE = 0x0004, /* enable event */
59-
EV_DISABLE = 0x0008, /* disable event (not reported) */
59+
EV_ADD = 0x0001, /* add event to kq (implies enable) */
60+
EV_DELETE = 0x0002, /* delete event from kq */
61+
EV_ENABLE = 0x0004, /* enable event */
62+
EV_DISABLE = 0x0008, /* disable event (not reported) */
63+
EV_FORCEONESHOT = 0x0100, /* enable _ONESHOT and force trigger */
6064

6165
/* flags */
62-
EV_ONESHOT = 0x0010, /* only report one occurrence */
63-
EV_CLEAR = 0x0020, /* clear event state after reporting */
64-
EV_RECEIPT = 0x0040, /* force EV_ERROR on success, data=0 */
65-
EV_DISPATCH = 0x0080, /* disable event after reporting */
66+
EV_ONESHOT = 0x0010, /* only report one occurrence */
67+
EV_CLEAR = 0x0020, /* clear event state after reporting */
68+
EV_RECEIPT = 0x0040, /* force EV_ERROR on success, data=0 */
69+
EV_DISPATCH = 0x0080, /* disable event after reporting */
6670

67-
EV_SYSFLAGS = 0xF000, /* reserved by system */
68-
EV_FLAG1 = 0x2000, /* filter-specific flag */
71+
EV_SYSFLAGS = 0xF000, /* reserved by system */
72+
EV_DROP = 0x1000, /* note should be dropped */
73+
EV_FLAG1 = 0x2000, /* filter-specific flag */
74+
EV_FLAG2 = 0x4000, /* filter-specific flag */
6975

7076
/* returned values */
71-
EV_EOF = 0x8000, /* EOF detected */
72-
EV_ERROR = 0x4000, /* error, data contains errno */
77+
EV_EOF = 0x8000, /* EOF detected */
78+
EV_ERROR = 0x4000, /* error, data contains errno */
7379
}
7480

7581
enum
@@ -97,6 +103,7 @@ enum
97103
* data/hint flags for EVFILT_{READ|WRITE}, shared with userspace
98104
*/
99105
NOTE_LOWAT = 0x0001, /* low water mark */
106+
NOTE_FILE_POLL = 0x0002, /* behave like poll() */
100107

101108
/*
102109
* data/hint flags for EVFILT_VNODE, shared with userspace
@@ -108,9 +115,15 @@ enum
108115
NOTE_LINK = 0x0010, /* link count changed */
109116
NOTE_RENAME = 0x0020, /* vnode was renamed */
110117
NOTE_REVOKE = 0x0040, /* vnode access was revoked */
118+
NOTE_OPEN = 0x0080, /* vnode was opened */
119+
NOTE_CLOSE = 0x0100, /* file closed, fd did not
120+
allowed write */
121+
NOTE_CLOSE_WRITE = 0x0200, /* file closed, fd did allowed
122+
write */
123+
NOTE_READ = 0x0400, /* file was read */
111124

112125
/*
113-
* data/hint flags for EVFILT_PROC, shared with userspace
126+
* data/hint flags for EVFILT_PROC and EVFILT_PROCDESC, shared with userspace
114127
*/
115128
NOTE_EXIT = 0x80000000, /* process exited */
116129
NOTE_FORK = 0x40000000, /* process forked */
@@ -122,6 +135,12 @@ enum
122135
NOTE_TRACK = 0x00000001, /* follow across forks */
123136
NOTE_TRACKERR = 0x00000002, /* could not track child */
124137
NOTE_CHILD = 0x00000004, /* am a child process */
138+
139+
/* additional flags for EVFILT_TIMER */
140+
NOTE_SECONDS = 0x00000001, /* data is seconds */
141+
NOTE_MSECONDS = 0x00000002, /* data is milliseconds */
142+
NOTE_USECONDS = 0x00000004, /* data is microseconds */
143+
NOTE_NSECONDS = 0x00000008, /* data is nanoseconds */
125144
}
126145

127146
int kqueue();

0 commit comments

Comments
 (0)