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 arbitraryusize
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 ausize
returned from a syscall that effectively returns ac_int
on success. - ret_
c_ π βint_ infallible Convert ac_int
returned from a syscall that effectively always returns ac_int
. - ret_
c_ πuint Convert ausize
returned from a syscall that effectively returns ac_uint
on success. - ret_
c_ π βuint_ infallible Convert ac_uint
returned from a syscall that effectively always returns ac_uint
. - ret_
discarded_ π βfd Convert the return value ofdup2
anddup3
. - ret_
error π βConvert ausize
returned from a syscall that doesnβt return on success. - ret_
infallible π βConvert ausize
returned from a syscall that effectively always returns()
. - ret_
owned_ π βfd Convert ausize
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 ausize
returned from a syscall that effectively returns ausize
on success. - ret_
usize_ π βinfallible Convert ausize
returned from a syscall that effectively always returns ausize
. - ret_
void_ πstar Convert ausize
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.