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
14
15
16
17
use super::abi::*;
use crate::{
    result_from_value,
    AsRawFd,
};

/// Makes an ioctl system call on a file descriptor.
///
/// # Safety
///
/// This library does know know about the different ioctls. It is up to the caller to ensure that
/// the ioctl it is making is safe.
#[inline]
pub unsafe fn ioctl(fd: &impl AsRawFd, cmd: u32, arg: usize) -> crate::Result<i32> {
    let ret = unsafe { syscall_3(16, fd.as_raw_fd() as usize, cmd as usize, arg) as i32 };
    result_from_value(ret)
}