lx 0.4.0

A no_std crate to use Linux system calls
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use super::abi::*;
use crate::{
    unit_result_from_value,
    AsRawFd,
};

#[inline]
pub fn close(fd: &impl AsRawFd) -> crate::Result<()> {
    // SAFETY: There is no pointer being passed, the worst that can happen is that the kernel
    // returns an error if the `fd` is invalid.
    let ret = unsafe { syscall_1(3, fd.as_raw_fd() as usize) as u32 };
    unit_result_from_value(ret)
}