1 module runtime.system.posix.auxvector; 2 3 version(Posix) @nogc nothrow: 4 5 enum AT_NULL = 0; /* end of vector */ 6 enum AT_IGNORE = 1; /* entry should be ignored */ 7 enum AT_EXECFD = 2; /* file descriptor of program */ 8 enum AT_PHDR = 3; /* program headers for program */ 9 enum AT_PHENT = 4; /* size of program header entry */ 10 enum AT_PHNUM = 5; /* number of program headers */ 11 enum AT_PAGESZ = 6; /* system page size */ 12 enum AT_BASE = 7; /* base address of interpreter */ 13 enum AT_FLAGS = 8; /* flags */ 14 enum AT_ENTRY = 9; /* entry point of program */ 15 enum AT_NOTELF = 10; /* program is not ELF */ 16 enum AT_UID = 11; /* real uid */ 17 enum AT_EUID = 12; /* effective uid */ 18 enum AT_GID = 13; /* real gid */ 19 enum AT_EGID = 14; /* effective gid */ 20 enum AT_PLATFORM = 15; /* string identifying CPU for optimizations */ 21 enum AT_HWCAP = 16; /* arch dependent hints at CPU capabilities */ 22 enum AT_CLKTCK = 17; /* frequency at which times() increments */ 23 enum AT_SECURE = 23; /* secure mode boolean */ 24 enum AT_BASE_PLATFORM = 24; /* string identifying real platform, may*/ 25 enum AT_RANDOM = 25; /* address of 16 random bytes */ 26 enum AT_HWCAP2 = 26; /* extension of AT_HWCAP */ 27 enum AT_EXECFN = 31; /* filename of program */ 28 29 __gshared uint g_posixPageSize; 30 31 struct auxv_t 32 { 33 uint a_type; 34 union { 35 uint a_val; 36 } 37 } 38 39 void _d_loadAuxVector(char** envp) 40 { 41 // mhmm, mhmm, yep, very sensible and logical mr linux. 42 while(*envp++ !is null){} 43 44 auto auxp = cast(auxv_t*)envp; // This feels so, so wrong. 45 while(auxp.a_type != AT_NULL) 46 { 47 switch(auxp.a_type) 48 { 49 case AT_PAGESZ: 50 g_posixPageSize = auxp.a_val; 51 break; 52 53 default: break; 54 } 55 56 auxp += (auxv_t*).sizeof; 57 } 58 }