macro_rules! raw_syscall {
([ro] $sysno:expr, $arg0:expr, $arg1:expr, $arg2:expr, $arg3:expr, $arg4:expr, $arg5:expr $(,)?) => { ... };
([ro] $sysno:expr, $arg0:expr, $arg1:expr, $arg2:expr, $arg3:expr, $arg4:expr $(,)?) => { ... };
([ro] $sysno:expr, $arg0:expr, $arg1:expr, $arg2:expr, $arg3:expr $(,)?) => { ... };
([ro] $sysno:expr, $arg0:expr, $arg1:expr, $arg2:expr $(,)?) => { ... };
([ro] $sysno:expr, $arg0:expr, $arg1:expr $(,)?) => { ... };
([!] $sysno:expr, $arg0:expr $(,)?) => { ... };
([ro] $sysno:expr, $arg0:expr $(,)?) => { ... };
([ro] $sysno:expr $(,)?) => { ... };
($sysno:expr, $arg0:expr, $arg1:expr, $arg2:expr, $arg3:expr, $arg4:expr, $arg5:expr $(,)?) => { ... };
($sysno:expr, $arg0:expr, $arg1:expr, $arg2:expr, $arg3:expr, $arg4:expr $(,)?) => { ... };
($sysno:expr, $arg0:expr, $arg1:expr, $arg2:expr, $arg3:expr $(,)?) => { ... };
($sysno:expr, $arg0:expr, $arg1:expr, $arg2:expr $(,)?) => { ... };
($sysno:expr, $arg0:expr, $arg1:expr $(,)?) => { ... };
($sysno:expr, $arg0:expr $(,)?) => { ... };
($sysno:expr $(,)?) => { ... };
}Available on (32-bit and ARM, or 32-bit and little-endian and x86, or 64-bit and AArch64, or 64-bit and little-endian and x86-64) and (Android or Linux), or Linux and (32-bit and big-endian and PowerPC, or 32-bit and little-endian and RISC-V RV32, or 32-bit and little-endian and x86-64, or 32-bit and MIPS, or 64-bit and big-endian and s390x, or 64-bit and little-endian and LoongArch64, or 64-bit and little-endian and RISC-V RV64, or 64-bit and MIPS-64, or 64-bit and PowerPC64) only.
Expand description
Make a syscall and returns a usize
Accept a Sysno as the first parameter and a variable number of arguments (0 to 6).
It calls syscallN under the hood where N is the number of arguments.
The are two variations:
[ro]: use the_readonlyversion ofraw_syscallN.[!]: use the_noreturnversion ofsyscall1(useful forexit).
Use the previous tags if you what are you doing, otherwise you can omit them.
ยงExample
use linux_syscalls::{Sysno, raw_syscall};
println!("{}", raw_syscall!([ro] Sysno::brk, 0));
// [!] because exit do not return.
unsafe { raw_syscall!([!] Sysno::exit, 0) };