Skip to content

Commit f741161

Browse files
committed
Auto merge of #3426 - devnexen:reboot_obsd, r=JohnTitor
adding reboot to netbsd/openbsd. close #3403
2 parents bbd3e20 + 5494582 commit f741161

File tree

6 files changed

+72
-0
lines changed

6 files changed

+72
-0
lines changed

libc-test/build.rs

+2
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ fn test_openbsd(target: &str) {
518518
"util.h",
519519
"ufs/ufs/quota.h",
520520
"pthread_np.h",
521+
"sys/reboot.h",
521522
"sys/syscall.h",
522523
"sys/shm.h",
523524
"sys/param.h",
@@ -1110,6 +1111,7 @@ fn test_netbsd(target: &str) {
11101111
"netinet/dccp.h",
11111112
"sys/event.h",
11121113
"sys/quota.h",
1114+
"sys/reboot.h",
11131115
"sys/shm.h",
11141116
"iconv.h",
11151117
}

libc-test/semver/netbsd.txt

+14
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,19 @@ Q_SETQUOTA
863863
Q_SYNC
864864
RADIXCHAR
865865
RAND_MAX
866+
RB_ASKNAME
867+
RB_AUTOBOOT
868+
RB_DUMP
869+
RB_HALT
870+
RB_INITNAME
871+
RB_KDB
872+
RB_MINIROOT
873+
RB_NOSYNC
874+
RB_POWERDOWN
875+
RB_RDONLY
876+
RB_SINGLE
877+
RB_STRING
878+
RB_USERCONF
866879
REG_ASSERT
867880
REG_ATOI
868881
REG_BACKR
@@ -1466,6 +1479,7 @@ readdir_r
14661479
readlinkat
14671480
reallocarr
14681481
reallocarray
1482+
reboot
14691483
recvmmsg
14701484
recvmsg
14711485
regcomp

libc-test/semver/openbsd.txt

+15
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,20 @@ Q_SETQUOTA
704704
Q_SYNC
705705
RADIXCHAR
706706
RAND_MAX
707+
RB_ASKNAME
708+
RB_AUTOBOOT
709+
RB_CONFIG
710+
RB_DUMP
711+
RB_GOODRANDOM
712+
RB_HALT
713+
RB_KDB
714+
RB_INITNAME
715+
RB_POWERDOWN
716+
RB_RESET
717+
RB_SERCONS
718+
RB_TIMEBAD
719+
RB_UNHIBERNATE
720+
RB_USERREQ
707721
REG_ASSERT
708722
REG_ATOI
709723
REG_BACKR
@@ -1174,6 +1188,7 @@ rand
11741188
readdir_r
11751189
readlinkat
11761190
reallocarray
1191+
reboot
11771192
recvmsg
11781193
regcomp
11791194
regerror

src/unix/bsd/netbsdlike/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,10 @@ pub const TIOCM_RI: ::c_int = TIOCM_RNG;
646646

647647
pub const TIMER_ABSTIME: ::c_int = 1;
648648

649+
// sys/reboot.h
650+
651+
pub const RB_AUTOBOOT: ::c_int = 0;
652+
649653
#[link(name = "util")]
650654
extern "C" {
651655
pub fn setgrent();

src/unix/bsd/netbsdlike/netbsd/mod.rs

+16
Original file line numberDiff line numberDiff line change
@@ -2434,6 +2434,20 @@ pub const GRND_NONBLOCK: ::c_uint = 0x1;
24342434
pub const GRND_RANDOM: ::c_uint = 0x2;
24352435
pub const GRND_INSECURE: ::c_uint = 0x4;
24362436

2437+
// sys/reboot.h
2438+
pub const RB_ASKNAME: ::c_int = 0x000000001;
2439+
pub const RB_SINGLE: ::c_int = 0x000000002;
2440+
pub const RB_NOSYNC: ::c_int = 0x000000004;
2441+
pub const RB_HALT: ::c_int = 0x000000008;
2442+
pub const RB_INITNAME: ::c_int = 0x000000010;
2443+
pub const RB_KDB: ::c_int = 0x000000040;
2444+
pub const RB_RDONLY: ::c_int = 0x000000080;
2445+
pub const RB_DUMP: ::c_int = 0x000000100;
2446+
pub const RB_MINIROOT: ::c_int = 0x000000200;
2447+
pub const RB_STRING: ::c_int = 0x000000400;
2448+
pub const RB_POWERDOWN: ::c_int = RB_HALT | 0x000000800;
2449+
pub const RB_USERCONF: ::c_int = 0x000001000;
2450+
24372451
cfg_if! {
24382452

24392453
if #[cfg(libc_const_extern_fn)] {
@@ -2984,6 +2998,8 @@ extern "C" {
29842998
newfd: ::c_int,
29852999
) -> ::c_int;
29863000
pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
3001+
3002+
pub fn reboot(mode: ::c_int, bootstr: *mut ::c_char) -> ::c_int;
29873003
}
29883004

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

src/unix/bsd/netbsdlike/openbsd/mod.rs

+21
Original file line numberDiff line numberDiff line change
@@ -1830,6 +1830,25 @@ pub const LC_ALL_MASK: ::c_int = (1 << _LC_LAST) - 2;
18301830

18311831
pub const LC_GLOBAL_LOCALE: ::locale_t = -1isize as ::locale_t;
18321832

1833+
// sys/reboot.h
1834+
pub const RB_ASKNAME: ::c_int = 0x00001;
1835+
pub const RB_SINGLE: ::c_int = 0x00002;
1836+
pub const RB_NOSYNC: ::c_int = 0x00004;
1837+
pub const RB_HALT: ::c_int = 0x00008;
1838+
pub const RB_INITNAME: ::c_int = 0x00010;
1839+
pub const RB_KDB: ::c_int = 0x00040;
1840+
pub const RB_RDONLY: ::c_int = 0x00080;
1841+
pub const RB_DUMP: ::c_int = 0x00100;
1842+
pub const RB_MINIROOT: ::c_int = 0x00200;
1843+
pub const RB_CONFIG: ::c_int = 0x00400;
1844+
pub const RB_TIMEBAD: ::c_int = 0x00800;
1845+
pub const RB_POWERDOWN: ::c_int = 0x01000;
1846+
pub const RB_SERCONS: ::c_int = 0x02000;
1847+
pub const RB_USERREQ: ::c_int = 0x04000;
1848+
pub const RB_RESET: ::c_int = 0x08000;
1849+
pub const RB_GOODRANDOM: ::c_int = 0x10000;
1850+
pub const RB_UNHIBERNATE: ::c_int = 0x20000;
1851+
18331852
const_fn! {
18341853
{const} fn _ALIGN(p: usize) -> usize {
18351854
(p + _ALIGNBYTES) & !_ALIGNBYTES
@@ -2057,6 +2076,8 @@ extern "C" {
20572076
) -> ::c_int;
20582077

20592078
pub fn mimmutable(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
2079+
2080+
pub fn reboot(mode: ::c_int) -> ::c_int;
20602081
}
20612082

20622083
#[link(name = "execinfo")]

0 commit comments

Comments
 (0)