* [PATCH 1/2] Fix app_checkpoint() return code
@ 2010-03-31 6:54 Sukadev Bhattiprolu
[not found] ` <20100331065443.GA21065-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Sukadev Bhattiprolu @ 2010-03-31 6:54 UTC (permalink / raw)
To: Oren Laadan; +Cc: Containers, sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
From: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Date: Tue, 30 Mar 2010 18:59:10 -0700
Subject: [PATCH 1/2] Fix app_checkpoint() return code
Have app_checkpoint() return the return value from the system call
so callers find some useful information. Have main() can convert the
return value into a suitable exit status.
Signed-off-by: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
---
checkpoint-main.c | 4 +++-
checkpoint.c | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/checkpoint-main.c b/checkpoint-main.c
index f6faa32..bac65cc 100644
--- a/checkpoint-main.c
+++ b/checkpoint-main.c
@@ -145,6 +145,7 @@ static void parse_args(struct app_checkpoint_args *args, int argc, char *argv[])
int main(int argc, char *argv[])
{
+ int ret;
struct app_checkpoint_args args;
unsigned long flags = 0;
pid_t pid;
@@ -167,5 +168,6 @@ int main(int argc, char *argv[])
if (!args.container)
flags |= CHECKPOINT_SUBTREE;
- return app_checkpoint(pid, flags, &args);
+ ret = app_checkpoint(pid, flags, &args);
+ return (ret > 0) ? 0 : 1;
}
diff --git a/checkpoint.c b/checkpoint.c
index e3a1ce8..e0290c9 100644
--- a/checkpoint.c
+++ b/checkpoint.c
@@ -55,5 +55,5 @@ int app_checkpoint(int pid, unsigned long flags,
ckpt_err("checkpoint id %d\n", ret);
}
- return (ret > 0 ? 0 : 1);
+ return ret;
}
--
1.6.6.1
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <20100331065443.GA21065-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>]
* [PATCH 2/2] Add keep_frozen field to struct app_restart_args [not found] ` <20100331065443.GA21065-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> @ 2010-03-31 6:56 ` Sukadev Bhattiprolu 2010-04-01 4:59 ` [PATCH 1/2] Fix app_checkpoint() return code Oren Laadan 1 sibling, 0 replies; 3+ messages in thread From: Sukadev Bhattiprolu @ 2010-03-31 6:56 UTC (permalink / raw) To: Oren Laadan; +Cc: Containers From: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> Date: Tue, 30 Mar 2010 23:14:53 -0700 Subject: [PATCH 2/2] Add keep_frozen field to struct app_restart_args Add a field, keep_frozen that callers of app_restart() can use to leave the application frozen after restart. When this field is set, have app_restart() set the RESTART_FROZEN flag to sys_restart(). TODO: For now, this field will be used in LXC containers. A follow-on patch would add a command line option to /bin/restart to let users select this behavior. --- app-checkpoint.h | 3 +++ restart.c | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/app-checkpoint.h b/app-checkpoint.h index f740085..d2455f3 100644 --- a/app-checkpoint.h +++ b/app-checkpoint.h @@ -1,3 +1,5 @@ +#include <linux/checkpoint.h> +#include <linux/checkpoint_hdr.h> struct app_checkpoint_args { int outfd; @@ -19,6 +21,7 @@ struct app_restart_args { int show_status; int copy_status; char *freezer; + int keep_frozen; int infd; int klogfd; int ulogfd; diff --git a/restart.c b/restart.c index 5408152..d5fee0b 100644 --- a/restart.c +++ b/restart.c @@ -914,7 +914,7 @@ static int ckpt_coordinator(struct ckpt_ctx *ctx) if (ckpt_probe_child(root_pid, "root task") < 0) exit(1); - if (ctx->args->freezer) + if (ctx->args->freezer || ctx->args->keep_frozen) flags |= RESTART_FROZEN; if (ctx->args->keep_lsm) flags |= RESTART_KEEP_LSM; -- 1.6.6.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] Fix app_checkpoint() return code [not found] ` <20100331065443.GA21065-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> 2010-03-31 6:56 ` [PATCH 2/2] Add keep_frozen field to struct app_restart_args Sukadev Bhattiprolu @ 2010-04-01 4:59 ` Oren Laadan 1 sibling, 0 replies; 3+ messages in thread From: Oren Laadan @ 2010-04-01 4:59 UTC (permalink / raw) To: Sukadev Bhattiprolu; +Cc: Containers Both patches applies in user-cr:ckpt-v20-dev. Oren. Sukadev Bhattiprolu wrote: > From: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> > Date: Tue, 30 Mar 2010 18:59:10 -0700 > Subject: [PATCH 1/2] Fix app_checkpoint() return code > > Have app_checkpoint() return the return value from the system call > so callers find some useful information. Have main() can convert the > return value into a suitable exit status. > > Signed-off-by: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> > --- > checkpoint-main.c | 4 +++- > checkpoint.c | 2 +- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/checkpoint-main.c b/checkpoint-main.c > index f6faa32..bac65cc 100644 > --- a/checkpoint-main.c > +++ b/checkpoint-main.c > @@ -145,6 +145,7 @@ static void parse_args(struct app_checkpoint_args *args, int argc, char *argv[]) > > int main(int argc, char *argv[]) > { > + int ret; > struct app_checkpoint_args args; > unsigned long flags = 0; > pid_t pid; > @@ -167,5 +168,6 @@ int main(int argc, char *argv[]) > if (!args.container) > flags |= CHECKPOINT_SUBTREE; > > - return app_checkpoint(pid, flags, &args); > + ret = app_checkpoint(pid, flags, &args); > + return (ret > 0) ? 0 : 1; > } > diff --git a/checkpoint.c b/checkpoint.c > index e3a1ce8..e0290c9 100644 > --- a/checkpoint.c > +++ b/checkpoint.c > @@ -55,5 +55,5 @@ int app_checkpoint(int pid, unsigned long flags, > ckpt_err("checkpoint id %d\n", ret); > } > > - return (ret > 0 ? 0 : 1); > + return ret; > } ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-04-01 4:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-31 6:54 [PATCH 1/2] Fix app_checkpoint() return code Sukadev Bhattiprolu
[not found] ` <20100331065443.GA21065-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-31 6:56 ` [PATCH 2/2] Add keep_frozen field to struct app_restart_args Sukadev Bhattiprolu
2010-04-01 4:59 ` [PATCH 1/2] Fix app_checkpoint() return code Oren Laadan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox