diff options
author | Stéphane Graber <stgraber@ubuntu.com> | 2013-09-11 14:24:32 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-11 15:59:01 -0700 |
commit | 65aafb1e7484b7434a0c1d4c593191ebe5776a2f (patch) | |
tree | 163b908974a487e6e8bdfd893d20fb28234255d2 /fs/coredump.c | |
parent | 73af963f9f3036dffed55c3a2898598186db1045 (diff) | |
download | op-kernel-dev-65aafb1e7484b7434a0c1d4c593191ebe5776a2f.zip op-kernel-dev-65aafb1e7484b7434a0c1d4c593191ebe5776a2f.tar.gz |
coredump: add new %P variable in core_pattern
Add a new %P variable to be used in core_pattern. This variable contains
the global PID (PID in the init namespace) as %p contains the PID in the
current namespace which isn't always what we want.
The main use for this is to make it easier to handle crashes that happened
within a container. With that new variables it's possible to have the
crashes dumped into the container or forwarded to the host with the right
PID (from the host's point of view).
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Reported-by: Hans Feldt <hans.feldt@ericsson.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Andy Whitcroft <apw@canonical.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/coredump.c')
-rw-r--r-- | fs/coredump.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/coredump.c b/fs/coredump.c index 72f816d..9bdeca1 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -190,6 +190,11 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm) err = cn_printf(cn, "%d", task_tgid_vnr(current)); break; + /* global pid */ + case 'P': + err = cn_printf(cn, "%d", + task_tgid_nr(current)); + break; /* uid */ case 'u': err = cn_printf(cn, "%d", cred->uid); |