summaryrefslogtreecommitdiff
path: root/src/sys/reboot.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys/reboot.rs')
-rw-r--r--src/sys/reboot.rs27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/sys/reboot.rs b/src/sys/reboot.rs
index 94f30f62..5b340e32 100644
--- a/src/sys/reboot.rs
+++ b/src/sys/reboot.rs
@@ -5,19 +5,20 @@ use libc;
use void::Void;
use std::mem::drop;
-/// How exactly should the system be rebooted.
-///
-/// See [`set_cad_enabled()`](fn.set_cad_enabled.html) for
-/// enabling/disabling Ctrl-Alt-Delete.
-#[repr(i32)]
-#[derive(Clone, Copy, Debug, Eq, PartialEq)]
-pub enum RebootMode {
- RB_HALT_SYSTEM = libc::RB_HALT_SYSTEM,
- RB_KEXEC = libc::RB_KEXEC,
- RB_POWER_OFF = libc::RB_POWER_OFF,
- RB_AUTOBOOT = libc::RB_AUTOBOOT,
- // we do not support Restart2,
- RB_SW_SUSPEND = libc::RB_SW_SUSPEND,
+libc_enum! {
+ /// How exactly should the system be rebooted.
+ ///
+ /// See [`set_cad_enabled()`](fn.set_cad_enabled.html) for
+ /// enabling/disabling Ctrl-Alt-Delete.
+ #[repr(i32)]
+ pub enum RebootMode {
+ RB_HALT_SYSTEM,
+ RB_KEXEC,
+ RB_POWER_OFF,
+ RB_AUTOBOOT,
+ // we do not support Restart2,
+ RB_SW_SUSPEND,
+ }
}
pub fn reboot(how: RebootMode) -> Result<Void> {