Macro syscall

Source
macro_rules! syscall {
    ($syscall:expr $(,)?) => { ... };
    ($syscall:expr, $a1:expr $(,)?) => { ... };
    ($syscall:expr, $a1:expr, $a2:expr $(,)?) => { ... };
    ($syscall:expr, $a1:expr, $a2:expr, $a3:expr $(,)?) => { ... };
    ($syscall:expr, $a1:expr, $a2:expr, $a3:expr, $a4:expr $(,)?) => { ... };
    ($syscall:expr, $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr $(,)?) => { ... };
    ($syscall:expr, $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr, $a6:expr $(,)?) => { ... };
}
Expand description

Invokes a Linux syscall.

$syscall must be a value that implements Into<Syscall>. Other arguments must be valid asm! input operands, such as integers or pointers.

The returned value is an architecture-specific implementation of Result.

Additional traits implemented by syscall results vary by architecture. For all architectures currently supported by this library:

§Example

let stdout: i32 = 1;
let hello = "Hello, world!\n\0";
let rc = unsafe {
	syscall!(SYS_write, stdout, hello.as_ptr(), hello.len())
};
rc.check()?;

§Safety

Very unsafe. See the module documentation for details.