Silk

silk/raw_process_inputs

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

Borrowed Linux process inputs decoded from the kernel's initial stack.

When to use

Use ProcessInputs.decode only at a raw process entry. The process owns all input storage. Arguments and environment entries remain byte strings; page size comes from AT_PAGESZ.

Gotchas

The decoder requires a complete readable kernel stack image. It does not validate arbitrary memory. Returned pointers carry no ownership and are valid only while that image remains live.

Import as ProcessInputs with import silk.raw_process_inputs { ProcessInputs }.

Public declarations: 1.

ProcessInputs

pub struct ProcessInputs

Borrowed argument/environment words and a validated runtime page size.

Associated function ProcessInputs.decode

pub unsafe fn decode(stack: [*]const usize) -> silk/result.Result<silk/raw_process_inputs.ProcessInputs, usize>

Decodes one complete kernel-provided initial stack without allocation.

Details

Invalid argv termination or missing, duplicate or non-power-of-two AT_PAGESZ returns error 22. Unknown auxiliary-vector keys are ignored. No input is copied or changed.

Gotchas

The caller must provide aligned readable words through both pointer-vector terminators and AT_NULL. Each nonzero argument/environment address must identify a live NUL-terminated string.

Method ProcessInputs.pageSize

pub fn pageSize<'life0>(self: &'life0 silk/raw_process_inputs.ProcessInputs) -> usize

Returns the validated runtime AT_PAGESZ value.

Method ProcessInputs.argc

pub fn argc<'life0>(self: &'life0 silk/raw_process_inputs.ProcessInputs) -> usize

Returns the number of argument strings, including the program name.

Method ProcessInputs.envc

pub fn envc<'life0>(self: &'life0 silk/raw_process_inputs.ProcessInputs) -> usize

Returns the number of environment strings.

Method ProcessInputs.argument

pub unsafe fn argument<'life0>(self: &'life0 silk/raw_process_inputs.ProcessInputs, index: usize) -> ?[*]const u8

Returns an argument's NUL-terminated byte pointer, or null for an absent index.

Gotchas

The decoder's original stack and string storage must remain live. The pointer owns no storage.

Method ProcessInputs.variable

pub unsafe fn variable<'life0>(self: &'life0 silk/raw_process_inputs.ProcessInputs, index: usize) -> ?[*]const u8

Returns an environment entry's NUL-terminated byte pointer, or null for an absent index.

Gotchas

The decoder's original stack and string storage must remain live. The pointer owns no storage.

On this page