123456789101112131415161718192021222324252627282930313233 |
- use nix::sys::reboot::RebootMode;
- pub fn shutdown() -> !{
- println!("[ @yukari ] system shutting down...");
- let _ = nix::sys::reboot::reboot(RebootMode::RB_POWER_OFF);
- loop {
- }
- }
- pub fn reboot() -> ! {
- println!("[ @yukari ] system rebooting...");
- let _ = nix::sys::reboot::reboot(RebootMode::RB_AUTOBOOT);
- loop {
- }
- }
- pub fn safe_shutdown() -> ! {
- sync();
- sync();
- sync();
- shutdown()
- }
- pub fn safe_reboot() -> ! {
- sync();
- sync();
- sync();
- reboot()
- }
- pub fn sync() {
- nix::unistd::sync();
- }
|