MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / try_decode_c_int

Function try_decode_c_int

src/backend/linux_raw/io/errno.rs:102–112  ·  view source on GitHub ↗
(
    raw: RetReg<Num>,
)

Source from the content-addressed store, hash-verified

100/// `c::c_int` on success.
101#[inline]
102pub(in crate::backend) fn try_decode_c_int<Num: RetNumber>(
103 raw: RetReg<Num>,
104) -> io::Result<c::c_int> {
105 if raw.is_in_range(-4095..0) {
106 // SAFETY: `raw` must be in `-4095..0`, and we just checked that raw is
107 // in that range.
108 return Err(unsafe { Errno(raw.decode_error_code()) });
109 }
110
111 Ok(raw.decode_c_int())
112}
113
114/// Check for an error from the result of a syscall which encodes a
115/// `c::c_uint` on success.

Callers 2

ret_c_intFunction · 0.85
ret_c_int_infallibleFunction · 0.85

Calls 4

is_in_rangeMethod · 0.80
decode_error_codeMethod · 0.80
decode_c_intMethod · 0.80
ErrnoClass · 0.70

Tested by

no test coverage detected