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) {
97369736
97379737pub const EV = switch (native_os) {
97389738 .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct {
9739 // https://github.com/apple-oss-distributions/xnu/blob/main/bsd/sys/event.h
97399740 /// add event to kq (implies enable)
97409741 pub const ADD = 0x0001;
97419742 /// delete event from kq
......@@ -9771,11 +9772,14 @@ pub const EV = switch (native_os) {
97719772 pub const FLAG0 = 0x1000;
97729773 /// filter-specific flag
97739774 pub const FLAG1 = 0x2000;
9774 /// EOF detected
9775 /// EOF detected (return value)
97759776 pub const EOF = 0x8000;
9776 /// error, data contains errno
9777 /// error, data contains errno (return value)
97779778 pub const ERROR = 0x4000;
9779 /// use poll(2) semantics for EVFILT.READ
97789780 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
97799783 pub const OOBAND = FLAG1;
97809784 },
97819785 .dragonfly => struct {
......@@ -9818,6 +9822,7 @@ pub const EV = switch (native_os) {
98189822 pub const EOF = 0x8000;
98199823 },
98209824 .freebsd => struct {
9825 // https://cgit.freebsd.org/src/tree/sys/sys/event.h
98219826 /// add event to kq (implies enable)
98229827 pub const ADD = 0x0001;
98239828 /// delete event from kq
......@@ -9826,12 +9831,14 @@ pub const EV = switch (native_os) {
98269831 pub const ENABLE = 0x0004;
98279832 /// disable event (not reported)
98289833 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;
98299838 /// only report one occurrence
98309839 pub const ONESHOT = 0x0010;
98319840 /// clear event state after reporting
98329841 pub const CLEAR = 0x0020;
9833 /// error, event data contains errno
9834 pub const ERROR = 0x4000;
98359842 /// force immediate event output
98369843 /// ... with or without ERROR
98379844 /// ... use KEVENT_FLAG_ERROR_EVENTS
......@@ -9839,6 +9846,18 @@ pub const EV = switch (native_os) {
98399846 pub const RECEIPT = 0x0040;
98409847 /// disable event after reporting
98419848 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;
98429861 },
98439862 .openbsd => struct {
98449863 pub const ADD = 0x0001;
......@@ -9962,6 +9981,7 @@ pub const EVFILT = switch (native_os) {
99629981 pub const EMPTY = 9;
99639982 },
99649983 .freebsd => struct {
9984 // https://cgit.freebsd.org/src/tree/sys/sys/event.h
99659985 pub const READ = -1;
99669986 pub const WRITE = -2;
99679987 /// attached to aio requests
......@@ -9978,12 +9998,18 @@ pub const EVFILT = switch (native_os) {
99789998 pub const PROCDESC = -8;
99799999 /// Filesystem events
998010000 pub const FS = -9;
10001 /// attached to lio requests
998110002 pub const LIO = -10;
998210003 /// User events
998310004 pub const USER = -11;
998410005 /// Sendfile events
998510006 pub const SENDFILE = -12;
10007 /// empty send socket buf
998610008 pub const EMPTY = -13;
10009 /// attached to struct prison
10010 pub const JAIL = -14;
10011 /// attached to jail descriptors
10012 pub const JAILDESC = -15;
998710013 },
998810014 .openbsd => struct {
998910015 pub const READ = -1;
......@@ -10002,6 +10028,7 @@ pub const EVFILT = switch (native_os) {
1000210028
1000310029pub const NOTE = switch (native_os) {
1000410030 .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => struct {
10031 // https://github.com/apple-oss-distributions/xnu/blob/main/bsd/sys/event.h
1000510032 /// On input, TRIGGER causes the event to be triggered for output.
1000610033 pub const TRIGGER = 0x01000000;
1000710034 /// ignore input fflags
......@@ -10033,7 +10060,7 @@ pub const NOTE = switch (native_os) {
1003310060 pub const RENAME = 0x00000020;
1003410061 /// vnode access was revoked
1003510062 pub const REVOKE = 0x00000040;
10036 /// No specific vnode event: to test for EVFILT_READ activation
10063 /// No specific vnode event: to test for EVFILT_READ activation
1003710064 pub const NONE = 0x00000080;
1003810065 /// vnode was unlocked by flock(2)
1003910066 pub const FUNLOCK = 0x00000100;
......@@ -10045,7 +10072,7 @@ pub const NOTE = switch (native_os) {
1004510072 pub const EXEC = 0x20000000;
1004610073 /// shared with EVFILT_SIGNAL
1004710074 pub const SIGNAL = 0x08000000;
10048 /// exit status to be returned, valid for child process only
10075 /// exit status to be returned, valid for child process only
1004910076 pub const EXITSTATUS = 0x04000000;
1005010077 /// provide details on reasons for exit
1005110078 pub const EXIT_DETAIL = 0x02000000;
......@@ -10056,11 +10083,11 @@ pub const NOTE = switch (native_os) {
1005610083 pub const EXIT_DECRYPTFAIL = 0x00010000;
1005710084 pub const EXIT_MEMORY = 0x00020000;
1005810085 pub const EXIT_CSERROR = 0x00040000;
10059 /// will react on memory pressure
10086 /// will react on memory pressure
1006010087 pub const VM_PRESSURE = 0x80000000;
10061 /// will quit on memory pressure, possibly after cleaning up dirty state
10088 /// will quit on memory pressure, possibly after cleaning up dirty state
1006210089 pub const VM_PRESSURE_TERMINATE = 0x40000000;
10063 /// will quit immediately on memory pressure
10090 /// will quit immediately on memory pressure
1006410091 pub const VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000;
1006510092 /// there was an error
1006610093 pub const VM_ERROR = 0x10000000;
......@@ -10078,6 +10105,9 @@ pub const NOTE = switch (native_os) {
1007810105 pub const CRITICAL = 0x00000020;
1007910106 /// system does maximum timer coalescing
1008010107 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
1008110111 pub const MACH_CONTINUOUS_TIME = 0x00000080;
1008210112 /// data is mach absolute time units
1008310113 pub const MACHTIME = 0x00000100;