Expand description
Convert values to ArgReg
and from RetReg
.
System call arguments and return values are all communicated with inline
asm and FFI as *mut Opaque
. To protect these raw pointers from escaping
or being accidentally misused as they travel through the code, we wrap them
in ArgReg
and RetReg
structs. This file provides From
implementations and explicit conversion functions for converting values
into and out of these wrapper structs.
Β§Safety
Some of this code is unsafe
in order to work with raw file descriptors,
and some is unsafe
to interpret the values in a RetReg
.
Modules§
- fs π
Functions§
- by_mut π
- by_ref π
- c_int πConvert a
c_int
into anArgReg
. - c_uint πConvert a
c_uint
into anArgReg
. - dev_t π
- loff_t π
- loff_t_from_u64 π
- negative_pid π
- no_fd πDeliberately pass
-1
to a file-descriptor argument, for system calls likemmap
where this indicates the argument is omitted. - opt_mut πConvert an optional mutable reference into a
usize
for passing to a syscall. - pass_usize πPass an arbitrary
usize
value. - raw_fd π βPass a raw file-descriptor argument. Most users should use
ArgReg::from
instead, to preserve I/O safety as long as possible. - ret π βConvert a
usize
returned from a syscall that effectively returns()
on success. - ret_c_int πConvert a
usize
returned from a syscall that effectively returns ac_int
on success. - ret_c_int_infallible π βConvert a
c_int
returned from a syscall that effectively always returns ac_int
. - ret_c_uint πConvert a
usize
returned from a syscall that effectively returns ac_uint
on success. - ret_c_uint_infallible π βConvert a
c_uint
returned from a syscall that effectively always returns ac_uint
. - ret_discarded_fd π βConvert the return value of
dup2
anddup3
. - ret_error π βConvert a
usize
returned from a syscall that doesnβt return on success. - ret_infallible π βConvert a
usize
returned from a syscall that effectively always returns()
. - ret_owned_fd π βConvert a
usize
returned from a syscall that effectively returns anOwnedFd
on success. - ret_u64 πConvert a
usize
returned from a syscall that effectively returns au64
on success. - ret_usize πConvert a
usize
returned from a syscall that effectively returns ausize
on success. - ret_usize_infallible π βConvert a
usize
returned from a syscall that effectively always returns ausize
. - ret_void_star πConvert a
usize
returned from a syscall that effectively returns a*mut c_void
on success. - size_of πPass the
mem::size_of
of a type. - slice π
- slice_just_addr π
- slice_just_addr_mut π
- slice_mut π
- socklen_t π
- zero πPass a zero, or null, argument.