[−][src]Struct iocuddle::Ioctl
A defined ioctl
along with its associated direction
and type
Implementations
impl<D, T> Ioctl<D, T>
[src]
pub const unsafe fn classic(request: c_ulong) -> Self
[src]
Define a new ioctl
with an associated direction
and type
The request
argument is the allocated integer which uniquely
identifies this ioctl
.
Safety
This function is unsafe because defining an ioctl
with an incorrect
request
, direction
or argument type
can later result in memory
corruption. You are responsible to ensure these values are correct.
Further, you are responsible to ensure that the argument type
itself
provides appropriate safe wrappers around its raw contents. For some
type
s none are required. For others, particularly type
s that pass
pointers to the kernel as u64
, you need to ensure that things like
lifetimes are correct.
pub const unsafe fn lie<E, U>(self) -> Ioctl<E, U>
[src]
Lie about the ioctl direction or type
This function should be avoided unless necessary.
Sometimes kernel developers make mistakes and use the wrong macros
or types during their ioctl definitions. However, once merged these
form part of the userspace API and won't be broken. Therefore, we
need a way to use the request
number with the incorrect type. This
function allows this.
Whenever using this function, it would be wise to include a comment with a link to the kernel's ioctl definition and explaining why the definition is incorrect.
Safety
For safety details, see Ioctl::classic.
Additionally, one should note that this function discards your normal protections. So you need to make sure that you have it correct.
impl Ioctl<Read, c_void>
[src]
pub fn ioctl(self, fd: &impl AsRawFd) -> Result<c_uint>
[src]
Issue an ioctl
to read a file descriptor's metadata as c_uint
.
No argument is supplied to the internal ioctl()
call. The raw
(positive) return value from the internal ioctl()
call is returned
on success.
impl<T, '_> Ioctl<Read, &'_ T>
[src]
pub fn ioctl(self, fd: &impl AsRawFd) -> Result<(c_uint, T)>
[src]
Issue an ioctl
to read a file descriptor's metadata as type T
.
A zeroed instance of type T
is passed as the first argument to the
internal ioctl()
call. Upon success, returns the raw (positive)
return value and the instance of T
.
impl Ioctl<Write, c_void>
[src]
pub fn ioctl(self, fd: &mut impl AsRawFd) -> Result<c_uint>
[src]
Issue an ioctl
to modify a file descriptor
No argument is provided.
On success, returns the (positive) return value.
impl Ioctl<Write, c_int>
[src]
pub fn ioctl(self, fd: &mut impl AsRawFd, data: c_int) -> Result<c_uint>
[src]
Issue an ioctl
to modify a file descriptor
A C-integer argument is provided.
On success, returns the (positive) return value.
impl<T, '_> Ioctl<Write, &'_ T>
[src]
pub fn ioctl(self, fd: &mut impl AsRawFd, data: &T) -> Result<c_uint>
[src]
Issue an ioctl
to modify a file descriptor
A reference to an immutable instance of T
is provided as the argument.
On success, returns the (positive) return value.
impl<T, '_> Ioctl<WriteRead, &'_ T>
[src]
pub fn ioctl(self, fd: &mut impl AsRawFd, data: &mut T) -> Result<c_uint>
[src]
Issue an ioctl
to modify a file descriptor and read its metadata
A reference to a mutable instance of T
is provided as the argument.
On success, returns the (positive) return value.
Trait Implementations
impl<D: Clone, T: Clone> Clone for Ioctl<D, T>
[src]
impl<D: Copy, T: Copy> Copy for Ioctl<D, T>
[src]
impl<D: Eq, T: Eq> Eq for Ioctl<D, T>
[src]
impl<D: PartialEq, T: PartialEq> PartialEq<Ioctl<D, T>> for Ioctl<D, T>
[src]
impl<D, T> StructuralEq for Ioctl<D, T>
[src]
impl<D, T> StructuralPartialEq for Ioctl<D, T>
[src]
Auto Trait Implementations
impl<D, T> RefUnwindSafe for Ioctl<D, T> where
D: RefUnwindSafe,
T: RefUnwindSafe,
D: RefUnwindSafe,
T: RefUnwindSafe,
impl<D, T> Send for Ioctl<D, T> where
D: Send,
T: Send,
D: Send,
T: Send,
impl<D, T> Sync for Ioctl<D, T> where
D: Sync,
T: Sync,
D: Sync,
T: Sync,
impl<D, T> Unpin for Ioctl<D, T> where
D: Unpin,
T: Unpin,
D: Unpin,
T: Unpin,
impl<D, T> UnwindSafe for Ioctl<D, T> where
D: UnwindSafe,
T: UnwindSafe,
D: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,