2 #include <sys/sysctl.h>
3 #include <sys/elf_common.h>
9 #include "../../../config.h"
13 #if defined(KERN_PS_STRINGS) && defined(AT_PS_STRINGS)
14 unsigned long ul_ps_strings
;
15 struct ps_strings
* v1
;
16 struct ps_strings
* v2
;
17 struct ps_strings
* v3
;
18 int name
[] = {CTL_KERN
, KERN_PS_STRINGS
};
20 size_t struct_len
= sizeof(ul_ps_strings
);
22 if (sysctlbyname("kern.ps_strings", &ul_ps_strings
, &struct_len
, NULL
, 0) < 0) {
23 perror("sysctlbyname failed:");
26 v1
= (struct ps_strings
*)ul_ps_strings
;
28 (void)elf_aux_info(AT_PS_STRINGS
, &v2
, sizeof(v2
));
30 if (sysctl(name
, 2, &ul_ps_strings
, &struct_len
, NULL
, 0) < 0) {
31 perror("sysctl failed:");
34 v3
= (struct ps_strings
*)ul_ps_strings
;
36 if (v1
== v2
&& v1
== v2
) {
39 printf("FAIL ps_strings different\n");
40 printf("v1 %p v2 %p v3 %p\n", v1
, v2
, v3
);
46 setproctitle("foo %s %d", "bar", 42);