Commit 335639dc authored by Andrey Vagin's avatar Andrey Vagin Committed by Cyrill Gorcunov

crtools: kill all dumped processes by default

If a process continue to run, it may change a state of filesystem.

@gorcunov:
 - Drop -k option, it's not needed anymore.
 - Allow -c option (continue execution of a
   process after being dumped) in dumping procedure.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 6701296f
...@@ -255,7 +255,7 @@ int main(int argc, char *argv[]) ...@@ -255,7 +255,7 @@ int main(int argc, char *argv[])
int action = -1; int action = -1;
int log_inited = 0; int log_inited = 0;
static const char short_opts[] = "drskf:p:t:hcD:o:"; static const char short_opts[] = "drsf:p:t:hcD:o:";
static const struct option long_opts[] = { static const struct option long_opts[] = {
{ "dump", no_argument, NULL, 'd' }, { "dump", no_argument, NULL, 'd' },
{ "restore", no_argument, NULL, 'r' }, { "restore", no_argument, NULL, 'r' },
...@@ -271,7 +271,7 @@ int main(int argc, char *argv[]) ...@@ -271,7 +271,7 @@ int main(int argc, char *argv[])
memzero_p(&zero_page_entry); memzero_p(&zero_page_entry);
/* Default options */ /* Default options */
opts.final_state = CR_TASK_LEAVE_RUNNING; opts.final_state = CR_TASK_KILL;
for (opt = getopt_long(argc, argv, short_opts, long_opts, &idx); opt != -1; for (opt = getopt_long(argc, argv, short_opts, long_opts, &idx); opt != -1;
opt = getopt_long(argc, argv, short_opts, long_opts, &idx)) { opt = getopt_long(argc, argv, short_opts, long_opts, &idx)) {
...@@ -295,14 +295,12 @@ int main(int argc, char *argv[]) ...@@ -295,14 +295,12 @@ int main(int argc, char *argv[])
break; break;
case 'c': case 'c':
opts.show_pages_content = true; opts.show_pages_content = true;
opts.final_state = CR_TASK_LEAVE_RUNNING;
break; break;
case 'f': case 'f':
opts.show_single_file = true; opts.show_single_file = true;
opts.show_dump_file = optarg; opts.show_dump_file = optarg;
break; break;
case 'k':
opts.final_state = CR_TASK_KILL;
break;
case 'D': case 'D':
if (chdir(optarg)) { if (chdir(optarg)) {
pr_perror("can't change working directory"); pr_perror("can't change working directory");
...@@ -347,7 +345,7 @@ int main(int argc, char *argv[]) ...@@ -347,7 +345,7 @@ int main(int argc, char *argv[])
usage: usage:
printk("\nUsage:\n"); printk("\nUsage:\n");
printk("\t%s --dump|-d [-k] -p|-t pid\n", argv[0]); printk("\t%s --dump|-d [-c] -p|-t pid\n", argv[0]);
printk("\t%s --restore|-r -p|-t pid\n", argv[0]); printk("\t%s --restore|-r -p|-t pid\n", argv[0]);
printk("\t%s --show|-s [-c] (-p|-t pid)|(-f file)\n", argv[0]); printk("\t%s --show|-s [-c] (-p|-t pid)|(-f file)\n", argv[0]);
printk("\n"); printk("\n");
......
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