From 83d35ffee90f6f36e991f30f4d46c766a3f6cd37 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Tue, 12 Mar 2024 01:05:50 +0000 Subject: [PATCH 1/2] adding getentropy/getrandom to dragonflybsd. (apply to `main`) (cherry picked from commit e79e95f7909c9e04b620b4ec088baaec0377ebb6) --- libc-test/semver/dragonfly.txt | 5 +++++ src/unix/bsd/freebsdlike/freebsd/mod.rs | 7 ------- src/unix/bsd/freebsdlike/mod.rs | 8 ++++++++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/libc-test/semver/dragonfly.txt b/libc-test/semver/dragonfly.txt index a0cc6c6c83fc5..b9ccffb681ad3 100644 --- a/libc-test/semver/dragonfly.txt +++ b/libc-test/semver/dragonfly.txt @@ -326,6 +326,9 @@ GLOB_NOESCAPE GLOB_NOMATCH GLOB_NOSORT GLOB_NOSPACE +GRND_INSECURE +GRND_NONBLOCK +GRND_RANDOM HW_BYTEORDER HW_DISKNAMES HW_DISKSTATS @@ -1308,6 +1311,7 @@ fstatfs futimes getdomainname getdtablesize +getentropy getgrent getgrent_r getgrgid @@ -1331,6 +1335,7 @@ getprogname getpwent getpwent_r getpwnam_r +getrandom getresgid getresuid getrlimit diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 307ca87127f31..3cf1fc1aeeef3 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -3997,11 +3997,6 @@ pub const F_SEAL_WRITE: ::c_int = 8; // for use with fspacectl pub const SPACECTL_DEALLOC: ::c_int = 1; -// For getrandom() -pub const GRND_NONBLOCK: ::c_uint = 0x1; -pub const GRND_RANDOM: ::c_uint = 0x2; -pub const GRND_INSECURE: ::c_uint = 0x4; - // For realhostname* api pub const HOSTNAME_FOUND: ::c_int = 0; pub const HOSTNAME_INCORRECTNAME: ::c_int = 1; @@ -5513,8 +5508,6 @@ extern "C" { pub fn fdatasync(fd: ::c_int) -> ::c_int; - pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; - pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int; pub fn setproctitle_fast(fmt: *const ::c_char, ...); pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 89557e1520622..49bfadae62e20 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1450,6 +1450,11 @@ pub const RB_GDB: ::c_int = 0x8000; pub const RB_MUTE: ::c_int = 0x10000; pub const RB_SELFTEST: ::c_int = 0x20000; +// For getrandom() +pub const GRND_NONBLOCK: ::c_uint = 0x1; +pub const GRND_RANDOM: ::c_uint = 0x2; +pub const GRND_INSECURE: ::c_uint = 0x4; + safe_f! { pub {const} fn WIFCONTINUED(status: ::c_int) -> bool { status == 0x13 @@ -1819,6 +1824,9 @@ extern "C" { abs_timeout: *const ::timespec, ) -> ::c_int; pub fn mq_unlink(name: *const ::c_char) -> ::c_int; + + pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; + pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; } #[link(name = "util")] From d521a9d746a74159f46acc94646e39c24c5c0813 Mon Sep 17 00:00:00 2001 From: Severen Redwood Date: Sun, 17 Mar 2024 18:57:01 +1300 Subject: [PATCH 2/2] Correct the value of FAN_MARK_IGNORE (apply to `main`) (cherry picked from commit 41286408751b62ba22ce9fb579ed8e60479785dc) --- src/unix/linux_like/linux/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 2ce09ed168df8..68fcf115d4f52 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -4577,7 +4577,7 @@ pub const FAN_MARK_IGNORED_MASK: ::c_uint = 0x0000_0020; pub const FAN_MARK_IGNORED_SURV_MODIFY: ::c_uint = 0x0000_0040; pub const FAN_MARK_FLUSH: ::c_uint = 0x0000_0080; pub const FAN_MARK_EVICTABLE: ::c_uint = 0x0000_0200; -pub const FAN_MARK_IGNORE: ::c_uint = 0x0000_0100; +pub const FAN_MARK_IGNORE: ::c_uint = 0x0000_0400; pub const FAN_MARK_INODE: ::c_uint = 0x0000_0000; pub const FAN_MARK_MOUNT: ::c_uint = 0x0000_0010;