summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-05-07 12:59:48 +0000
committerbors <bors@rust-lang.org>2023-05-07 12:59:48 +0000
commit3b5109b3da613de31eb0d6bd42c9d6a6033360fb (patch)
treef3146865e33896ea7aed0ab21e7564da80e9ae10
parentae2c94f09ac7e9ddec491f581abea19a38fec0be (diff)
parent86bfc4eb2645863010330c2d05558bbe99cc31b4 (diff)
downloadrust-libc-3b5109b3da613de31eb0d6bd42c9d6a6033360fb.tar.gz
Auto merge of #3238 - valpackett:bsd, r=JohnTitor
more bsd things: kenv, setlogin, reboot, SCM_ constants
-rw-r--r--libc-test/build.rs4
-rw-r--r--libc-test/semver/dragonfly.txt26
-rw-r--r--libc-test/semver/freebsd.txt38
-rw-r--r--libc-test/semver/netbsd.txt1
-rw-r--r--libc-test/semver/openbsd.txt1
-rw-r--r--src/unix/bsd/freebsdlike/dragonfly/mod.rs3
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/mod.rs13
-rw-r--r--src/unix/bsd/freebsdlike/mod.rs33
-rw-r--r--src/unix/bsd/mod.rs1
9 files changed, 119 insertions, 1 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 9f76583bff..2f993486ef 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",
@@ -1276,6 +1277,7 @@ fn test_dragonflybsd(target: &str) {
"sys/mount.h",
"sys/procctl.h",
"sys/ptrace.h",
+ "sys/reboot.h",
"sys/resource.h",
"sys/rtprio.h",
"sys/sched.h",
@@ -1933,6 +1935,7 @@ fn test_freebsd(target: &str) {
"grp.h",
"iconv.h",
"ifaddrs.h",
+ "kenv.h",
"langinfo.h",
"libgen.h",
"libutil.h",
@@ -1991,6 +1994,7 @@ fn test_freebsd(target: &str) {
"sys/ptrace.h",
"sys/queue.h",
"sys/random.h",
+ "sys/reboot.h",
"sys/resource.h",
"sys/rtprio.h",
"sys/sem.h",
diff --git a/libc-test/semver/dragonfly.txt b/libc-test/semver/dragonfly.txt
index 23c66c3298..e73dd3dc7e 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
@@ -796,6 +802,25 @@ Q_SETQUOTA
Q_SYNC
RADIXCHAR
RAND_MAX
+RB_ASKNAME
+RB_SINGLE
+RB_NOSYNC
+RB_HALT
+RB_INITNAME
+RB_DFLTROOT
+RB_KDB
+RB_RDONLY
+RB_DUMP
+RB_MINIROOT
+RB_VERBOSE
+RB_SERIAL
+RB_CDROM
+RB_POWEROFF
+RB_GDB
+RB_MUTE
+RB_SELFTEST
+RB_PAUSE
+RB_VIDEO
REG_ASSERT
REG_ATOI
REG_BACKR
@@ -1484,6 +1509,7 @@ setgroups
sethostid
sethostname
setitimer
+setlogin
setpriority
setproctitle
setprogname
diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt
index ffb424e8b5..e12a3642a8 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
@@ -1026,6 +1034,28 @@ Q_SETQUOTA
Q_SYNC
RADIXCHAR
RAND_MAX
+RB_ASKNAME
+RB_SINGLE
+RB_NOSYNC
+RB_HALT
+RB_INITNAME
+RB_DFLTROOT
+RB_KDB
+RB_RDONLY
+RB_DUMP
+RB_MINIROOT
+RB_VERBOSE
+RB_SERIAL
+RB_CDROM
+RB_POWEROFF
+RB_GDB
+RB_MUTE
+RB_SELFTEST
+RB_PAUSE
+RB_REROOT
+RB_POWERCYCLE
+RB_PROBE
+RB_MULTIPLE
REG_ASSERT
REG_ATOI
REG_BACKR
@@ -1105,9 +1135,14 @@ SCALE_PPM
SCHED_FIFO
SCHED_OTHER
SCHED_RR
-SCM_CREDS
SCM_RIGHTS
SCM_TIMESTAMP
+SCM_CREDS
+SCM_BINTIME
+SCM_REALTIME
+SCM_MONOTONIC
+SCM_TIME_INFO
+SCM_CREDS2
SCTP_ACTIVE
SCTP_ALL_ASSOC
SCTP_ADAPTATION_LAYER
@@ -2126,6 +2161,7 @@ setgroups
sethostid
sethostname
setitimer
+setlogin
setpriority
setproctitle
setprogname
diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt
index 6dd75bde86..6150dbb81c 100644
--- a/libc-test/semver/netbsd.txt
+++ b/libc-test/semver/netbsd.txt
@@ -1491,6 +1491,7 @@ setgroups
sethostid
sethostname
setitimer
+setlogin
setpriority
setproctitle
setprogname
diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt
index bcd65e09e5..afbf8eb572 100644
--- a/libc-test/semver/openbsd.txt
+++ b/libc-test/semver/openbsd.txt
@@ -1199,6 +1199,7 @@ setgroups
sethostid
sethostname
setitimer
+setlogin
setpriority
setproctitle
setprogname
diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
index 72ea8c7504..d323a43540 100644
--- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs
+++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
@@ -1519,6 +1519,9 @@ pub const MAXCOMLEN: usize = 16;
pub const MAXLOGNAME: usize = 33;
pub const NGROUPS: usize = 16;
+pub const RB_PAUSE: ::c_int = 0x40000;
+pub const RB_VIDEO: ::c_int = 0x20000000;
+
const_fn! {
{const} fn _CMSG_ALIGN(n: usize) -> usize {
(n + (::mem::size_of::<::c_long>() - 1)) & !(::mem::size_of::<::c_long>() - 1)
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index c453e7c9b1..6db9fa2c74 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -2997,6 +2997,10 @@ pub const MNT_SNAPSHOT: ::c_int = 0x01000000;
pub const MNT_UNION: ::c_int = 0x00000020;
pub const MNT_NONBUSY: ::c_int = 0x04000000;
+pub const SCM_BINTIME: ::c_int = 0x04;
+pub const SCM_REALTIME: ::c_int = 0x05;
+pub const SCM_MONOTONIC: ::c_int = 0x06;
+pub const SCM_TIME_INFO: ::c_int = 0x07;
pub const SCM_CREDS2: ::c_int = 0x08;
pub const SO_BINTIME: ::c_int = 0x2000;
@@ -4680,6 +4684,15 @@ 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;
+
+pub const RB_PAUSE: ::c_int = 0x100000;
+pub const RB_REROOT: ::c_int = 0x200000;
+pub const RB_POWERCYCLE: ::c_int = 0x400000;
+pub const RB_PROBE: ::c_int = 0x10000000;
+pub const RB_MULTIPLE: ::c_int = 0x20000000;
+
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..f328f0dd76 100644
--- a/src/unix/bsd/freebsdlike/mod.rs
+++ b/src/unix/bsd/freebsdlike/mod.rs
@@ -1434,6 +1434,31 @@ 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;
+
+pub const RB_ASKNAME: ::c_int = 0x001;
+pub const RB_SINGLE: ::c_int = 0x002;
+pub const RB_NOSYNC: ::c_int = 0x004;
+pub const RB_HALT: ::c_int = 0x008;
+pub const RB_INITNAME: ::c_int = 0x010;
+pub const RB_DFLTROOT: ::c_int = 0x020;
+pub const RB_KDB: ::c_int = 0x040;
+pub const RB_RDONLY: ::c_int = 0x080;
+pub const RB_DUMP: ::c_int = 0x100;
+pub const RB_MINIROOT: ::c_int = 0x200;
+pub const RB_VERBOSE: ::c_int = 0x800;
+pub const RB_SERIAL: ::c_int = 0x1000;
+pub const RB_CDROM: ::c_int = 0x2000;
+pub const RB_POWEROFF: ::c_int = 0x4000;
+pub const RB_GDB: ::c_int = 0x8000;
+pub const RB_MUTE: ::c_int = 0x10000;
+pub const RB_SELFTEST: ::c_int = 0x20000;
+
safe_f! {
pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
status == 0x13
@@ -1737,6 +1762,14 @@ 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;
+ pub fn reboot(howto: ::c_int) -> ::c_int;
}
#[link(name = "rt")]
diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs
index 84e572edab..6ce041357e 100644
--- a/src/unix/bsd/mod.rs
+++ b/src/unix/bsd/mod.rs
@@ -628,6 +628,7 @@ extern "C" {
pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
pub fn freeifaddrs(ifa: *mut ::ifaddrs);
pub fn setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int;
+ pub fn setlogin(name: *const ::c_char) -> ::c_int;
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
pub fn kqueue() -> ::c_int;
pub fn unmount(target: *const ::c_char, arg: ::c_int) -> ::c_int;