Commit 64967eef authored by Pavel Emelyanov's avatar Pavel Emelyanov

crtools: Kill the ability to work on individual process

We haven't tested it for several monthes and there's no evidence
it is required at all. For dumping a single task -t option works
just fine.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 9f2168a4
...@@ -11,7 +11,7 @@ crtools - checkpoint/restore in userspace ...@@ -11,7 +11,7 @@ crtools - checkpoint/restore in userspace
SYNOPSIS SYNOPSIS
-------- --------
'crtools' [-c] [-s] [-f <file>] [-d] [-n] [-o <path>] [-D <path>] [-v [num]] [--help] <command> (-p|-t) <pid> 'crtools' [-c] [-s] [-f <file>] [-d] [-n] [-o <path>] [-D <path>] [-v [num]] [--help] <command> -t <pid>
DESCRIPTION DESCRIPTION
----------- -----------
...@@ -47,10 +47,6 @@ OPTIONS ...@@ -47,10 +47,6 @@ OPTIONS
This option is valid for 'show' command only and allows to see content of This option is valid for 'show' command only and allows to see content of
the <file> specified. the <file> specified.
-p <pid>::
Checkpoint only one process specified by 'pid' instead of the whole process
tree.
-t <pid>:: -t <pid>::
Checkpoint the whole process tree starting from 'pid'. Checkpoint the whole process tree starting from 'pid'.
......
...@@ -1051,7 +1051,7 @@ static int check_subtree(const struct pstree_item *item) ...@@ -1051,7 +1051,7 @@ static int check_subtree(const struct pstree_item *item)
return 0; return 0;
} }
static int collect_subtree(struct pstree_item *item, int leader_only) static int collect_subtree(struct pstree_item *item)
{ {
struct pstree_item *child; struct pstree_item *child;
pid_t pid = item->pid.real; pid_t pid = item->pid.real;
...@@ -1062,11 +1062,8 @@ static int collect_subtree(struct pstree_item *item, int leader_only) ...@@ -1062,11 +1062,8 @@ static int collect_subtree(struct pstree_item *item, int leader_only)
if (ret) if (ret)
return -1; return -1;
if (leader_only)
return 0;
list_for_each_entry(child, &item->children, list) { list_for_each_entry(child, &item->children, list) {
ret = collect_subtree(child, 0); ret = collect_subtree(child);
if (ret < 0) if (ret < 0)
return -1; return -1;
} }
...@@ -1089,7 +1086,7 @@ static int collect_pstree(pid_t pid, const struct cr_options *opts) ...@@ -1089,7 +1086,7 @@ static int collect_pstree(pid_t pid, const struct cr_options *opts)
root_item->pid.real = pid; root_item->pid.real = pid;
INIT_LIST_HEAD(&root_item->list); INIT_LIST_HEAD(&root_item->list);
ret = collect_subtree(root_item, opts->leader_only); ret = collect_subtree(root_item);
if (ret == 0) { if (ret == 0) {
/* /*
* Some tasks could have been reparented to * Some tasks could have been reparented to
...@@ -1373,7 +1370,7 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts) ...@@ -1373,7 +1370,7 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts)
int ret = -1; int ret = -1;
pr_info("========================================\n"); pr_info("========================================\n");
pr_info("Dumping process %s(pid: %d)\n", !opts->leader_only ? "group " : "", pid); pr_info("Dumping processes (pid: %d)\n", pid);
pr_info("========================================\n"); pr_info("========================================\n");
if (write_img_inventory()) if (write_img_inventory())
...@@ -1401,9 +1398,6 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts) ...@@ -1401,9 +1398,6 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts)
for_each_pstree_item(item) { for_each_pstree_item(item) {
if (dump_one_task(item)) if (dump_one_task(item))
goto err; goto err;
if (opts->leader_only)
break;
} }
if (dump_pstree(root_item)) if (dump_pstree(root_item))
......
...@@ -859,7 +859,7 @@ static int prepare_task_entries() ...@@ -859,7 +859,7 @@ static int prepare_task_entries()
return 0; return 0;
} }
static int restore_all_tasks(pid_t pid, struct cr_options *opts) int cr_restore_tasks(pid_t pid, struct cr_options *opts)
{ {
if (check_img_inventory() < 0) if (check_img_inventory() < 0)
return -1; return -1;
...@@ -1368,10 +1368,3 @@ err: ...@@ -1368,10 +1368,3 @@ err:
exit(1); exit(1);
return -1; return -1;
} }
int cr_restore_tasks(pid_t pid, struct cr_options *opts)
{
if (opts->leader_only)
return restore_one_task(pid);
return restore_all_tasks(pid, opts);
}
...@@ -600,9 +600,6 @@ static int cr_show_all(struct cr_options *opts) ...@@ -600,9 +600,6 @@ static int cr_show_all(struct cr_options *opts)
fdset_template[i].show(fdset_fd(cr_fdset, i), opts); fdset_template[i].show(fdset_fd(cr_fdset, i), opts);
close_cr_fdset(&cr_fdset); close_cr_fdset(&cr_fdset);
if (opts->leader_only)
break;
} }
out: out:
......
...@@ -57,7 +57,7 @@ int main(int argc, char *argv[]) ...@@ -57,7 +57,7 @@ int main(int argc, char *argv[])
int log_inited = 0; int log_inited = 0;
int log_level = 0; int log_level = 0;
static const char short_opts[] = "dsf:p:t:hcD:o:n:vxV"; static const char short_opts[] = "dsf:t:hcD:o:n:vxV";
BUILD_BUG_ON(PAGE_SIZE != PAGE_IMAGE_SIZE); BUILD_BUG_ON(PAGE_SIZE != PAGE_IMAGE_SIZE);
...@@ -69,7 +69,6 @@ int main(int argc, char *argv[]) ...@@ -69,7 +69,6 @@ int main(int argc, char *argv[])
while (1) { while (1) {
static struct option long_opts[] = { static struct option long_opts[] = {
{ "pid", required_argument, 0, 'p' },
{ "tree", required_argument, 0, 't' }, { "tree", required_argument, 0, 't' },
{ "leave-stopped", no_argument, 0, 's' }, { "leave-stopped", no_argument, 0, 's' },
{ "restore-detached", no_argument, 0, 'd' }, { "restore-detached", no_argument, 0, 'd' },
...@@ -98,13 +97,8 @@ int main(int argc, char *argv[]) ...@@ -98,13 +97,8 @@ int main(int argc, char *argv[])
case 'x': case 'x':
opts.ext_unix_sk = true; opts.ext_unix_sk = true;
break; break;
case 'p':
pid = atoi(optarg);
opts.leader_only = true;
break;
case 't': case 't':
pid = atoi(optarg); pid = atoi(optarg);
opts.leader_only = false;
break; break;
case 'c': case 'c':
opts.show_pages_content = true; opts.show_pages_content = true;
...@@ -236,7 +230,6 @@ usage: ...@@ -236,7 +230,6 @@ usage:
pr_msg("\nDump/Restore options:\n"); pr_msg("\nDump/Restore options:\n");
pr_msg("\n* Generic:\n"); pr_msg("\n* Generic:\n");
pr_msg(" -p|--pid checkpoint/restore only a single process identified by pid\n");
pr_msg(" -t|--tree checkpoint/restore the whole process tree identified by pid\n"); pr_msg(" -t|--tree checkpoint/restore the whole process tree identified by pid\n");
pr_msg(" -d|--restore-detached detach after restore\n"); pr_msg(" -d|--restore-detached detach after restore\n");
pr_msg(" -s|--leave-stopped leave tasks in stopped state after checkpoint instead of killing them\n"); pr_msg(" -s|--leave-stopped leave tasks in stopped state after checkpoint instead of killing them\n");
......
...@@ -76,7 +76,6 @@ enum { ...@@ -76,7 +76,6 @@ enum {
struct cr_options { struct cr_options {
int final_state; int final_state;
char *show_dump_file; char *show_dump_file;
bool leader_only;
bool show_pages_content; bool show_pages_content;
bool restore_detach; bool restore_detach;
bool ext_unix_sk; bool ext_unix_sk;
......
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