mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 14:55:39 +00:00
img: Extend task image with state and exit code
Introduce 3 states we will have to work with: * alive for tasks sleeping or running * dead for zombies * stopped for stopped tasks. We cannot distinguish tasks in this state now, but with freezer cgroup this will become possible Signed-off-by: Pavel Emelyanov <xemul@parallels.com> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
committed by
Cyrill Gorcunov
parent
21bbfee919
commit
18aaad6164
@@ -626,6 +626,9 @@ static int dump_task_core_seized(pid_t pid, int pid_dir, struct proc_pid_stat *s
|
||||
core->tc.mm_brk = brk;
|
||||
pr_info("OK\n");
|
||||
|
||||
core->tc.task_state = TASK_ALIVE;
|
||||
core->tc.exit_code = 0;
|
||||
|
||||
return dump_task_core(core, cr_fdset);
|
||||
|
||||
err_free:
|
||||
@@ -1016,6 +1019,9 @@ static int dump_task_thread(pid_t pid, struct cr_fdset *cr_fdset)
|
||||
goto err_free;
|
||||
}
|
||||
|
||||
core->tc.task_state = TASK_ALIVE;
|
||||
core->tc.exit_code = 0;
|
||||
|
||||
return dump_task_core(core, cr_fdset);
|
||||
|
||||
err_free:
|
||||
|
16
cr-show.c
16
cr-show.c
@@ -319,6 +319,18 @@ err:
|
||||
return;
|
||||
}
|
||||
|
||||
static inline char *task_state_str(int state)
|
||||
{
|
||||
switch (state) {
|
||||
case TASK_ALIVE:
|
||||
return "running/sleeping";
|
||||
case TASK_DEAD:
|
||||
return "zombie";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
static void show_core_rest(int fd_core)
|
||||
{
|
||||
struct task_core_entry tc;
|
||||
@@ -331,6 +343,10 @@ static void show_core_rest(int fd_core)
|
||||
pr_info("\n\t---[Task parameters]---\n");
|
||||
pr_info("\tPersonality: %x\n", tc.personality);
|
||||
pr_info("\tCommand: %s\n", tc.comm);
|
||||
pr_info("\tState: %d (%s)\n", (int)tc.task_state,
|
||||
task_state_str((int)tc.task_state));
|
||||
if (tc.task_state == TASK_DEAD)
|
||||
pr_info("\t Exit code: %u\n", (unsigned int)tc.exit_code);
|
||||
pr_info("\tBrk: %lx\n", tc.mm_brk);
|
||||
pr_info("\tStart code: %lx\n", tc.mm_start_code);
|
||||
pr_info("\tEnd code: %lx\n", tc.mm_end_code);
|
||||
|
@@ -223,6 +223,9 @@ struct ckpt_arch_entry {
|
||||
#define CKPT_CORE_SIZE (2 * 4096)
|
||||
|
||||
struct task_core_entry {
|
||||
u8 task_state;
|
||||
u8 pad[3];
|
||||
u32 exit_code;
|
||||
|
||||
u32 personality;
|
||||
u8 comm[TASK_COMM_LEN];
|
||||
@@ -248,6 +251,10 @@ struct core_entry {
|
||||
};
|
||||
} __packed;
|
||||
|
||||
#define TASK_ALIVE 0x1
|
||||
#define TASK_DEAD 0x2
|
||||
#define TASK_STOPPED 0x3 /* FIXME - implement */
|
||||
|
||||
#endif /* CONFIG_X86_64 */
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user