regtest: broaden none/tests/linux/bug498317 suppression for PPC
[valgrind.git] / none / tests / freebsd / auxv.c
blobc49e606ea0738bb90f97c5765e205d6353401824
1 #include <stdio.h>
2 #include <elf.h>
3 #include <sys/exec.h>
4 #include "../../../config.h"
6 /* /usr/include/x86/elf.h AT_* defs */
8 typedef struct {
9 const char *str_val;
10 int type;
11 } Elf_AuxStr;
13 Elf_AuxStr aux_map[] = {
14 {"AT_NULL", 0},
15 {"AT_IGNORE", 1},
16 {"AT_EXECFD", 2},
17 {"AT_PHDR", 3},
18 {"AT_PHENT", 4},
19 {"AT_PHNUM", 5},
20 {"AT_PAGESZ", 6},
21 {"AT_BASE", 7},
22 {"AT_FLAGS", 8},
23 {"AT_ENTRY", 9},
24 {"AT_NOTELF", 10},
25 {"AT_UID", 11},
26 {"AT_EUID", 12},
27 {"AT_GID", 13},
28 {"AT_EGID", 14},
29 {"AT_EXECPATH", 15},
30 {"AT_CANARY", 16},
31 {"AT_CANARYLEN", 17},
32 {"AT_OSRELDATE", 18},
33 {"AT_NCPUS", 19},
34 {"AT_PAGESIZES", 20},
35 {"AT_PAGESIZESLEN", 21},
36 {"AT_TIMEKEEP", 22},
37 {"AT_STACKPROT", 23},
38 {"AT_EHDRFLAGS", 24},
39 {"AT_HWCAP", 25},
40 {"AT_HWCAP2", 26},
41 {"AT_BSDFLAGS", 27},
42 {"AT_ARGC", 28},
43 {"AT_ARGV", 29},
44 {"AT_ENVC", 30},
45 {"AT_ENVV", 31},
46 {"AT_PS_STRINGS", 32},
47 {"AT_FXRNG", 33},
48 {"AT_KPRELOAD", 34},
49 {"AT_USRSTACKBASE", 35},
50 {"AT_USRSTACKLIM", 36},
51 // {"AT_COUNT", 37},
54 int main(int argc, char* argv[], char* envp[])
56 Elf_Auxinfo *auxp;
57 Elf_AuxStr *aux_str;
58 while(*envp++ != NULL)
61 for (auxp = (Elf_Auxinfo *)envp; auxp->a_type != AT_NULL; auxp++)
63 aux_str = &aux_map[auxp->a_type];
64 fprintf(stderr, "val: %s int: %02d ptr: 0x%lx\n", aux_str->str_val, aux_str->type, auxp->a_un.a_val);
65 switch ( aux_str->type)
67 case AT_EXECPATH:
68 if (auxp->a_un.a_val != 0)
70 fprintf(stderr, "EXECPATH: %s\n", (char*)auxp->a_un.a_val);
72 break;
73 #if defined(AT_ARGV)
74 case AT_ARGV:
75 if (auxp->a_un.a_val != 0)
77 fprintf(stderr, "ARGV: %s\n", *(char**)auxp->a_un.a_val);
79 break;
80 #endif
81 #if defined(AT_ENVV)
82 case AT_ENVV:
83 if (auxp->a_un.a_val != 0)
85 /* can't leave this in regtest don't know what it
86 * will be */
87 /*fprintf(stderr, "ENVV: %s\n", *(char**)auxp->a_un.a_val);*/
89 break;
90 #endif
91 #if defined(AT_PS_STRINGS)
92 case AT_PS_STRINGS:
93 if (auxp->a_un.a_val != 0)
95 struct ps_strings *ppss = (struct ps_strings*)auxp->a_un.a_val;
96 fprintf(stderr, "PS_STRINGS ARGV: %s\n", *ppss->ps_argvstr);
97 /* can't leave this in regtest don't know what it
98 * will be */
99 /*fprintf(stderr, "PS_STRINGS ENVV: %s\n", *ppss->ps_envstr);*/
101 break;
102 #endif
103 default:
104 break;