diff options
author | Ryan Zoeller <rtzoeller@rtzoeller.com> | 2022-01-31 22:36:03 -0600 |
---|---|---|
committer | Ryan Zoeller <rtzoeller@rtzoeller.com> | 2022-02-02 17:53:52 -0600 |
commit | d3ff2666d699fd839e8ef530ad8d5bcea568dcff (patch) | |
tree | 833d58466d8077499ee41b19aa08ce49c51611d7 /src | |
parent | 7c9a7af4fce3ab4c958996b23e4e409b2eb0ddf9 (diff) | |
download | nix-d3ff2666d699fd839e8ef530ad8d5bcea568dcff.zip |
Document reboot.rs
Diffstat (limited to 'src')
-rw-r--r-- | src/sys/mod.rs | 1 | ||||
-rw-r--r-- | src/sys/reboot.rs | 9 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/sys/mod.rs b/src/sys/mod.rs index 63d1a181..7ad819d2 100644 --- a/src/sys/mod.rs +++ b/src/sys/mod.rs @@ -91,7 +91,6 @@ feature! { #[cfg(target_os = "linux")] feature! { #![feature = "reboot"] - #[allow(missing_docs)] pub mod reboot; } diff --git a/src/sys/reboot.rs b/src/sys/reboot.rs index 46ab68b6..2a8009e4 100644 --- a/src/sys/reboot.rs +++ b/src/sys/reboot.rs @@ -13,15 +13,22 @@ libc_enum! { #[repr(i32)] #[non_exhaustive] pub enum RebootMode { + /// Halt the system. RB_HALT_SYSTEM, + /// Execute a kernel that has been loaded earlier with + /// [`kexec_load(2)`](https://man7.org/linux/man-pages/man2/kexec_load.2.html). RB_KEXEC, + /// Stop the system and switch off power, if possible. RB_POWER_OFF, + /// Restart the system. RB_AUTOBOOT, - // we do not support Restart2, + // we do not support Restart2. + /// Suspend the system using software suspend. RB_SW_SUSPEND, } } +/// Reboots or shuts down the system. pub fn reboot(how: RebootMode) -> Result<Infallible> { unsafe { libc::reboot(how as libc::c_int) |