Skip to content

Commit

Permalink
adding getentropy/getrandom to dragonflybsd.
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Mar 12, 2024
1 parent ba73a3e commit 4102f95
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions libc-test/semver/dragonfly.txt
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ GLOB_NOESCAPE
GLOB_NOMATCH
GLOB_NOSORT
GLOB_NOSPACE
GRND_INSECURE
GRND_NONBLOCK
GRND_RANDOM
HW_BYTEORDER
HW_DISKNAMES
HW_DISKSTATS
Expand Down Expand Up @@ -1308,6 +1311,7 @@ fstatfs
futimes
getdomainname
getdtablesize
getentropy
getgrent
getgrent_r
getgrgid
Expand All @@ -1331,6 +1335,7 @@ getprogname
getpwent
getpwent_r
getpwnam_r
getrandom
getresgid
getresuid
getrlimit
Expand Down
5 changes: 5 additions & 0 deletions src/unix/bsd/freebsdlike/dragonfly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1522,6 +1522,11 @@ pub const NGROUPS: usize = 16;
pub const RB_PAUSE: ::c_int = 0x40000;
pub const RB_VIDEO: ::c_int = 0x20000000;

// For getrandom()
pub const GRND_NONBLOCK: ::c_uint = 0x0001;
pub const GRND_RANDOM: ::c_uint = 0x0002;
pub const GRND_INSECURE: ::c_uint = 0x0004;

const_fn! {
{const} fn _CMSG_ALIGN(n: usize) -> usize {
(n + (::mem::size_of::<::c_long>() - 1)) & !(::mem::size_of::<::c_long>() - 1)
Expand Down
2 changes: 0 additions & 2 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5393,8 +5393,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;
Expand Down
3 changes: 3 additions & 0 deletions src/unix/bsd/freebsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1829,6 +1829,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")]
Expand Down

0 comments on commit 4102f95

Please sign in to comment.