From: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
Cc: Containers
<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
Subject: [PATCH 13/14][user-cr] restart: Move args checking to app_restart()
Date: Thu, 18 Mar 2010 23:34:33 -0700 [thread overview]
Message-ID: <20100319063433.GM24844@us.ibm.com> (raw)
In-Reply-To: <20100319062659.GA23838-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
From: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Date: Sat, 6 Mar 2010 13:06:35 -0800
Subject: [PATCH 13/14][user-cr] restart: Move args checking to app_restart()
parse_args() validates the specified arguments to ensure they are consistent.
Move this code into app_restart() so that these checks apply to other callers
of app_restart() also.
Signed-off-by: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
---
restart-main.c | 33 +--------------------------------
restart.c | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 32 deletions(-)
diff --git a/restart-main.c b/restart-main.c
index 36318a4..681ff8e 100644
--- a/restart-main.c
+++ b/restart-main.c
@@ -261,38 +261,7 @@ static void parse_args(struct app_restart_args *args, int argc, char *argv[])
if (no_pidns)
args->pidns = 0;
-#ifndef CLONE_NEWPID
- if (args->pidns) {
- ckpt_err("This version of restart was compiled without "
- "support for --pidns.\n");
- exit(1);
- }
-#endif
-
-#ifndef CHECKPOINT_DEBUG
- if (global_debug) {
- ckpt_err("This version of restart was compiled without "
- "support for --debug.\n");
- exit(1);
- }
-#endif
-
- if (args->pidns)
- args->pids = 1;
-
-#if 0 /* Defered until __NR_eclone makes it to standard headers */
-#ifndef __NR_eclone
- if (args->pids) {
- ckpt_err("This version of restart was compiled without "
- "support for --pids.\n");
- exit(1);
- }
-#endif
-#endif
-
- if (args->self &&
- (args->pids || args->pidns || no_pidns ||
- args->show_status || args->copy_status || args->freezer)) {
+ if (args->self && no_pidns) {
ckpt_err("Invalid mix of --self with multiprocess options\n");
exit(1);
}
diff --git a/restart.c b/restart.c
index d7b5b72..b2708c3 100644
--- a/restart.c
+++ b/restart.c
@@ -407,6 +407,42 @@ int process_args(struct app_restart_args *args)
if (args->mnt_pty)
args->mntns = 1;
+#ifndef CLONE_NEWPID
+ if (args->pidns) {
+ ckpt_err("This version of restart was compiled without "
+ "support for --pidns.\n");
+ exit(1);
+ }
+#endif
+
+#ifndef CHECKPOINT_DEBUG
+ if (global_debug) {
+ ckpt_err("This version of restart was compiled without "
+ "support for --debug.\n");
+ exit(1);
+ }
+#endif
+
+ if (args->pidns)
+ args->pids = 1;
+
+#if 0 /* Defered until __NR_eclone makes it to standard headers */
+#ifndef __NR_eclone
+ if (args->pids) {
+ ckpt_err("This version of restart was compiled without "
+ "support for --pids.\n");
+ exit(1);
+ }
+#endif
+#endif
+
+ if (args->self &&
+ (args->pids || args->pidns || args->show_status ||
+ args->copy_status || args->freezer)) {
+ ckpt_err("Invalid mix of --self with multiprocess options\n");
+ exit(1);
+ }
+
return 0;
}
--
1.6.0.4
next prev parent reply other threads:[~2010-03-19 6:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-19 6:26 [PATCH 0/14][user-cr] Enable linking with LIBLXC Sukadev Bhattiprolu
[not found] ` <20100319062659.GA23838-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-19 6:31 ` [PATCH 01/14][user-cr] Add app_restart_args->debug Sukadev Bhattiprolu
2010-03-19 6:31 ` [PATCH 02/14][user-cr] Add app_restart_args->verbose Sukadev Bhattiprolu
2010-03-19 6:32 ` [PATCH 03/14][user-cr] Add app_restart_args->ulogfd Sukadev Bhattiprolu
2010-03-19 6:32 ` [PATCH 04/14][user-cr] Add app_restart_args->uerrfd Sukadev Bhattiprolu
2010-03-19 6:32 ` [PATCH 05/14][user-cr] Define INIT_SIGNAL_ARRAY Sukadev Bhattiprolu
2010-03-19 6:32 ` [PATCH 06/14][user-cr] Create common.h Sukadev Bhattiprolu
2010-03-19 6:33 ` [PATCH 07/14][user-cr] Create app-checkpoint.h Sukadev Bhattiprolu
2010-03-19 6:33 ` [PATCH 08/14][user-cr] restart: Move main() to restart-main.c Sukadev Bhattiprolu
2010-03-19 6:33 ` [PATCH 09/14][user-cr] checkpoint: Move main() to checkpoint-main.c Sukadev Bhattiprolu
2010-03-19 6:33 ` [PATCH 10/14][user-cr] Have app_restart() return pid Sukadev Bhattiprolu
2010-03-19 6:34 ` [PATCH 11/14][user-cr] restart: Define process_args() Sukadev Bhattiprolu
2010-03-19 6:34 ` [PATCH 12/14][user-cr] app_restart(): mnt-pty implies mntns Sukadev Bhattiprolu
2010-03-19 6:34 ` Sukadev Bhattiprolu [this message]
2010-03-19 6:34 ` [PATCH 14/14][user-cr] Minimize unshare() calls Sukadev Bhattiprolu
[not found] ` <20100319063448.GN24844-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-24 4:08 ` Serge E. Hallyn
2010-03-24 4:26 ` Serge E. Hallyn
2010-03-30 7:04 ` [PATCH 0/14][user-cr] Enable linking with LIBLXC Oren Laadan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100319063433.GM24844@us.ibm.com \
--to=sukadev-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox