From b3853e8b6ddba68be14c9299256f51985c577af5 Mon Sep 17 00:00:00 2001 From: Val Packett Date: Mon, 13 Mar 2023 14:43:15 -0300 Subject: [PATCH] Add missing kqueue constants across BSDs While here, reorder some to match the C headers --- libc-test/build.rs | 3 +++ libc-test/semver/dragonfly.txt | 1 + libc-test/semver/freebsd.txt | 9 +++++++++ libc-test/semver/netbsd.txt | 7 +++++++ libc-test/semver/openbsd.txt | 4 ++++ src/unix/bsd/freebsdlike/dragonfly/mod.rs | 1 + src/unix/bsd/freebsdlike/freebsd/mod.rs | 15 +++++++++++++-- src/unix/bsd/netbsdlike/netbsd/mod.rs | 7 +++++++ src/unix/bsd/netbsdlike/openbsd/mod.rs | 10 +++++++--- 9 files changed, 52 insertions(+), 5 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 9536668f2f78e..016dacd23fb13 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -2283,6 +2283,9 @@ fn test_freebsd(target: &str) { // FIXME: Removed in https://reviews.freebsd.org/D39127. "KERN_VNODE" => true, + // Added in FreeBSD 14 + "EV_KEEPUDATA" if Some(14) > freebsd_ver => true, + _ => false, } }); diff --git a/libc-test/semver/dragonfly.txt b/libc-test/semver/dragonfly.txt index 115c2919af3b1..23c66c3298bdb 100644 --- a/libc-test/semver/dragonfly.txt +++ b/libc-test/semver/dragonfly.txt @@ -269,6 +269,7 @@ EV_ENABLE EV_EOF EV_ERROR EV_FLAG1 +EV_HUP EV_NODATA EV_ONESHOT EV_RECEIPT diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index 429ae63eb8d31..eadb4e9c73b56 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -307,6 +307,9 @@ EV_ENABLE EV_EOF EV_ERROR EV_FLAG1 +EV_FLAG2 +EV_FORCEONESHOT +EV_KEEPUDATA EV_ONESHOT EV_RECEIPT EV_SYSFLAGS @@ -791,8 +794,11 @@ NI_NUMERICSERV NOEXPR NOKERNINFO NOSTR +NOTE_ABSTIME NOTE_ATTRIB NOTE_CHILD +NOTE_CLOSE +NOTE_CLOSE_WRITE NOTE_DELETE NOTE_EXEC NOTE_EXIT @@ -803,13 +809,16 @@ NOTE_FFCTRLMASK NOTE_FFLAGSMASK NOTE_FFNOP NOTE_FFOR +NOTE_FILE_POLL NOTE_FORK NOTE_LINK NOTE_LOWAT NOTE_MSECONDS NOTE_NSECONDS +NOTE_OPEN NOTE_PCTRLMASK NOTE_PDATAMASK +NOTE_READ NOTE_RENAME NOTE_REVOKE NOTE_SECONDS diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt index 174396c7202d3..3dc84da635963 100644 --- a/libc-test/semver/netbsd.txt +++ b/libc-test/semver/netbsd.txt @@ -730,6 +730,12 @@ NOTE_DELETE NOTE_EXEC NOTE_EXIT NOTE_EXTEND +NOTE_FFAND +NOTE_FFCOPY +NOTE_FFCTRLMASK +NOTE_FFLAGSMASK +NOTE_FFNOP +NOTE_FFOR NOTE_FORK NOTE_LINK NOTE_LOWAT @@ -741,6 +747,7 @@ NOTE_RENAME NOTE_REVOKE NOTE_TRACK NOTE_TRACKERR +NOTE_TRIGGER NOTE_USECONDS NOTE_WRITE NTP_API diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt index bf0a8382806fb..d95190ee8c090 100644 --- a/libc-test/semver/openbsd.txt +++ b/libc-test/semver/openbsd.txt @@ -176,6 +176,8 @@ ESOCKTNOSUPPORT ETOOMANYREFS EUSERS EVFILT_AIO +EVFILT_DEVICE +EVFILT_EXCEPT EVFILT_PROC EVFILT_READ EVFILT_SIGNAL @@ -582,6 +584,7 @@ NOEXPR NOKERNINFO NOSTR NOTE_ATTRIB +NOTE_CHANGE NOTE_CHILD NOTE_DELETE NOTE_EOF @@ -591,6 +594,7 @@ NOTE_EXTEND NOTE_FORK NOTE_LINK NOTE_LOWAT +NOTE_OOB NOTE_PCTRLMASK NOTE_PDATAMASK NOTE_RENAME diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index 70fe6e2edd03b..63c0594f41340 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -1091,6 +1091,7 @@ pub const EV_NODATA: u16 = 0x1000; pub const EV_FLAG1: u16 = 0x2000; pub const EV_ERROR: u16 = 0x4000; pub const EV_EOF: u16 = 0x8000; +pub const EV_HUP: u16 = 0x8000; pub const EV_SYSFLAGS: u16 = 0xf000; pub const FIODNAME: ::c_ulong = 0x80106678; diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index b70a40f15d2c6..55b520faabe21 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -2693,15 +2693,20 @@ pub const EV_ADD: u16 = 0x1; pub const EV_DELETE: u16 = 0x2; pub const EV_ENABLE: u16 = 0x4; pub const EV_DISABLE: u16 = 0x8; +pub const EV_FORCEONESHOT: u16 = 0x100; +pub const EV_KEEPUDATA: u16 = 0x200; + pub const EV_ONESHOT: u16 = 0x10; pub const EV_CLEAR: u16 = 0x20; pub const EV_RECEIPT: u16 = 0x40; pub const EV_DISPATCH: u16 = 0x80; +pub const EV_SYSFLAGS: u16 = 0xf000; pub const EV_DROP: u16 = 0x1000; pub const EV_FLAG1: u16 = 0x2000; -pub const EV_ERROR: u16 = 0x4000; +pub const EV_FLAG2: u16 = 0x4000; + pub const EV_EOF: u16 = 0x8000; -pub const EV_SYSFLAGS: u16 = 0xf000; +pub const EV_ERROR: u16 = 0x4000; pub const NOTE_TRIGGER: u32 = 0x01000000; pub const NOTE_FFNOP: u32 = 0x00000000; @@ -2711,6 +2716,7 @@ pub const NOTE_FFCOPY: u32 = 0xc0000000; pub const NOTE_FFCTRLMASK: u32 = 0xc0000000; pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff; pub const NOTE_LOWAT: u32 = 0x00000001; +pub const NOTE_FILE_POLL: u32 = 0x00000002; pub const NOTE_DELETE: u32 = 0x00000001; pub const NOTE_WRITE: u32 = 0x00000002; pub const NOTE_EXTEND: u32 = 0x00000004; @@ -2718,6 +2724,10 @@ pub const NOTE_ATTRIB: u32 = 0x00000008; pub const NOTE_LINK: u32 = 0x00000010; pub const NOTE_RENAME: u32 = 0x00000020; pub const NOTE_REVOKE: u32 = 0x00000040; +pub const NOTE_OPEN: u32 = 0x00000080; +pub const NOTE_CLOSE: u32 = 0x00000100; +pub const NOTE_CLOSE_WRITE: u32 = 0x00000200; +pub const NOTE_READ: u32 = 0x00000400; pub const NOTE_EXIT: u32 = 0x80000000; pub const NOTE_FORK: u32 = 0x40000000; pub const NOTE_EXEC: u32 = 0x20000000; @@ -2730,6 +2740,7 @@ pub const NOTE_SECONDS: u32 = 0x00000001; pub const NOTE_MSECONDS: u32 = 0x00000002; pub const NOTE_USECONDS: u32 = 0x00000004; pub const NOTE_NSECONDS: u32 = 0x00000008; +pub const NOTE_ABSTIME: u32 = 0x00000010; pub const MADV_PROTECT: ::c_int = 10; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 87132e2587a92..fd7175583e9a9 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1986,6 +1986,13 @@ pub const EV_ERROR: u32 = 0x4000; pub const EV_EOF: u32 = 0x8000; pub const EV_SYSFLAGS: u32 = 0xf000; +pub const NOTE_TRIGGER: u32 = 0x01000000; +pub const NOTE_FFNOP: u32 = 0x00000000; +pub const NOTE_FFAND: u32 = 0x40000000; +pub const NOTE_FFOR: u32 = 0x80000000; +pub const NOTE_FFCOPY: u32 = 0xc0000000; +pub const NOTE_FFCTRLMASK: u32 = 0xc0000000; +pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff; pub const NOTE_LOWAT: u32 = 0x00000001; pub const NOTE_DELETE: u32 = 0x00000001; pub const NOTE_WRITE: u32 = 0x00000002; diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index 192413a54ae84..7f8f9400df510 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -1279,13 +1279,15 @@ pub const PTHREAD_MUTEX_NORMAL: ::c_int = 3; pub const PTHREAD_MUTEX_STRICT_NP: ::c_int = 4; pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_STRICT_NP; +pub const EVFILT_READ: i16 = -1; +pub const EVFILT_WRITE: i16 = -2; pub const EVFILT_AIO: i16 = -3; +pub const EVFILT_VNODE: i16 = -4; pub const EVFILT_PROC: i16 = -5; -pub const EVFILT_READ: i16 = -1; pub const EVFILT_SIGNAL: i16 = -6; pub const EVFILT_TIMER: i16 = -7; -pub const EVFILT_VNODE: i16 = -4; -pub const EVFILT_WRITE: i16 = -2; +pub const EVFILT_DEVICE: i16 = -8; +pub const EVFILT_EXCEPT: i16 = -9; pub const EV_ADD: u16 = 0x1; pub const EV_DELETE: u16 = 0x2; @@ -1304,6 +1306,7 @@ pub const EV_SYSFLAGS: u16 = 0xf800; pub const NOTE_LOWAT: u32 = 0x00000001; pub const NOTE_EOF: u32 = 0x00000002; +pub const NOTE_OOB: u32 = 0x00000004; pub const NOTE_DELETE: u32 = 0x00000001; pub const NOTE_WRITE: u32 = 0x00000002; pub const NOTE_EXTEND: u32 = 0x00000004; @@ -1320,6 +1323,7 @@ pub const NOTE_PCTRLMASK: u32 = 0xf0000000; pub const NOTE_TRACK: u32 = 0x00000001; pub const NOTE_TRACKERR: u32 = 0x00000002; pub const NOTE_CHILD: u32 = 0x00000004; +pub const NOTE_CHANGE: u32 = 0x00000001; pub const TMP_MAX: ::c_uint = 0x7fffffff;