aboutsummaryrefslogtreecommitdiffstats
path: root/fs/binfmt_elf.c
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2007-09-19 00:38:12 -0400
committerPaul Mackerras <paulus@samba.org>2007-09-19 01:12:19 -0400
commite55014923e65e4ee8e477a1212381cca0125f3aa (patch)
treee84c0cab99f6963e644083be123042a0da6cd515 /fs/binfmt_elf.c
parent48cad41f7ee7b8a9a8317a4abbdaf09bc68b4773 (diff)
[POWERPC] spufs: Cleanup ELF coredump extra notes logic
To start with, arch_notes_size() etc. is a little too ambiguous a name for my liking, so change the function names to be more explicit. Calling through macros is ugly, especially with hidden parameters, so don't do that, call the routines directly. Use ARCH_HAVE_EXTRA_ELF_NOTES as the only flag, and based on it decide whether we want the extern declarations or the empty versions. Since we have empty routines, actually use them in the coredump code to save a few #ifdefs. We want to change the handling of foffset so that the write routine updates foffset as it goes, instead of using file->f_pos (so that writing to a pipe works). So pass foffset to the write routine, and for now just set it to file->f_pos at the end of writing. It should also be possible for the write routine to fail, so change it to return int and treat a non-zero return as failure. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'fs/binfmt_elf.c')
-rw-r--r--fs/binfmt_elf.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 4482a0673b15..b1013f34085d 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1514,9 +1514,6 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
1514 int thread_status_size = 0; 1514 int thread_status_size = 0;
1515 elf_addr_t *auxv; 1515 elf_addr_t *auxv;
1516 unsigned long mm_flags; 1516 unsigned long mm_flags;
1517#ifdef ELF_CORE_WRITE_EXTRA_NOTES
1518 int extra_notes_size;
1519#endif
1520 1517
1521 /* 1518 /*
1522 * We no longer stop all VM operations. 1519 * We no longer stop all VM operations.
@@ -1645,10 +1642,7 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
1645 1642
1646 sz += thread_status_size; 1643 sz += thread_status_size;
1647 1644
1648#ifdef ELF_CORE_WRITE_EXTRA_NOTES 1645 sz += elf_coredump_extra_notes_size();
1649 extra_notes_size = ELF_CORE_EXTRA_NOTES_SIZE;
1650 sz += extra_notes_size;
1651#endif
1652 1646
1653 fill_elf_note_phdr(&phdr, sz, offset); 1647 fill_elf_note_phdr(&phdr, sz, offset);
1654 offset += sz; 1648 offset += sz;
@@ -1698,10 +1692,8 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
1698 if (!writenote(notes + i, file, &foffset)) 1692 if (!writenote(notes + i, file, &foffset))
1699 goto end_coredump; 1693 goto end_coredump;
1700 1694
1701#ifdef ELF_CORE_WRITE_EXTRA_NOTES 1695 if (elf_coredump_extra_notes_write(file, &foffset))
1702 ELF_CORE_WRITE_EXTRA_NOTES; 1696 goto end_coredump;
1703 foffset += extra_notes_size;
1704#endif
1705 1697
1706 /* write out the thread status notes section */ 1698 /* write out the thread status notes section */
1707 list_for_each(t, &thread_list) { 1699 list_for_each(t, &thread_list) {