patch-2.3.12 linux/arch/mips/kernel/irixelf.c

Next file: linux/arch/mips/kernel/irixsig.c
Previous file: linux/arch/mips/kernel/init_task.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.11/linux/arch/mips/kernel/irixelf.c linux/arch/mips/kernel/irixelf.c
@@ -48,11 +48,13 @@
 extern int dump_fpu (elf_fpregset_t *);
 
 static struct linux_binfmt irix_format = {
+	NULL,
 #ifndef MODULE
-	NULL, NULL, load_irix_binary, load_irix_library, irix_core_dump
+	NULL,
 #else
-	NULL, &__this_module.usecount, load_irix_binary, load_irix_library, irix_core_dump
+	&__this_module.usecount,
 #endif
+	load_irix_binary, load_irix_library, irix_core_dump, PAGE_SIZE
 };
 
 #ifndef elf_addr_t
@@ -1105,24 +1107,20 @@
 
 #define DUMP_WRITE(addr, nr)	\
 	if (!dump_write(file, (addr), (nr))) \
-		goto close_coredump;
+		goto end_coredump;
 #define DUMP_SEEK(off)	\
 	if (!dump_seek(file, (off))) \
-		goto close_coredump;
+		goto end_coredump;
 /* Actual dumper.
  *
  * This is a two-pass process; first we find the offsets of the bits,
  * and then they are actually written out.  If we run out of core limit
  * we just truncate.
  */
-static int irix_core_dump(long signr, struct pt_regs * regs)
+static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
 {
 	int has_dumped = 0;
-	struct file *file;
-	struct dentry *dentry;
-	struct inode *inode;
 	mm_segment_t fs;
-	char corefile[6+sizeof(current->comm)];
 	int segs;
 	int i;
 	size_t size;
@@ -1135,10 +1133,6 @@
 	struct elf_prstatus prstatus;	/* NT_PRSTATUS */
 	elf_fpregset_t fpu;		/* NT_PRFPREG */
 	struct elf_prpsinfo psinfo;	/* NT_PRPSINFO */
-	
-	if (!current->dumpable || limit < PAGE_SIZE)
-		return 0;
-	current->dumpable = 0;
 
 #ifndef CONFIG_BINFMT_IRIX
 	MOD_INC_USE_COUNT;
@@ -1188,27 +1182,6 @@
 	fs = get_fs();
 	set_fs(KERNEL_DS);
 
-	memcpy(corefile,"core.", 5);
-#if 0
-	memcpy(corefile+5,current->comm,sizeof(current->comm));
-#else
-	corefile[4] = '\0';
-#endif
-	file = filp_open(corefile, O_CREAT | 2 | O_TRUNC | O_NOFOLLOW, 0600);
-	if (IS_ERR(file))
-		goto end_coredump;
-	dentry = file->f_dentry;
-	inode = dentry->d_inode;
-	if (inode->i_nlink > 1)
-		goto close_coredump;	/* multiple links - don't dump */
-
-	if (!S_ISREG(inode->i_mode))
-		goto close_coredump;
-	if (!inode->i_op || !inode->i_op->default_file_ops)
-		goto close_coredump;
-	if (!file->f_op->write)
-		goto close_coredump;
-
 	has_dumped = 1;
 	current->flags |= PF_DUMPCORE;
 
@@ -1345,7 +1318,7 @@
 
 	for(i = 0; i < numnote; i++)
 		if (!writenote(&notes[i], file))
-			goto close_coredump;
+			goto end_coredump;
 	
 	set_fs(fs);
 
@@ -1371,9 +1344,6 @@
 		printk("elf_core_dump: file->f_pos (%ld) != offset (%ld)\n",
 		       (off_t) file->f_pos, offset);
 	}
-
- close_coredump:
-	filp_close(file, NULL);
 
  end_coredump:
 	set_fs(fs);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)