Skip to content

Commit 3b5109b

Browse files
committed
Auto merge of #3238 - valpackett:bsd, r=JohnTitor
more bsd things: kenv, setlogin, reboot, SCM_ constants
2 parents ae2c94f + 86bfc4e commit 3b5109b

File tree

9 files changed

+119
-1
lines changed

9 files changed

+119
-1
lines changed

libc-test/build.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,7 @@ fn test_dragonflybsd(target: &str) {
12321232
"glob.h",
12331233
"grp.h",
12341234
"ifaddrs.h",
1235+
"kenv.h",
12351236
"kvm.h",
12361237
"langinfo.h",
12371238
"libgen.h",
@@ -1276,6 +1277,7 @@ fn test_dragonflybsd(target: &str) {
12761277
"sys/mount.h",
12771278
"sys/procctl.h",
12781279
"sys/ptrace.h",
1280+
"sys/reboot.h",
12791281
"sys/resource.h",
12801282
"sys/rtprio.h",
12811283
"sys/sched.h",
@@ -1933,6 +1935,7 @@ fn test_freebsd(target: &str) {
19331935
"grp.h",
19341936
"iconv.h",
19351937
"ifaddrs.h",
1938+
"kenv.h",
19361939
"langinfo.h",
19371940
"libgen.h",
19381941
"libutil.h",
@@ -1991,6 +1994,7 @@ fn test_freebsd(target: &str) {
19911994
"sys/ptrace.h",
19921995
"sys/queue.h",
19931996
"sys/random.h",
1997+
"sys/reboot.h",
19941998
"sys/resource.h",
19951999
"sys/rtprio.h",
19962000
"sys/sem.h",

libc-test/semver/dragonfly.txt

+26
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,12 @@ IP_TOS
503503
ITIMER_PROF
504504
ITIMER_REAL
505505
ITIMER_VIRTUAL
506+
KENV_GET
507+
KENV_SET
508+
KENV_UNSET
509+
KENV_DUMP
510+
KENV_MNAMELEN
511+
KENV_MVALLEN
506512
KERN_ARGMAX
507513
KERN_BOOTFILE
508514
KERN_BOOTTIME
@@ -796,6 +802,25 @@ Q_SETQUOTA
796802
Q_SYNC
797803
RADIXCHAR
798804
RAND_MAX
805+
RB_ASKNAME
806+
RB_SINGLE
807+
RB_NOSYNC
808+
RB_HALT
809+
RB_INITNAME
810+
RB_DFLTROOT
811+
RB_KDB
812+
RB_RDONLY
813+
RB_DUMP
814+
RB_MINIROOT
815+
RB_VERBOSE
816+
RB_SERIAL
817+
RB_CDROM
818+
RB_POWEROFF
819+
RB_GDB
820+
RB_MUTE
821+
RB_SELFTEST
822+
RB_PAUSE
823+
RB_VIDEO
799824
REG_ASSERT
800825
REG_ATOI
801826
REG_BACKR
@@ -1484,6 +1509,7 @@ setgroups
14841509
sethostid
14851510
sethostname
14861511
setitimer
1512+
setlogin
14871513
setpriority
14881514
setproctitle
14891515
setprogname

libc-test/semver/freebsd.txt

+37-1
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,14 @@ JAIL_SYS_DISABLE
592592
JAIL_SYS_INHERIT
593593
JAIL_SYS_NEW
594594
JAIL_UPDATE
595+
KENV_GET
596+
KENV_SET
597+
KENV_UNSET
598+
KENV_DUMP
599+
KENV_DUMP_LOADER
600+
KENV_DUMP_STATIC
601+
KENV_MNAMELEN
602+
KENV_MVALLEN
595603
KERN_ARGMAX
596604
KERN_ARND
597605
KERN_BOOTFILE
@@ -1026,6 +1034,28 @@ Q_SETQUOTA
10261034
Q_SYNC
10271035
RADIXCHAR
10281036
RAND_MAX
1037+
RB_ASKNAME
1038+
RB_SINGLE
1039+
RB_NOSYNC
1040+
RB_HALT
1041+
RB_INITNAME
1042+
RB_DFLTROOT
1043+
RB_KDB
1044+
RB_RDONLY
1045+
RB_DUMP
1046+
RB_MINIROOT
1047+
RB_VERBOSE
1048+
RB_SERIAL
1049+
RB_CDROM
1050+
RB_POWEROFF
1051+
RB_GDB
1052+
RB_MUTE
1053+
RB_SELFTEST
1054+
RB_PAUSE
1055+
RB_REROOT
1056+
RB_POWERCYCLE
1057+
RB_PROBE
1058+
RB_MULTIPLE
10291059
REG_ASSERT
10301060
REG_ATOI
10311061
REG_BACKR
@@ -1105,9 +1135,14 @@ SCALE_PPM
11051135
SCHED_FIFO
11061136
SCHED_OTHER
11071137
SCHED_RR
1108-
SCM_CREDS
11091138
SCM_RIGHTS
11101139
SCM_TIMESTAMP
1140+
SCM_CREDS
1141+
SCM_BINTIME
1142+
SCM_REALTIME
1143+
SCM_MONOTONIC
1144+
SCM_TIME_INFO
1145+
SCM_CREDS2
11111146
SCTP_ACTIVE
11121147
SCTP_ALL_ASSOC
11131148
SCTP_ADAPTATION_LAYER
@@ -2126,6 +2161,7 @@ setgroups
21262161
sethostid
21272162
sethostname
21282163
setitimer
2164+
setlogin
21292165
setpriority
21302166
setproctitle
21312167
setprogname

libc-test/semver/netbsd.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,7 @@ setgroups
14911491
sethostid
14921492
sethostname
14931493
setitimer
1494+
setlogin
14941495
setpriority
14951496
setproctitle
14961497
setprogname

libc-test/semver/openbsd.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,7 @@ setgroups
11991199
sethostid
12001200
sethostname
12011201
setitimer
1202+
setlogin
12021203
setpriority
12031204
setproctitle
12041205
setprogname

src/unix/bsd/freebsdlike/dragonfly/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1519,6 +1519,9 @@ pub const MAXCOMLEN: usize = 16;
15191519
pub const MAXLOGNAME: usize = 33;
15201520
pub const NGROUPS: usize = 16;
15211521

1522+
pub const RB_PAUSE: ::c_int = 0x40000;
1523+
pub const RB_VIDEO: ::c_int = 0x20000000;
1524+
15221525
const_fn! {
15231526
{const} fn _CMSG_ALIGN(n: usize) -> usize {
15241527
(n + (::mem::size_of::<::c_long>() - 1)) & !(::mem::size_of::<::c_long>() - 1)

src/unix/bsd/freebsdlike/freebsd/mod.rs

+13
Original file line numberDiff line numberDiff line change
@@ -2997,6 +2997,10 @@ pub const MNT_SNAPSHOT: ::c_int = 0x01000000;
29972997
pub const MNT_UNION: ::c_int = 0x00000020;
29982998
pub const MNT_NONBUSY: ::c_int = 0x04000000;
29992999

3000+
pub const SCM_BINTIME: ::c_int = 0x04;
3001+
pub const SCM_REALTIME: ::c_int = 0x05;
3002+
pub const SCM_MONOTONIC: ::c_int = 0x06;
3003+
pub const SCM_TIME_INFO: ::c_int = 0x07;
30003004
pub const SCM_CREDS2: ::c_int = 0x08;
30013005

30023006
pub const SO_BINTIME: ::c_int = 0x2000;
@@ -4680,6 +4684,15 @@ pub const SCTP_ASSOC_RESET_FAILED: ::c_int = 0x0008;
46804684
pub const SCTP_STREAM_CHANGE_DENIED: ::c_int = 0x0004;
46814685
pub const SCTP_STREAM_CHANGE_FAILED: ::c_int = 0x0008;
46824686

4687+
pub const KENV_DUMP_LOADER: ::c_int = 4;
4688+
pub const KENV_DUMP_STATIC: ::c_int = 5;
4689+
4690+
pub const RB_PAUSE: ::c_int = 0x100000;
4691+
pub const RB_REROOT: ::c_int = 0x200000;
4692+
pub const RB_POWERCYCLE: ::c_int = 0x400000;
4693+
pub const RB_PROBE: ::c_int = 0x10000000;
4694+
pub const RB_MULTIPLE: ::c_int = 0x20000000;
4695+
46834696
cfg_if! {
46844697
if #[cfg(libc_const_extern_fn)] {
46854698
pub const fn MAP_ALIGNED(a: ::c_int) -> ::c_int {

src/unix/bsd/freebsdlike/mod.rs

+33
Original file line numberDiff line numberDiff line change
@@ -1434,6 +1434,31 @@ pub const SHM_RND: ::c_int = 0o20000;
14341434
pub const SHM_R: ::c_int = 0o400;
14351435
pub const SHM_W: ::c_int = 0o200;
14361436

1437+
pub const KENV_GET: ::c_int = 0;
1438+
pub const KENV_SET: ::c_int = 1;
1439+
pub const KENV_UNSET: ::c_int = 2;
1440+
pub const KENV_DUMP: ::c_int = 3;
1441+
pub const KENV_MNAMELEN: ::c_int = 128;
1442+
pub const KENV_MVALLEN: ::c_int = 128;
1443+
1444+
pub const RB_ASKNAME: ::c_int = 0x001;
1445+
pub const RB_SINGLE: ::c_int = 0x002;
1446+
pub const RB_NOSYNC: ::c_int = 0x004;
1447+
pub const RB_HALT: ::c_int = 0x008;
1448+
pub const RB_INITNAME: ::c_int = 0x010;
1449+
pub const RB_DFLTROOT: ::c_int = 0x020;
1450+
pub const RB_KDB: ::c_int = 0x040;
1451+
pub const RB_RDONLY: ::c_int = 0x080;
1452+
pub const RB_DUMP: ::c_int = 0x100;
1453+
pub const RB_MINIROOT: ::c_int = 0x200;
1454+
pub const RB_VERBOSE: ::c_int = 0x800;
1455+
pub const RB_SERIAL: ::c_int = 0x1000;
1456+
pub const RB_CDROM: ::c_int = 0x2000;
1457+
pub const RB_POWEROFF: ::c_int = 0x4000;
1458+
pub const RB_GDB: ::c_int = 0x8000;
1459+
pub const RB_MUTE: ::c_int = 0x10000;
1460+
pub const RB_SELFTEST: ::c_int = 0x20000;
1461+
14371462
safe_f! {
14381463
pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
14391464
status == 0x13
@@ -1737,6 +1762,14 @@ extern "C" {
17371762
pub fn eui64_hostton(hostname: *const ::c_char, id: *mut eui64) -> ::c_int;
17381763

17391764
pub fn eaccess(path: *const ::c_char, mode: ::c_int) -> ::c_int;
1765+
1766+
pub fn kenv(
1767+
action: ::c_int,
1768+
name: *const ::c_char,
1769+
value: *mut ::c_char,
1770+
len: ::c_int,
1771+
) -> ::c_int;
1772+
pub fn reboot(howto: ::c_int) -> ::c_int;
17401773
}
17411774

17421775
#[link(name = "rt")]

src/unix/bsd/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ extern "C" {
628628
pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
629629
pub fn freeifaddrs(ifa: *mut ::ifaddrs);
630630
pub fn setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int;
631+
pub fn setlogin(name: *const ::c_char) -> ::c_int;
631632
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
632633
pub fn kqueue() -> ::c_int;
633634
pub fn unmount(target: *const ::c_char, arg: ::c_int) -> ::c_int;

0 commit comments

Comments
 (0)