aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/bits/sigaction.h6
-rw-r--r--sysdeps/generic/dl-sysdep.c77
2 files changed, 79 insertions, 4 deletions
diff --git a/sysdeps/generic/bits/sigaction.h b/sysdeps/generic/bits/sigaction.h
index e5f661db80..e89479bd1c 100644
--- a/sysdeps/generic/bits/sigaction.h
+++ b/sysdeps/generic/bits/sigaction.h
@@ -37,9 +37,9 @@ struct sigaction
/* Bits in `sa_flags'. */
#ifdef __USE_BSD
-#define SA_ONSTACK 0x1 /* Take signal on signal stack. */
-#define SA_RESTART 0x2 /* Don't restart syscall on signal return. */
-#define SA_DISABLE 0x4 /* Disable alternate signal stack. */
+# define SA_ONSTACK 0x1 /* Take signal on signal stack. */
+# define SA_RESTART 0x2 /* Restart syscall on signal return. */
+# define SA_DISABLE 0x4 /* Disable alternate signal stack. */
#endif
#define SA_NOCLDSTOP 0x8 /* Don't send SIGCHLD when children stop. */
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c
index 4f97f8547b..fd79bc4b81 100644
--- a/sysdeps/generic/dl-sysdep.c
+++ b/sysdeps/generic/dl-sysdep.c
@@ -25,6 +25,7 @@
#include <fcntl.h>
#include <link.h>
#include <unistd.h>
+#include <stdio-common/_itoa.h>
#include <dl-machine.h>
@@ -40,6 +41,7 @@ extern void ENTRY_POINT (void);
int __libc_enable_secure;
int __libc_multiple_libcs; /* Defining this here avoids the inclusion
of init-first. */
+static ElfW(auxv_t) *_dl_auxv;
ElfW(Addr)
_dl_sysdep_start (void **start_argptr,
@@ -68,7 +70,7 @@ _dl_sysdep_start (void **start_argptr,
seen = 0;
#define M(type) (1 << (type))
- for (av = (void *) ++start_argptr;
+ for (av = _dl_auxv = (void *) ++start_argptr;
av->a_type != AT_NULL;
seen |= M ((++av)->a_type))
switch (av->a_type)
@@ -148,3 +150,76 @@ void
_dl_sysdep_start_cleanup (void)
{
}
+
+void
+_dl_show_auxv (void)
+{
+ char buf[64];
+ ElfW(auxv_t) *av;
+
+ /* Terminate string. */
+ buf[63] = '\0';
+
+ for (av = _dl_auxv; av->a_type != AT_NULL; ++av)
+ switch (av->a_type)
+ {
+ case AT_PHDR:
+ _dl_sysdep_message ("AT_PHDR: 0x",
+ _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
+ 16, 0),
+ "\n", NULL);
+ break;
+ case AT_PHNUM:
+ _dl_sysdep_message ("AT_PHNUM: ",
+ _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
+ 10, 0),
+ "\n", NULL);
+ break;
+ case AT_PAGESZ:
+ _dl_sysdep_message ("AT_PAGESZ: ",
+ _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
+ 10, 0),
+ "\n", NULL);
+ break;
+ case AT_ENTRY:
+ _dl_sysdep_message ("AT_ENTRY: 0x",
+ _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
+ 16, 0),
+ "\n", NULL);
+ break;
+ case AT_UID:
+ _dl_sysdep_message ("AT_UID: ",
+ _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
+ 10, 0),
+ "\n", NULL);
+ break;
+ case AT_GID:
+ _dl_sysdep_message ("AT_GID: ",
+ _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
+ 10, 0),
+ "\n", NULL);
+ break;
+ case AT_EUID:
+ _dl_sysdep_message ("AT_EUID: ",
+ _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
+ 10, 0),
+ "\n", NULL);
+ break;
+ case AT_EGID:
+ _dl_sysdep_message ("AT_EGID: ",
+ _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
+ 10, 0),
+ "\n", NULL);
+ break;
+ case AT_PLATFORM:
+ _dl_sysdep_message ("AT_PLATFORM: ", av->a_un.a_ptr, NULL);
+ break;
+ case AT_HWCAP:
+ /* Well, what shall we use? A string or an integer with bits? */
+ _dl_sysdep_message ("AT_HWCAP: ",
+ _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
+ 10, 0),
+ "\n", NULL);
+ break;
+ }
+}