提交 43a5d548 编写于 作者: A Al Viro

aout: switch to dump_emit

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 cdc3d562
...@@ -133,14 +133,6 @@ static void set_brk(unsigned long start, unsigned long end) ...@@ -133,14 +133,6 @@ static void set_brk(unsigned long start, unsigned long end)
#include <linux/coredump.h> #include <linux/coredump.h>
#define DUMP_WRITE(addr, nr) \
if (!dump_write(cprm->file, (void *)(addr), (nr))) \
goto end_coredump;
#define DUMP_SEEK(offset) \
if (!dump_seek(cprm->file, offset)) \
goto end_coredump;
#define START_DATA(u) (u.u_tsize << PAGE_SHIFT) #define START_DATA(u) (u.u_tsize << PAGE_SHIFT)
#define START_STACK(u) (u.start_stack) #define START_STACK(u) (u.start_stack)
...@@ -192,22 +184,26 @@ static int aout_core_dump(struct coredump_params *cprm) ...@@ -192,22 +184,26 @@ static int aout_core_dump(struct coredump_params *cprm)
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
/* struct user */ /* struct user */
DUMP_WRITE(&dump, sizeof(dump)); if (!dump_emit(cprm, &dump, sizeof(dump)))
goto end_coredump;
/* Now dump all of the user data. Include malloced stuff as well */ /* Now dump all of the user data. Include malloced stuff as well */
DUMP_SEEK(PAGE_SIZE - sizeof(dump)); if (!dump_seek(cprm->file, PAGE_SIZE - sizeof(dump)))
goto end_coredump;
/* now we start writing out the user space info */ /* now we start writing out the user space info */
set_fs(USER_DS); set_fs(USER_DS);
/* Dump the data area */ /* Dump the data area */
if (dump.u_dsize != 0) { if (dump.u_dsize != 0) {
dump_start = START_DATA(dump); dump_start = START_DATA(dump);
dump_size = dump.u_dsize << PAGE_SHIFT; dump_size = dump.u_dsize << PAGE_SHIFT;
DUMP_WRITE(dump_start, dump_size); if (!dump_emit(cprm, (void *)dump_start, dump_size))
goto end_coredump;
} }
/* Now prepare to dump the stack area */ /* Now prepare to dump the stack area */
if (dump.u_ssize != 0) { if (dump.u_ssize != 0) {
dump_start = START_STACK(dump); dump_start = START_STACK(dump);
dump_size = dump.u_ssize << PAGE_SHIFT; dump_size = dump.u_ssize << PAGE_SHIFT;
DUMP_WRITE(dump_start, dump_size); if (!dump_emit(cprm, (void *)dump_start, dump_size))
goto end_coredump;
} }
end_coredump: end_coredump:
set_fs(fs); set_fs(fs);
......
...@@ -45,7 +45,6 @@ static int load_aout_library(struct file*); ...@@ -45,7 +45,6 @@ static int load_aout_library(struct file*);
*/ */
static int aout_core_dump(struct coredump_params *cprm) static int aout_core_dump(struct coredump_params *cprm)
{ {
struct file *file = cprm->file;
mm_segment_t fs; mm_segment_t fs;
int has_dumped = 0; int has_dumped = 0;
void __user *dump_start; void __user *dump_start;
...@@ -85,7 +84,7 @@ static int aout_core_dump(struct coredump_params *cprm) ...@@ -85,7 +84,7 @@ static int aout_core_dump(struct coredump_params *cprm)
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
/* struct user */ /* struct user */
if (!dump_write(file, &dump, sizeof(dump))) if (!dump_emit(cprm, &dump, sizeof(dump)))
goto end_coredump; goto end_coredump;
/* Now dump all of the user data. Include malloced stuff as well */ /* Now dump all of the user data. Include malloced stuff as well */
if (!dump_seek(cprm->file, PAGE_SIZE - sizeof(dump))) if (!dump_seek(cprm->file, PAGE_SIZE - sizeof(dump)))
...@@ -96,14 +95,14 @@ static int aout_core_dump(struct coredump_params *cprm) ...@@ -96,14 +95,14 @@ static int aout_core_dump(struct coredump_params *cprm)
if (dump.u_dsize != 0) { if (dump.u_dsize != 0) {
dump_start = START_DATA(dump); dump_start = START_DATA(dump);
dump_size = dump.u_dsize << PAGE_SHIFT; dump_size = dump.u_dsize << PAGE_SHIFT;
if (!dump_write(file, dump_start, dump_size)) if (!dump_emit(cprm, dump_start, dump_size))
goto end_coredump; goto end_coredump;
} }
/* Now prepare to dump the stack area */ /* Now prepare to dump the stack area */
if (dump.u_ssize != 0) { if (dump.u_ssize != 0) {
dump_start = START_STACK(dump); dump_start = START_STACK(dump);
dump_size = dump.u_ssize << PAGE_SHIFT; dump_size = dump.u_ssize << PAGE_SHIFT;
if (!dump_write(file, dump_start, dump_size)) if (!dump_emit(cprm, dump_start, dump_size))
goto end_coredump; goto end_coredump;
} }
end_coredump: end_coredump:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册