authorgravatar for dvc@noreply.codeberg.orgDavid <dvc@noreply.codeberg.org> 2026-08-02 12:25:11+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-08-02 12:25:11+02:00
log95396e2c5d14fed2070742c0da41ecfbcd012978
tree2c4e962967322219e58687a4ec1690f01fd0f1bc
parent9bc98f5911dd30ce4f0b62c6cc5eaaeb6d6b5e2d

std.c: update EV, EVFILT, NOTE enums for FreeBSD and macOS (#36206)

Co-authored-by: David Czihak <dcz-at@noreply.codeberg.org> Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36206 Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>

1 files changed, 39 insertions(+), 9 deletions(-)

lib/std/c.zig+39-9
...@@ -9736,6 +9736,7 @@ pub const SS = switch (native_os) {...@@ -9736,6 +9736,7 @@ pub const SS = switch (native_os) {
97369736
9737pub const EV = switch (native_os) {9737pub const EV = switch (native_os) {
9738 .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct {9738 .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct {
9739 // https://github.com/apple-oss-distributions/xnu/blob/main/bsd/sys/event.h
9739 /// add event to kq (implies enable)9740 /// add event to kq (implies enable)
9740 pub const ADD = 0x0001;9741 pub const ADD = 0x0001;
9741 /// delete event from kq9742 /// delete event from kq
...@@ -9771,11 +9772,14 @@ pub const EV = switch (native_os) {...@@ -9771,11 +9772,14 @@ pub const EV = switch (native_os) {
9771 pub const FLAG0 = 0x1000;9772 pub const FLAG0 = 0x1000;
9772 /// filter-specific flag9773 /// filter-specific flag
9773 pub const FLAG1 = 0x2000;9774 pub const FLAG1 = 0x2000;
9774 /// EOF detected9775 /// EOF detected (return value)
9775 pub const EOF = 0x8000;9776 pub const EOF = 0x8000;
9776 /// error, data contains errno9777 /// error, data contains errno (return value)
9777 pub const ERROR = 0x4000;9778 pub const ERROR = 0x4000;
9779 /// use poll(2) semantics for EVFILT.READ
9778 pub const POLL = FLAG0;9780 pub const POLL = FLAG0;
9781 /// on input, filter should actively return in the presence of OOB on the descriptor
9782 /// on output, indicates the presence of OOB data on the descriptor
9779 pub const OOBAND = FLAG1;9783 pub const OOBAND = FLAG1;
9780 },9784 },
9781 .dragonfly => struct {9785 .dragonfly => struct {
...@@ -9818,6 +9822,7 @@ pub const EV = switch (native_os) {...@@ -9818,6 +9822,7 @@ pub const EV = switch (native_os) {
9818 pub const EOF = 0x8000;9822 pub const EOF = 0x8000;
9819 },9823 },
9820 .freebsd => struct {9824 .freebsd => struct {
9825 // https://cgit.freebsd.org/src/tree/sys/sys/event.h
9821 /// add event to kq (implies enable)9826 /// add event to kq (implies enable)
9822 pub const ADD = 0x0001;9827 pub const ADD = 0x0001;
9823 /// delete event from kq9828 /// delete event from kq
...@@ -9826,12 +9831,14 @@ pub const EV = switch (native_os) {...@@ -9826,12 +9831,14 @@ pub const EV = switch (native_os) {
9826 pub const ENABLE = 0x0004;9831 pub const ENABLE = 0x0004;
9827 /// disable event (not reported)9832 /// disable event (not reported)
9828 pub const DISABLE = 0x0008;9833 pub const DISABLE = 0x0008;
9834 /// enable _ONESHOT and force trigger
9835 pub const FORCEONESHOT = 0x0100;
9836 /// do not update the udata field
9837 pub const KEEPUDATA = 0x0200;
9829 /// only report one occurrence9838 /// only report one occurrence
9830 pub const ONESHOT = 0x0010;9839 pub const ONESHOT = 0x0010;
9831 /// clear event state after reporting9840 /// clear event state after reporting
9832 pub const CLEAR = 0x0020;9841 pub const CLEAR = 0x0020;
9833 /// error, event data contains errno
9834 pub const ERROR = 0x4000;
9835 /// force immediate event output9842 /// force immediate event output
9836 /// ... with or without ERROR9843 /// ... with or without ERROR
9837 /// ... use KEVENT_FLAG_ERROR_EVENTS9844 /// ... use KEVENT_FLAG_ERROR_EVENTS
...@@ -9839,6 +9846,18 @@ pub const EV = switch (native_os) {...@@ -9839,6 +9846,18 @@ pub const EV = switch (native_os) {
9839 pub const RECEIPT = 0x0040;9846 pub const RECEIPT = 0x0040;
9840 /// disable event after reporting9847 /// disable event after reporting
9841 pub const DISPATCH = 0x0080;9848 pub const DISPATCH = 0x0080;
9849 /// reserved by system
9850 pub const SYSFLAGS = 0xF000;
9851 /// note should be dropped
9852 pub const DROP = 0x1000;
9853 /// filter-specific flag 1
9854 pub const FLAG1 = 0x2000;
9855 /// filter-specific flag 2
9856 pub const FLAG2 = 0x4000;
9857 /// EOF detected (return value)
9858 pub const EOF = 0x8000;
9859 /// error, event data contains errno (return value)
9860 pub const ERROR = 0x4000;
9842 },9861 },
9843 .openbsd => struct {9862 .openbsd => struct {
9844 pub const ADD = 0x0001;9863 pub const ADD = 0x0001;
...@@ -9962,6 +9981,7 @@ pub const EVFILT = switch (native_os) {...@@ -9962,6 +9981,7 @@ pub const EVFILT = switch (native_os) {
9962 pub const EMPTY = 9;9981 pub const EMPTY = 9;
9963 },9982 },
9964 .freebsd => struct {9983 .freebsd => struct {
9984 // https://cgit.freebsd.org/src/tree/sys/sys/event.h
9965 pub const READ = -1;9985 pub const READ = -1;
9966 pub const WRITE = -2;9986 pub const WRITE = -2;
9967 /// attached to aio requests9987 /// attached to aio requests
...@@ -9978,12 +9998,18 @@ pub const EVFILT = switch (native_os) {...@@ -9978,12 +9998,18 @@ pub const EVFILT = switch (native_os) {
9978 pub const PROCDESC = -8;9998 pub const PROCDESC = -8;
9979 /// Filesystem events9999 /// Filesystem events
9980 pub const FS = -9;10000 pub const FS = -9;
10001 /// attached to lio requests
9981 pub const LIO = -10;10002 pub const LIO = -10;
9982 /// User events10003 /// User events
9983 pub const USER = -11;10004 pub const USER = -11;
9984 /// Sendfile events10005 /// Sendfile events
9985 pub const SENDFILE = -12;10006 pub const SENDFILE = -12;
10007 /// empty send socket buf
9986 pub const EMPTY = -13;10008 pub const EMPTY = -13;
10009 /// attached to struct prison
10010 pub const JAIL = -14;
10011 /// attached to jail descriptors
10012 pub const JAILDESC = -15;
9987 },10013 },
9988 .openbsd => struct {10014 .openbsd => struct {
9989 pub const READ = -1;10015 pub const READ = -1;
...@@ -10002,6 +10028,7 @@ pub const EVFILT = switch (native_os) {...@@ -10002,6 +10028,7 @@ pub const EVFILT = switch (native_os) {
1000210028
10003pub const NOTE = switch (native_os) {10029pub const NOTE = switch (native_os) {
10004 .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct {10030 .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct {
10031 // https://github.com/apple-oss-distributions/xnu/blob/main/bsd/sys/event.h
10005 /// On input, TRIGGER causes the event to be triggered for output.10032 /// On input, TRIGGER causes the event to be triggered for output.
10006 pub const TRIGGER = 0x01000000;10033 pub const TRIGGER = 0x01000000;
10007 /// ignore input fflags10034 /// ignore input fflags
...@@ -10033,7 +10060,7 @@ pub const NOTE = switch (native_os) {...@@ -10033,7 +10060,7 @@ pub const NOTE = switch (native_os) {
10033 pub const RENAME = 0x00000020;10060 pub const RENAME = 0x00000020;
10034 /// vnode access was revoked10061 /// vnode access was revoked
10035 pub const REVOKE = 0x00000040;10062 pub const REVOKE = 0x00000040;
10036 /// No specific vnode event: to test for EVFILT_READ activation10063 /// No specific vnode event: to test for EVFILT_READ activation
10037 pub const NONE = 0x00000080;10064 pub const NONE = 0x00000080;
10038 /// vnode was unlocked by flock(2)10065 /// vnode was unlocked by flock(2)
10039 pub const FUNLOCK = 0x00000100;10066 pub const FUNLOCK = 0x00000100;
...@@ -10045,7 +10072,7 @@ pub const NOTE = switch (native_os) {...@@ -10045,7 +10072,7 @@ pub const NOTE = switch (native_os) {
10045 pub const EXEC = 0x20000000;10072 pub const EXEC = 0x20000000;
10046 /// shared with EVFILT_SIGNAL10073 /// shared with EVFILT_SIGNAL
10047 pub const SIGNAL = 0x08000000;10074 pub const SIGNAL = 0x08000000;
10048 /// exit status to be returned, valid for child process only10075 /// exit status to be returned, valid for child process only
10049 pub const EXITSTATUS = 0x04000000;10076 pub const EXITSTATUS = 0x04000000;
10050 /// provide details on reasons for exit10077 /// provide details on reasons for exit
10051 pub const EXIT_DETAIL = 0x02000000;10078 pub const EXIT_DETAIL = 0x02000000;
...@@ -10056,11 +10083,11 @@ pub const NOTE = switch (native_os) {...@@ -10056,11 +10083,11 @@ pub const NOTE = switch (native_os) {
10056 pub const EXIT_DECRYPTFAIL = 0x00010000;10083 pub const EXIT_DECRYPTFAIL = 0x00010000;
10057 pub const EXIT_MEMORY = 0x00020000;10084 pub const EXIT_MEMORY = 0x00020000;
10058 pub const EXIT_CSERROR = 0x00040000;10085 pub const EXIT_CSERROR = 0x00040000;
10059 /// will react on memory pressure10086 /// will react on memory pressure
10060 pub const VM_PRESSURE = 0x80000000;10087 pub const VM_PRESSURE = 0x80000000;
10061 /// will quit on memory pressure, possibly after cleaning up dirty state10088 /// will quit on memory pressure, possibly after cleaning up dirty state
10062 pub const VM_PRESSURE_TERMINATE = 0x40000000;10089 pub const VM_PRESSURE_TERMINATE = 0x40000000;
10063 /// will quit immediately on memory pressure10090 /// will quit immediately on memory pressure
10064 pub const VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000;10091 pub const VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000;
10065 /// there was an error10092 /// there was an error
10066 pub const VM_ERROR = 0x10000000;10093 pub const VM_ERROR = 0x10000000;
...@@ -10078,6 +10105,9 @@ pub const NOTE = switch (native_os) {...@@ -10078,6 +10105,9 @@ pub const NOTE = switch (native_os) {
10078 pub const CRITICAL = 0x00000020;10105 pub const CRITICAL = 0x00000020;
10079 /// system does maximum timer coalescing10106 /// system does maximum timer coalescing
10080 pub const BACKGROUND = 0x00000040;10107 pub const BACKGROUND = 0x00000040;
10108 /// with ABSOLUTE: causes the timer to continue to tick across sleep, still uses gettimeofday epoch
10109 /// with MACHTIME and ABSOLUTE: uses mach continuous time epoch
10110 /// without ABSOLUTE: continues to tick across sleep
10081 pub const MACH_CONTINUOUS_TIME = 0x00000080;10111 pub const MACH_CONTINUOUS_TIME = 0x00000080;
10082 /// data is mach absolute time units10112 /// data is mach absolute time units
10083 pub const MACHTIME = 0x00000100;10113 pub const MACHTIME = 0x00000100;