From: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org,
dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org,
Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
Cc: Containers
<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
Subject: [PATCH 1/4][user-cr] Move common definitions to restart.h
Date: Wed, 24 Feb 2010 00:35:34 -0800 [thread overview]
Message-ID: <20100224083534.GC18758@us.ibm.com> (raw)
In-Reply-To: <20100224083452.GB18758-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
From: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Date: Tue, 23 Feb 2010 15:25:31 -0800
Subject: [PATCH 1/4][user-cr] Move common definitions to restart.h
To make restart() a library interface, the main() and related code in
restart.c should be moved to a separate file. To prepare for the move,
move some common definitions to a new file, 'restart.h'
---
restart.c | 44 ++------------------------------------------
restart.h | 45 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 42 deletions(-)
create mode 100644 restart.h
diff --git a/restart.c b/restart.c
index f5d23bb..7140786 100644
--- a/restart.c
+++ b/restart.c
@@ -39,6 +39,7 @@
#include "eclone.h"
#include "genstack.h"
#include "compat.h"
+#include "restart.h"
static char usage_str[] =
"usage: restart [opts]\n"
@@ -128,12 +129,7 @@ static char usage_str[] =
printf(__VA_ARGS__); \
} while(0)
-#define SIGNAL_ENTRY(signal) { SIG ## signal, #signal }
-
-struct {
- int signum;
- char *sigstr;
-} signal_array[] = {
+struct signal_array signal_array[] = {
{ 0, "NONE" },
SIGNAL_ENTRY(ALRM),
SIGNAL_ENTRY(HUP),
@@ -196,7 +192,6 @@ inline static int restart(pid_t pid, int fd, unsigned long flags, int logfd)
return syscall(__NR_restart, pid, fd, flags, logfd);
}
-#define BUFSIZE (4 * 4096)
struct hashent {
long key;
@@ -205,29 +200,6 @@ struct hashent {
};
struct task;
-struct ckpt_ctx;
-
-struct task {
- int flags; /* state and (later) actions */
-
- struct task *children; /* pointers to first child, next and prev */
- struct task *next_sib; /* sibling, and the creator of a process */
- struct task *prev_sib;
- struct task *creator;
-
- struct task *phantom; /* pointer to place-holdler task (if any) */
-
- pid_t pid; /* process IDs, our bread-&-butter */
- pid_t ppid;
- pid_t tgid;
- pid_t sid;
-
- pid_t rpid; /* [restart without vpids] actual (real) pid */
-
- struct ckpt_ctx *ctx; /* points back to the c/r context */
-
- pid_t real_parent; /* pid of task's real parent */
-};
/* zero_task represents creator of root_task (all pids 0) */
struct task zero_task;
@@ -360,18 +332,6 @@ struct args {
int keep_lsm;
};
-#define CKPT_COND_PIDZERO 0x1
-#define CKPT_COND_MNTPROC 0x2
-#define CKPT_COND_MNTPTY 0x4
-
-#define CKPT_COND_NONE 0
-#define CKPT_COND_ANY ULONG_MAX
-
-/* default for skip/warn/fail */
-#define CKPT_COND_WARN (CKPT_COND_MNTPROC | \
- CKPT_COND_MNTPTY)
-#define CKPT_COND_FAIL (CKPT_COND_NONE)
-
static void usage(char *str)
{
fprintf(stderr, "%s", str);
diff --git a/restart.h b/restart.h
new file mode 100644
index 0000000..6782399
--- /dev/null
+++ b/restart.h
@@ -0,0 +1,45 @@
+struct ckpt_ctx;
+
+struct task {
+ int flags; /* state and (later) actions */
+
+ struct task *children; /* pointers to first child, next and prev */
+ struct task *next_sib; /* sibling, and the creator of a process */
+ struct task *prev_sib;
+ struct task *creator;
+
+ struct task *phantom; /* pointer to place-holdler task (if any) */
+
+ pid_t pid; /* process IDs, our bread-&-butter */
+ pid_t ppid;
+ pid_t tgid;
+ pid_t sid;
+
+ pid_t rpid; /* [restart without vpids] actual (real) pid */
+
+ struct ckpt_ctx *ctx; /* points back to the c/r context */
+
+ pid_t real_parent; /* pid of task's real parent */
+};
+
+#define BUFSIZE (4 * 4096)
+
+#define CKPT_COND_PIDZERO 0x1
+#define CKPT_COND_MNTPROC 0x2
+#define CKPT_COND_MNTPTY 0x4
+
+#define CKPT_COND_NONE 0
+#define CKPT_COND_ANY ULONG_MAX
+
+/* default for skip/warn/fail */
+#define CKPT_COND_WARN (CKPT_COND_MNTPROC | \
+ CKPT_COND_MNTPTY)
+#define CKPT_COND_FAIL (CKPT_COND_NONE)
+
+#define SIGNAL_ENTRY(signal) { SIG ## signal, #signal }
+
+struct signal_array {
+ int signum;
+ char *sigstr;
+};
+
--
1.6.6.1
next prev parent reply other threads:[~2010-02-24 8:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-24 8:34 [RFC][PATCH 0/4][user-cr]: First try at integrating LXC and USER-CR Sukadev Bhattiprolu
[not found] ` <20100224083452.GB18758-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-02-24 8:35 ` Sukadev Bhattiprolu [this message]
[not found] ` <20100224083534.GC18758-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-03 0:04 ` [PATCH] c/r: fix regression (in "fix scheduling in atomic while restoring ipc shm") Oren Laadan
[not found] ` <1267574649-14269-1-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2010-03-03 15:38 ` Serge E. Hallyn
2010-02-24 8:36 ` [PATCH 2/4][user-cr] Rename struct args to struct restart_args Sukadev Bhattiprolu
2010-02-24 8:36 ` [PATCH 3/4][user-cr] Move main() in restart.c to restart-main.c Sukadev Bhattiprolu
2010-02-24 8:37 ` [PATCH 4/4][user-cr] Rename libeclone.a to libcheckpoint.a Sukadev Bhattiprolu
[not found] ` <20100224083726.GF18758-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-02-24 15:19 ` Serge E. Hallyn
[not found] ` <20100224151919.GB6425-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-02-24 22:26 ` Sukadev Bhattiprolu
2010-02-26 21:53 ` Oren Laadan
[not found] ` <4B8842C8.9080707-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2010-02-27 1:44 ` Sukadev Bhattiprolu
2010-02-24 15:15 ` [RFC][PATCH 0/4][user-cr]: First try at integrating LXC and USER-CR Serge E. Hallyn
2010-02-24 18:25 ` Cedric Le Goater
2010-02-26 21:52 ` Oren Laadan
[not found] ` <4B88429B.4000701-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2010-02-27 0:10 ` Sukadev Bhattiprolu
[not found] ` <20100227001002.GA22965-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-02-27 2:14 ` Oren Laadan
2010-03-01 21:22 ` 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=20100224083534.GC18758@us.ibm.com \
--to=sukadev-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org \
--cc=orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org \
--cc=serue-r/Jw6+rmf7HQT0dZR+AlfA@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