()
| 1 | #[test] |
| 2 | #[cfg(feature = "thread")] |
| 3 | fn test_reboot() { |
| 4 | use rustix::io::Errno; |
| 5 | use rustix::system::{self, RebootCommand}; |
| 6 | use rustix::thread::{self, CapabilitySet}; |
| 7 | |
| 8 | let mut capabilities = thread::capabilities(None).expect("Failed to get capabilities"); |
| 9 | |
| 10 | capabilities.effective.set(CapabilitySet::SYS_BOOT, false); |
| 11 | |
| 12 | thread::set_capabilities(None, capabilities).expect("Failed to set capabilities"); |
| 13 | |
| 14 | // The reboot syscall requires the `CapabilitySet::SYS_BOOT` permission |
| 15 | // to be called, otherwise [`Errno::PERM`] is returned |
| 16 | assert_eq!(system::reboot(RebootCommand::Restart), Err(Errno::PERM)); |
| 17 | } |
nothing calls this directly
no test coverage detected