From 0ebf86e1b131b204f5054f320e6d39a4a70bfa6b Mon Sep 17 00:00:00 2001 From: markj Date: Wed, 8 Oct 2014 20:25:21 +0000 Subject: [PATCH] Pass up the error status of minidumpsys() to its callers. PR: 193761 Submitted by: Conrad Meyer Sponsored by: EMC / Isilon Storage Division --- sys/amd64/amd64/minidump_machdep.c | 5 +++-- sys/amd64/include/md_var.h | 2 +- sys/arm/arm/dump_machdep.c | 6 ++---- sys/arm/arm/minidump_machdep.c | 5 +++-- sys/arm/include/md_var.h | 2 +- sys/i386/i386/minidump_machdep.c | 5 +++-- sys/i386/include/md_var.h | 2 +- sys/mips/include/md_var.h | 2 +- sys/mips/mips/dump_machdep.c | 6 ++---- sys/mips/mips/minidump_machdep.c | 5 +++-- sys/x86/x86/dump_machdep.c | 7 +++---- 11 files changed, 23 insertions(+), 24 deletions(-) diff --git a/sys/amd64/amd64/minidump_machdep.c b/sys/amd64/amd64/minidump_machdep.c index 0ee8bcfba6ed..61b348ea325c 100644 --- a/sys/amd64/amd64/minidump_machdep.c +++ b/sys/amd64/amd64/minidump_machdep.c @@ -215,7 +215,7 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz) /* A fake page table page, to avoid having to handle both 4K and 2M pages */ static pd_entry_t fakepd[NPDEPG]; -void +int minidumpsys(struct dumperinfo *di) { uint32_t pmapsize; @@ -441,7 +441,7 @@ minidumpsys(struct dumperinfo *di) /* Signal completion, signoff and exit stage left. */ dump_write(di, NULL, 0, 0, 0); printf("\nDump complete\n"); - return; + return (0); fail: if (error < 0) @@ -462,6 +462,7 @@ minidumpsys(struct dumperinfo *di) printf("Dump failed. Partition too small.\n"); else printf("** DUMP FAILED (ERROR %d) **\n", error); + return (error); } void diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h index c7b89a6c6f3c..e5e78f65369e 100644 --- a/sys/amd64/include/md_var.h +++ b/sys/amd64/include/md_var.h @@ -118,7 +118,7 @@ void pagezero(void *addr); void printcpuinfo(void); void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist); int user_dbreg_trap(void); -void minidumpsys(struct dumperinfo *); +int minidumpsys(struct dumperinfo *); struct savefpu *get_pcb_user_save_td(struct thread *td); struct savefpu *get_pcb_user_save_pcb(struct pcb *pcb); struct pcb *get_pcb_td(struct thread *td); diff --git a/sys/arm/arm/dump_machdep.c b/sys/arm/arm/dump_machdep.c index b5a37f2a52e2..d8104d18c20d 100644 --- a/sys/arm/arm/dump_machdep.c +++ b/sys/arm/arm/dump_machdep.c @@ -280,10 +280,8 @@ dumpsys(struct dumperinfo *di) size_t hdrsz; int error; - if (do_minidump) { - minidumpsys(di); - return (0); - } + if (do_minidump) + return (minidumpsys(di)); bzero(&ehdr, sizeof(ehdr)); ehdr.e_ident[EI_MAG0] = ELFMAG0; diff --git a/sys/arm/arm/minidump_machdep.c b/sys/arm/arm/minidump_machdep.c index 13f32428b65d..c12aefa8b506 100644 --- a/sys/arm/arm/minidump_machdep.c +++ b/sys/arm/arm/minidump_machdep.c @@ -196,7 +196,7 @@ blk_write_cont(struct dumperinfo *di, vm_paddr_t pa, size_t sz) /* A fake page table page, to avoid having to handle both 4K and 2M pages */ static pt_entry_t fakept[NPTEPG]; -void +int minidumpsys(struct dumperinfo *di) { struct minidumphdr mdhdr; @@ -460,7 +460,7 @@ minidumpsys(struct dumperinfo *di) /* Signal completion, signoff and exit stage left. */ dump_write(di, NULL, 0, 0, 0); printf("\nDump complete\n"); - return; + return (0); fail: if (error < 0) @@ -472,6 +472,7 @@ fail: printf("\nDump failed. Partition too small.\n"); else printf("\n** DUMP FAILED (ERROR %d) **\n", error); + return (error); } void diff --git a/sys/arm/include/md_var.h b/sys/arm/include/md_var.h index 7337b33b846b..d54a4259ef3b 100644 --- a/sys/arm/include/md_var.h +++ b/sys/arm/include/md_var.h @@ -68,6 +68,6 @@ extern int busdma_swi_pending; void busdma_swi(void); void dump_add_page(vm_paddr_t); void dump_drop_page(vm_paddr_t); -void minidumpsys(struct dumperinfo *); +int minidumpsys(struct dumperinfo *); #endif /* !_MACHINE_MD_VAR_H_ */ diff --git a/sys/i386/i386/minidump_machdep.c b/sys/i386/i386/minidump_machdep.c index e0cd1ff5d31b..dd3490b8a835 100644 --- a/sys/i386/i386/minidump_machdep.c +++ b/sys/i386/i386/minidump_machdep.c @@ -178,7 +178,7 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz) /* A fake page table page, to avoid having to handle both 4K and 2M pages */ static pt_entry_t fakept[NPTEPG]; -void +int minidumpsys(struct dumperinfo *di) { uint64_t dumpsize; @@ -377,7 +377,7 @@ minidumpsys(struct dumperinfo *di) /* Signal completion, signoff and exit stage left. */ dump_write(di, NULL, 0, 0, 0); printf("\nDump complete\n"); - return; + return (0); fail: if (error < 0) @@ -389,6 +389,7 @@ minidumpsys(struct dumperinfo *di) printf("\nDump failed. Partition too small.\n"); else printf("\n** DUMP FAILED (ERROR %d) **\n", error); + return (error); } void diff --git a/sys/i386/include/md_var.h b/sys/i386/include/md_var.h index 950fa1f0556c..2425fab5f912 100644 --- a/sys/i386/include/md_var.h +++ b/sys/i386/include/md_var.h @@ -113,6 +113,6 @@ void ppro_reenable_apic(void); void printcpuinfo(void); void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int selec); int user_dbreg_trap(void); -void minidumpsys(struct dumperinfo *); +int minidumpsys(struct dumperinfo *); #endif /* !_MACHINE_MD_VAR_H_ */ diff --git a/sys/mips/include/md_var.h b/sys/mips/include/md_var.h index 71a78e75b6de..f3778a86bc3d 100644 --- a/sys/mips/include/md_var.h +++ b/sys/mips/include/md_var.h @@ -79,5 +79,5 @@ void busdma_swi(void); struct dumperinfo; void dump_add_page(vm_paddr_t); void dump_drop_page(vm_paddr_t); -void minidumpsys(struct dumperinfo *); +int minidumpsys(struct dumperinfo *); #endif /* !_MACHINE_MD_VAR_H_ */ diff --git a/sys/mips/mips/dump_machdep.c b/sys/mips/mips/dump_machdep.c index 26f93ff5eb4a..fa96e79ab2e4 100644 --- a/sys/mips/mips/dump_machdep.c +++ b/sys/mips/mips/dump_machdep.c @@ -266,10 +266,8 @@ dumpsys(struct dumperinfo *di) size_t hdrsz; int error; - if (do_minidump) { - minidumpsys(di); - return (0); - } + if (do_minidump) + return (minidumpsys(di)); bzero(&ehdr, sizeof(ehdr)); ehdr.e_ident[EI_MAG0] = ELFMAG0; diff --git a/sys/mips/mips/minidump_machdep.c b/sys/mips/mips/minidump_machdep.c index cded3aef85f3..2122e00526f8 100644 --- a/sys/mips/mips/minidump_machdep.c +++ b/sys/mips/mips/minidump_machdep.c @@ -153,7 +153,7 @@ write_buffer(struct dumperinfo *di, char *ptr, size_t sz) return (0); } -void +int minidumpsys(struct dumperinfo *di) { struct minidumphdr mdhdr; @@ -325,7 +325,7 @@ minidumpsys(struct dumperinfo *di) /* Signal completion, signoff and exit stage left. */ dump_write(di, NULL, 0, 0, 0); printf("\nDump complete\n"); - return; + return (0); fail: if (error < 0) @@ -337,4 +337,5 @@ fail: printf("\nDump failed. Partition too small.\n"); else printf("\n** DUMP FAILED (ERROR %d) **\n", error); + return (error); } diff --git a/sys/x86/x86/dump_machdep.c b/sys/x86/x86/dump_machdep.c index 940c51939eae..4e048bfaae78 100644 --- a/sys/x86/x86/dump_machdep.c +++ b/sys/x86/x86/dump_machdep.c @@ -275,10 +275,9 @@ dumpsys(struct dumperinfo *di) size_t hdrsz; int error; - if (do_minidump) { - minidumpsys(di); - return (0); - } + if (do_minidump) + return (minidumpsys(di)); + bzero(&ehdr, sizeof(ehdr)); ehdr.e_ident[EI_MAG0] = ELFMAG0; ehdr.e_ident[EI_MAG1] = ELFMAG1;