macro_rules! syscall_raw {
    ($nr:ident) => { ... };
    ($nr:ident, $a1:expr) => { ... };
    ($nr:ident, $a1:expr, $a2:expr) => { ... };
    ($nr:ident, $a1:expr, $a2:expr, $a3:expr) => { ... };
    ($nr:ident, $a1:expr, $a2:expr, $a3:expr, $a4:expr) => { ... };
    ($nr:ident, $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr) => { ... };
    ($nr:ident, $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr, $a6:expr) => { ... };
    ($nr:ident, $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr, $a6:expr, $a7:expr) => { ... };
    ($nr:ident, $($args:expr,)*) => { ... };
}
Expand description

Make a syscall, and return the direct result (platform-specific).

Note: You should use syscall! or syscall_nofail! in most cases!

On Linux (on most architectures), this returns a usize representing the return value of the syscall (if an error occurred, the error code is encoded into the result). On macOS and FreeBSD (and on some architectures on Linux), it returns a (usize, bool) tuple indicating 1) the return value and 2) whether an error occurred. (RawResult is an alias for this type, and it can be “decoded” into a Result<usize, i32> with decode_raw_result().)

Note: syscall! or syscall_nofail! should be preferred for most purposes. However, this macro may be useful if you need to make a series of syscalls quickly, then check the return values. In this case, you can call syscall_raw!, store the RawResults from each, and then decode and check them with decode_raw_result().

Example

let res = unsafe { syscall_raw!(GETPID) };
// ...
let pid = decode_raw_result(res).unwrap();
assert_eq!(pid as u32, std::process::id());

Safety

See syscall!.