syscall1

Function syscall1 

Source
#[unsafe(link_section = ".text")]
pub fn syscall1(n: usize, a1: usize) -> isize
Expand description

Performs a raw system call with 1 argument.

This function directly invokes the Linux syscall instruction with the specified system call number (n) and one argument (a1). It returns the result of the syscall as an isize, which may be a negative error code (following Linux conventions).

§Safety

  • The caller must ensure that the provided syscall number and arguments are valid for the target platform.
  • Passing invalid pointers or arguments may cause undefined behavior, including crashes or data corruption.
  • This function does not perform any error translation. Negative return values correspond to -errno.

§Examples

use azathoth_utils::platform::linux::syscalls::syscall1;

// Example: `getpid` (syscall number 39 on x86_64 Linux)
let pid = unsafe { syscall1(39, 0) };
assert!(pid > 0);