Skip to content

Commit

Permalink
freebsdlike: add kenv
Browse files Browse the repository at this point in the history
  • Loading branch information
valpackett committed May 7, 2023
1 parent ae2c94f commit 6c00b37
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,7 @@ fn test_dragonflybsd(target: &str) {
"glob.h",
"grp.h",
"ifaddrs.h",
"kenv.h",
"kvm.h",
"langinfo.h",
"libgen.h",
Expand Down Expand Up @@ -1933,6 +1934,7 @@ fn test_freebsd(target: &str) {
"grp.h",
"iconv.h",
"ifaddrs.h",
"kenv.h",
"langinfo.h",
"libgen.h",
"libutil.h",
Expand Down
6 changes: 6 additions & 0 deletions libc-test/semver/dragonfly.txt
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,12 @@ IP_TOS
ITIMER_PROF
ITIMER_REAL
ITIMER_VIRTUAL
KENV_GET
KENV_SET
KENV_UNSET
KENV_DUMP
KENV_MNAMELEN
KENV_MVALLEN
KERN_ARGMAX
KERN_BOOTFILE
KERN_BOOTTIME
Expand Down
8 changes: 8 additions & 0 deletions libc-test/semver/freebsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,14 @@ JAIL_SYS_DISABLE
JAIL_SYS_INHERIT
JAIL_SYS_NEW
JAIL_UPDATE
KENV_GET
KENV_SET
KENV_UNSET
KENV_DUMP
KENV_DUMP_LOADER
KENV_DUMP_STATIC
KENV_MNAMELEN
KENV_MVALLEN
KERN_ARGMAX
KERN_ARND
KERN_BOOTFILE
Expand Down
3 changes: 3 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4680,6 +4680,9 @@ pub const SCTP_ASSOC_RESET_FAILED: ::c_int = 0x0008;
pub const SCTP_STREAM_CHANGE_DENIED: ::c_int = 0x0004;
pub const SCTP_STREAM_CHANGE_FAILED: ::c_int = 0x0008;

pub const KENV_DUMP_LOADER: ::c_int = 4;
pub const KENV_DUMP_STATIC: ::c_int = 5;

cfg_if! {
if #[cfg(libc_const_extern_fn)] {
pub const fn MAP_ALIGNED(a: ::c_int) -> ::c_int {
Expand Down
14 changes: 14 additions & 0 deletions src/unix/bsd/freebsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,13 @@ pub const SHM_RND: ::c_int = 0o20000;
pub const SHM_R: ::c_int = 0o400;
pub const SHM_W: ::c_int = 0o200;

pub const KENV_GET: ::c_int = 0;
pub const KENV_SET: ::c_int = 1;
pub const KENV_UNSET: ::c_int = 2;
pub const KENV_DUMP: ::c_int = 3;
pub const KENV_MNAMELEN: ::c_int = 128;
pub const KENV_MVALLEN: ::c_int = 128;

safe_f! {
pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
status == 0x13
Expand Down Expand Up @@ -1737,6 +1744,13 @@ extern "C" {
pub fn eui64_hostton(hostname: *const ::c_char, id: *mut eui64) -> ::c_int;

pub fn eaccess(path: *const ::c_char, mode: ::c_int) -> ::c_int;

pub fn kenv(
action: ::c_int,
name: *const ::c_char,
value: *mut ::c_char,
len: ::c_int,
) -> ::c_int;
}

#[link(name = "rt")]
Expand Down

0 comments on commit 6c00b37

Please sign in to comment.