rusl 0.5.0

Rust linux interface layer
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::string::unix_str::UnixStr;
use crate::Result;
use sc::syscall;

/// Mount a swap.
/// See the [linux docs for details](https://man7.org/linux/man-pages/man2/swapon.2.html).
/// # Errors
/// See above.
pub fn swapon(path: &UnixStr, flags: i32) -> Result<()> {
    unsafe {
        let res = syscall!(SWAPON, path.as_ptr(), flags);
        bail_on_below_zero!(res, "`SWAPON` syscall failed");
    }
    Ok(())
}