summaryrefslogtreecommitdiff
path: root/libc/sysdeps/unix/sysv/linux/dl-osinfo.h
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2007-09-12 16:26:54 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2007-09-12 16:26:54 +0000
commit83584a7af898dd93c48600fe850d150c51b10899 (patch)
tree0affa8ffee374ab83e40501d8d8967a03569c44d /libc/sysdeps/unix/sysv/linux/dl-osinfo.h
parent04b4d23592609edcd19fd5a461bbe6d3cc677b5b (diff)
downloadeglibc2-83584a7af898dd93c48600fe850d150c51b10899.tar.gz
Merge changes between r2424 and r3467 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@3468 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/sysdeps/unix/sysv/linux/dl-osinfo.h')
-rw-r--r--libc/sysdeps/unix/sysv/linux/dl-osinfo.h21
1 files changed, 8 insertions, 13 deletions
diff --git a/libc/sysdeps/unix/sysv/linux/dl-osinfo.h b/libc/sysdeps/unix/sysv/linux/dl-osinfo.h
index 6a7694ec4..082790f63 100644
--- a/libc/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/libc/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -1,5 +1,6 @@
/* Operating system specific code for generic dynamic loader functions. Linux.
- Copyright (C) 2000,2001,2002,2004,2005,2006 Free Software Foundation, Inc.
+ Copyright (C) 2000,2001,2002,2004,2005,2006,2007
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -51,11 +52,9 @@ _dl_discover_osversion (void)
static const struct
{
- ElfW(Word) vendorlen;
- ElfW(Word) datalen;
- ElfW(Word) type;
+ ElfW(Nhdr) hdr;
char vendor[8];
- } expected_note = { sizeof "Linux", sizeof (ElfW(Word)), 0, "Linux" };
+ } expected_note = { { sizeof "Linux", sizeof (ElfW(Word)), 0 }, "Linux" };
const ElfW(Phdr) *const phdr = GLRO(dl_sysinfo_map)->l_phdr;
const ElfW(Word) phnum = GLRO(dl_sysinfo_map)->l_phnum;
for (uint_fast16_t i = 0; i < phnum; ++i)
@@ -63,20 +62,16 @@ _dl_discover_osversion (void)
{
const ElfW(Addr) start = (phdr[i].p_vaddr
+ GLRO(dl_sysinfo_map)->l_addr);
- const struct
- {
- ElfW(Word) vendorlen;
- ElfW(Word) datalen;
- ElfW(Word) type;
- } *note = (const void *) start;
+ const ElfW(Nhdr) *note = (const void *) start;
while ((ElfW(Addr)) (note + 1) - start < phdr[i].p_memsz)
{
if (!memcmp (note, &expected_note, sizeof expected_note))
return *(const ElfW(Word) *) ((const void *) note
+ sizeof expected_note);
-#define ROUND(len) (((len) + sizeof (ElfW(Word)) - 1) & -sizeof (ElfW(Word)))
+#define ROUND(len) (((len) + sizeof note->n_type - 1) & -sizeof note->n_type)
note = ((const void *) (note + 1)
- + ROUND (note->vendorlen) + ROUND (note->datalen));
+ + ROUND (note->n_namesz) + ROUND (note->n_descsz));
+#undef ROUND
}
}
}