[Devel] [PATCH 05/14][user-cr] Define INIT_SIGNAL_ARRAY
Sukadev Bhattiprolu
sukadev at linux.vnet.ibm.com
Thu Mar 18 23:32:40 PDT 2010
From: Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com>
Date: Thu, 4 Mar 2010 21:15:25 -0800
Subject: [PATCH 05/14][user-cr] Define INIT_SIGNAL_ARRAY
Code to initialize the signal_array[] table will need to be shared by more
than one file. To enable this sharing with, define INIT_SIGNAL_ARRAY which
can later be used in many places.
Signed-off-by: Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com>
---
restart.c | 76 ++++++++++++++++++++++++++++++++-----------------------------
1 files changed, 40 insertions(+), 36 deletions(-)
diff --git a/restart.c b/restart.c
index b526bbd..4cd0bad 100644
--- a/restart.c
+++ b/restart.c
@@ -157,46 +157,50 @@ static inline void ckpt_msg(int fd, char *format, ...)
ckpt_msg(global_ulogfd, __VA_ARGS__); \
} while(0)
-#define SIGNAL_ENTRY(signal) { SIG ## signal, #signal }
-
-struct {
+struct signal_array {
int signum;
char *sigstr;
-} signal_array[] = {
- { 0, "NONE" },
- SIGNAL_ENTRY(ALRM),
- SIGNAL_ENTRY(HUP),
- SIGNAL_ENTRY(INT),
- SIGNAL_ENTRY(KILL),
- SIGNAL_ENTRY(PIPE),
- SIGNAL_ENTRY(POLL),
- SIGNAL_ENTRY(PROF),
- SIGNAL_ENTRY(TERM),
- SIGNAL_ENTRY(USR1),
- SIGNAL_ENTRY(USR2),
- SIGNAL_ENTRY(VTALRM),
- SIGNAL_ENTRY(STKFLT),
- SIGNAL_ENTRY(PWR),
- SIGNAL_ENTRY(WINCH),
- SIGNAL_ENTRY(CHLD),
- SIGNAL_ENTRY(URG),
- SIGNAL_ENTRY(TTIN),
- SIGNAL_ENTRY(TTOU),
- SIGNAL_ENTRY(STOP),
- SIGNAL_ENTRY(CONT),
- SIGNAL_ENTRY(ABRT),
- SIGNAL_ENTRY(FPE),
- SIGNAL_ENTRY(ILL),
- SIGNAL_ENTRY(QUIT),
- SIGNAL_ENTRY(SEGV),
- SIGNAL_ENTRY(TRAP),
- SIGNAL_ENTRY(SYS),
- SIGNAL_ENTRY(BUS),
- SIGNAL_ENTRY(XCPU),
- SIGNAL_ENTRY(XFSZ),
- { -1, "LAST" },
};
+#define SIGNAL_ENTRY(signal) { SIG ## signal, #signal }
+
+#define INIT_SIGNAL_ARRAY { \
+ { 0, "NONE" }, \
+ SIGNAL_ENTRY(ALRM), \
+ SIGNAL_ENTRY(HUP), \
+ SIGNAL_ENTRY(INT), \
+ SIGNAL_ENTRY(KILL), \
+ SIGNAL_ENTRY(PIPE), \
+ SIGNAL_ENTRY(POLL), \
+ SIGNAL_ENTRY(PROF), \
+ SIGNAL_ENTRY(TERM), \
+ SIGNAL_ENTRY(USR1), \
+ SIGNAL_ENTRY(USR2), \
+ SIGNAL_ENTRY(VTALRM), \
+ SIGNAL_ENTRY(STKFLT), \
+ SIGNAL_ENTRY(PWR), \
+ SIGNAL_ENTRY(WINCH), \
+ SIGNAL_ENTRY(CHLD), \
+ SIGNAL_ENTRY(URG), \
+ SIGNAL_ENTRY(TTIN), \
+ SIGNAL_ENTRY(TTOU), \
+ SIGNAL_ENTRY(STOP), \
+ SIGNAL_ENTRY(CONT), \
+ SIGNAL_ENTRY(ABRT), \
+ SIGNAL_ENTRY(FPE), \
+ SIGNAL_ENTRY(ILL), \
+ SIGNAL_ENTRY(QUIT), \
+ SIGNAL_ENTRY(SEGV), \
+ SIGNAL_ENTRY(TRAP), \
+ SIGNAL_ENTRY(SYS), \
+ SIGNAL_ENTRY(BUS), \
+ SIGNAL_ENTRY(XCPU), \
+ SIGNAL_ENTRY(XFSZ), \
+ { -1, "LAST" }, \
+}
+
+static struct signal_array signal_array[] = INIT_SIGNAL_ARRAY;
+
static char *sig2str(int sig)
{
int i = 0;
--
1.6.0.4
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list