Silk

silk/raw_linux

Profiles: x86_64-unknown-linux-gnu-no-libc.

Linux kernel calls for explicitly selected no-libc programs.

When to use

Use this module at a raw Linux runtime boundary. Hosted programs use selected libc providers.

Gotchas

Calls return the kernel word unchanged. Values from -4095 through -1 encode errors. Every unsafe caller must prove the selected syscall's pointer, lifetime and resource contract.

Import as RawLinux with import silk.raw_linux { RawLinux }.

Public declarations: 6.

RawLinux

pub struct RawLinux

The scope for raw Linux kernel operations on the selected target.

Associated function RawLinux.syscall0

pub unsafe fn syscall0(number: usize) -> usize

Issues a Linux syscall with 0 arguments and returns its raw result.

Gotchas

The caller must prove the syscall's memory, lifetime and resource obligations. Kernel errors remain encoded in the result; no libc error state is read.

Associated function RawLinux.syscall1

pub unsafe fn syscall1(number: usize, a1: usize) -> usize

Issues a Linux syscall with 1 argument and returns its raw result.

Gotchas

The caller must prove the syscall's memory, lifetime and resource obligations. Kernel errors remain encoded in the result; no libc error state is read.

Associated function RawLinux.syscall2

pub unsafe fn syscall2(number: usize, a1: usize, a2: usize) -> usize

Issues a Linux syscall with 2 arguments and returns its raw result.

Gotchas

The caller must prove the syscall's memory, lifetime and resource obligations. Kernel errors remain encoded in the result; no libc error state is read.

Associated function RawLinux.syscall3

pub unsafe fn syscall3(number: usize, a1: usize, a2: usize, a3: usize) -> usize

Issues a Linux syscall with 3 arguments and returns its raw result.

Gotchas

The caller must prove the syscall's memory, lifetime and resource obligations. Kernel errors remain encoded in the result; no libc error state is read.

Associated function RawLinux.syscall4

pub unsafe fn syscall4(number: usize, a1: usize, a2: usize, a3: usize, a4: usize) -> usize

Issues a Linux syscall with 4 arguments and returns its raw result.

Gotchas

The caller must prove the syscall's memory, lifetime and resource obligations. Kernel errors remain encoded in the result; no libc error state is read.

Associated function RawLinux.syscall5

pub unsafe fn syscall5(number: usize, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) -> usize

Issues a Linux syscall with 5 arguments and returns its raw result.

Gotchas

The caller must prove the syscall's memory, lifetime and resource obligations. Kernel errors remain encoded in the result; no libc error state is read.

Associated function RawLinux.syscall6

pub unsafe fn syscall6(number: usize, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize, a6: usize) -> usize

Issues a Linux syscall with 6 arguments and returns its raw result.

Gotchas

The caller must prove the syscall's memory, lifetime and resource obligations. Kernel errors remain encoded in the result; no libc error state is read.

Associated function RawLinux.syscallNoReturn

pub unsafe fn syscallNoReturn(number: usize, argument: usize) -> ()

Issues a terminal Linux syscall with one argument.

Gotchas

The caller must select a syscall that cannot return. No structured cleanup follows this call.

Associated function RawLinux.pointer

pub unsafe fn pointer(address: usize) -> ?[*]mut u8

Forms a nullable byte pointer from a kernel-provided address without reading memory.

Gotchas

The address grants no ownership or readable range. Prove validity before every access.

Associated function RawLinux.error

pub fn error(result: usize) -> usize

Returns zero for success or the positive kernel error number.

Associated function RawLinux.read

pub fn read<'life0>(descriptor: usize, buffer: &'life0 mut [u8]) -> usize

Reads one initialized prefix from a borrowed Linux descriptor.

Details

Returns the raw kernel result: a byte count, zero at EOF, or an encoded error. Interrupted reads are returned to the caller. Bytes beyond a successful prefix retain their previous values.

Associated function RawLinux.write

pub fn write<'life0>(descriptor: usize, buffer: &'life0 [u8]) -> usize

Writes one prefix to a borrowed Linux descriptor and returns the raw kernel result.

Details

A positive count can be shorter than the input. Interrupted writes and encoded errors remain visible to the caller. The operation does not close the descriptor or retain the input.

READ

pub const READ: usize

The selected Linux read syscall number.

WRITE

pub const WRITE: usize

The selected Linux write syscall number.

MMAP

pub const MMAP: usize

The selected Linux mmap syscall number.

MUNMAP

pub const MUNMAP: usize

The selected Linux munmap syscall number.

EXIT_GROUP

pub const EXIT_GROUP: usize

The selected Linux exit_group syscall number.

On this page