[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4E5FD937.7050307@ixiacom.com>
Date: Thu, 1 Sep 2011 12:12:55 -0700
From: Earl Chew <echew@...acom.com>
To: Alan Cox <alan@...rguk.ukuu.org.uk>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
"andi@...stfloor.org" <andi@...stfloor.org>,
"oleg@...hat.com" <oleg@...hat.com>
Subject: [PATCH 1/1 v2]: coredump: use current->group_leader->comm instead
of current->comm
> In your view, but there is a better way to do this - add a new case and
> letter for the behaviour you want. That way you don't break anyone elses
> defaults and expectation and people can set a corepattern dependant upon
> the group leader.
Ok.
The patterns %n or %N are the same as %e and %E except that they
use current->group_leader->comm instead of current->comm.
Signed-off-by: Earl Chew <echew@...acom.com>
Cc: Alan Cox <alan@...rguk.ukuu.org.uk>
Cc: Al Viro <viro@...iv.linux.org.uk>
Cc: Andi Kleen <andi@...stfloor.org>
Cc: Oleg Nesterov <oleg@...hat.com>
--
--- fs/exec.c.orig 2011-08-28 21:16:01.000000000 -0700
+++ fs/exec.c 2011-09-01 12:03:50.622059092 -0700
@@ -1670,7 +1670,7 @@ static void cn_escape(char *str)
*str = '!';
}
-static int cn_print_exe_file(struct core_name *cn)
+static int cn_print_exe_file(struct core_name *cn, const char *comm)
{
struct file *exe_file;
char *pathbuf, *path;
@@ -1679,7 +1679,7 @@ static int cn_print_exe_file(struct core
exe_file = get_mm_exe_file(current->mm);
if (!exe_file) {
char *commstart = cn->corename + cn->used;
- ret = cn_printf(cn, "%s (path unknown)", current->comm);
+ ret = cn_printf(cn, "%s (path unknown)", comm);
cn_escape(commstart);
return ret;
}
@@ -1777,6 +1777,18 @@ static int format_corename(struct core_n
cn_escape(namestart);
break;
}
+ /* task group executable */
+ case 'n': {
+ char *commstart = cn->corename + cn->used;
+ err = cn_printf(cn, "%s",
+ current->group_leader->comm);
+ cn_escape(commstart);
+ break;
+ }
+ case 'N':
+ err = cn_print_exe_file(cn,
+ current->group_leader->comm);
+ break;
/* executable */
case 'e': {
char *commstart = cn->corename + cn->used;
@@ -1785,7 +1797,7 @@ static int format_corename(struct core_n
break;
}
case 'E':
- err = cn_print_exe_file(cn);
+ err = cn_print_exe_file(cn, current->comm);
break;
/* core limit size */
case 'c':
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists