Commit 21bbfee9 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Cyrill Gorcunov

proc: Read exit code from /proc/pid/stat

Requires patch #14 (for kernel). Also check for number of entries read be
at least required, not exactly equal for forward compatibility.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent dd495ba1
......@@ -52,6 +52,7 @@ struct proc_pid_stat {
unsigned long start_data;
unsigned long end_data;
unsigned long start_brk;
int exit_code;
};
extern int parse_pid_stat(pid_t pid, int pid_dir, struct proc_pid_stat *s);
......
......@@ -191,7 +191,7 @@ int parse_pid_stat(pid_t pid, int pid_dir, struct proc_pid_stat *s)
"%d " PROC_TASK_COMM_LEN_FMT " %c %d %d %d %d %d %u %lu %lu %lu %lu "
"%lu %lu %ld %ld %ld %ld %d %d %llu %lu %ld %lu %lu %lu %lu "
"%lu %lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld "
"%lu %lu %lu",
"%lu %lu %lu %d",
&s->pid,
s->comm,
&s->state,
......@@ -238,9 +238,10 @@ int parse_pid_stat(pid_t pid, int pid_dir, struct proc_pid_stat *s)
&s->cgtime,
&s->start_data,
&s->end_data,
&s->start_brk);
&s->start_brk,
&s->exit_code);
if (n != 47) {
if (n < 48) {
pr_perror("Parsing %d's stat failed (#fields do not match)", pid);
return -1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment