sys_getenv

Function sys_getenv 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn sys_getenv( out_words: *mut u32, out_nwords: usize, varname: *const u8, varname_len: usize, ) -> usize
Expand description

Retrieves the value of an environment variable, and stores as much of it as it can it in the memory at [out_words, out_words + out_nwords).

Returns the length of the value, in bytes, or usize::MAX if the variable is not set.

This is normally called twice to read an environment variable: Once to get the length of the value, and once to fill in allocated memory.

NOTE: Repeated calls to sys_getenv are not guaranteed to result in the same data being returned. Returned data is entirely in the control of the host.

ยงSafety

out_words and varname must be aligned and dereferenceable.