summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVal Packett <val@packett.cool>2023-05-07 03:51:14 -0300
committerVal Packett <val@packett.cool>2023-05-07 04:25:03 -0300
commit6c00b3761c89b5e5211311c4d7d10714b91d04e8 (patch)
treede76501da7f1497ca2884fc05a3c2df4f3c654f8
parentae2c94f09ac7e9ddec491f581abea19a38fec0be (diff)
downloadrust-libc-6c00b3761c89b5e5211311c4d7d10714b91d04e8.tar.gz
freebsdlike: add kenv
-rw-r--r--libc-test/build.rs2
-rw-r--r--libc-test/semver/dragonfly.txt6
-rw-r--r--libc-test/semver/freebsd.txt8
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/mod.rs3
-rw-r--r--src/unix/bsd/freebsdlike/mod.rs14
5 files changed, 33 insertions, 0 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 9f76583bff..6d07d5bfc9 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -1232,6 +1232,7 @@ fn test_dragonflybsd(target: &str) {
"glob.h",
"grp.h",
"ifaddrs.h",
+ "kenv.h",
"kvm.h",
"langinfo.h",
"libgen.h",
@@ -1933,6 +1934,7 @@ fn test_freebsd(target: &str) {
"grp.h",
"iconv.h",
"ifaddrs.h",
+ "kenv.h",
"langinfo.h",
"libgen.h",
"libutil.h",
diff --git a/libc-test/semver/dragonfly.txt b/libc-test/semver/dragonfly.txt
index 23c66c3298..870cf6da69 100644
--- a/libc-test/semver/dragonfly.txt
+++ b/libc-test/semver/dragonfly.txt
@@ -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
diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt
index ffb424e8b5..953689ee09 100644
--- a/libc-test/semver/freebsd.txt
+++ b/libc-test/semver/freebsd.txt
@@ -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
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index c453e7c9b1..24c9316b58 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -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 {
diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs
index 6a0f383bc0..d89d5f8ffe 100644
--- a/src/unix/bsd/freebsdlike/mod.rs
+++ b/src/unix/bsd/freebsdlike/mod.rs
@@ -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
@@ -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")]