#[repr(usize)]pub enum AuxVarType {
Show 34 variants
Null = 0,
Ignore = 1,
ExecFd = 2,
Phdr = 3,
Phent = 4,
Phnum = 5,
Pagesz = 6,
Base = 7,
Flags = 8,
Entry = 9,
NotElf = 10,
Uid = 11,
EUid = 12,
Gid = 13,
EGid = 14,
Platform = 15,
HwCap = 16,
Clktck = 17,
Secure = 23,
BasePlatform = 24,
Random = 25,
HwCap2 = 26,
ExecFn = 31,
Sysinfo = 32,
SysinfoEhdr = 33,
L1iCacheSize = 40,
L1iCacheGeometry = 41,
L1dCacheSize = 42,
L1dCacheGeometry = 43,
L2CacheSize = 44,
L2CacheGeometry = 45,
L3CacheSize = 46,
L3CacheGeometry = 47,
MinSigStkSz = 51,
}
Expand description
Variants§
Null = 0
end of vector
Ignore = 1
entry should be ignored
ExecFd = 2
file descriptor of program
Phdr = 3
program headers for program
Phent = 4
size of program header entry
Phnum = 5
number of program headers
Pagesz = 6
system page size
Base = 7
The base address of the program interpreter (usually, the dynamic linker).
Flags = 8
Flags that apply on the whole auxiliary vector. See crate::AuxVarFlags
.
Entry = 9
entry point of program
NotElf = 10
program is not ELF
Uid = 11
real uid
EUid = 12
effective uid
Gid = 13
real gid
EGid = 14
effective gid
Platform = 15
string identifying CPU for optimizations
HwCap = 16
Arch dependent hints at CPU capabilities. On x86_64 these are the CPUID features.
Clktck = 17
frequency at which times() increments
Secure = 23
secure mode boolean
BasePlatform = 24
string identifying real platform, may differ from AtPlatform.
Random = 25
address of 16 random bytes
HwCap2 = 26
extension of AtHwcap
ExecFn = 31
filename of program, for example “./my_executable\0”
Sysinfo = 32
The entry point to the system call function in the vDSO. Not present/needed on all architectures (e.g., absent on x86-64).
SysinfoEhdr = 33
The address of a page containing the virtual Dynamic Shared Object (vDSO) that the kernel creates in order to provide fast implementations of certain system calls.
L1iCacheSize = 40
L1 instruction cache size
L1iCacheGeometry = 41
L1 instruction cache geometry
L1dCacheSize = 42
L1 cache geometry
L1dCacheGeometry = 43
L1 cache size
L2CacheSize = 44
L2 cache size
L2CacheGeometry = 45
L2 cache geometry
L3CacheSize = 46
L3 cache size
L3CacheGeometry = 47
L3 cache geometry
MinSigStkSz = 51
Minimal stack size for signal delivery.
Implementations§
Source§impl AuxVarType
impl AuxVarType
Sourcepub const fn value_in_data_area(self) -> bool
pub const fn value_in_data_area(self) -> bool
If this is true, the value of the key should be interpreted as pointer into the aux vector data area. Otherwise, the value of the key is an immediate value/integer.
Examples found in repository?
31fn main(argc: isize, argv: *const *const u8) -> isize {
32 let buffer = unsafe {
33 // 100 KiB, reasonably big.
34 // On my Linux machine, the structure needs 23 KiB
35 slice::from_raw_parts(argv.cast::<u8>(), 0x19000)
36 };
37
38 let parsed = StackLayoutRef::new(buffer, Some(argc as usize));
39
40 println!("There are {} arguments.", parsed.argc());
41 println!(" argv (raw)");
42 for (i, arg) in parsed.argv_raw_iter().enumerate() {
43 println!(" [{i}] @ {arg:?}");
44 }
45 println!(" argv");
46 // SAFETY: The pointers are valid in the address space of this process.
47 for (i, arg) in unsafe { parsed.argv_iter() }.enumerate() {
48 println!(" [{i}] {arg:?}");
49 }
50
51 println!("There are {} environment variables.", parsed.envc());
52 println!(" envv (raw)");
53 for (i, env) in parsed.envv_raw_iter().enumerate() {
54 println!(" [{i}] {env:?}");
55 }
56 println!(" envv");
57 // SAFETY: The pointers are valid in the address space of this process.
58 for (i, env) in unsafe { parsed.envv_iter() }.enumerate() {
59 println!(" [{i}] {env:?}");
60 }
61
62 println!(
63 "There are {} auxiliary vector entries/AT variables.",
64 parsed.auxv_raw_iter().count()
65 );
66 println!(" aux");
67 // ptr iter is safe for other address spaces; the other only because here user_addr == write_addr
68 for aux in unsafe { parsed.auxv_iter() } {
69 if aux.key().value_in_data_area() {
70 println!(" {:?} => @ {:?}", aux.key(), aux);
71 } else {
72 println!(" {:?} => {:?}", aux.key(), aux);
73 }
74 }
75
76 0
77}
Sourcepub fn value_is_cstr(self) -> bool
pub fn value_is_cstr(self) -> bool
The payload of entries where this returns true represents a null-terminated C-string.
Sourcepub const fn data_area_val_size_hint(self) -> Option<usize>
pub const fn data_area_val_size_hint(self) -> Option<usize>
The payload of some AuxVarType
is stored in the aux var data area.
Most of these payloads are variable-length and null-terminated. If they
have a fixed size, then this function returns it.
Trait Implementations§
Source§impl Clone for AuxVarType
impl Clone for AuxVarType
Source§fn clone(&self) -> AuxVarType
fn clone(&self) -> AuxVarType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more