[CRIU] [PATCH 08/10] Add fowners magic, template and parasite command definition

Cyrill Gorcunov gorcunov at openvz.org
Mon Mar 12 16:55:21 EDT 2012


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 crtools.c          |    6 ++++++
 include/crtools.h  |    5 ++++-
 include/image.h    |   15 +++++++++++++++
 include/parasite.h |    1 +
 4 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/crtools.c b/crtools.c
index 469a7b3..e6f7eb1 100644
--- a/crtools.c
+++ b/crtools.c
@@ -111,6 +111,12 @@ struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX] = {
 		.magic	= CREDS_MAGIC,
 	},
 
+	/* file/pipe owners */
+	[CR_FD_FOWNERS] = {
+		.fmt	= FMT_FNAME_FOWNERS,
+		.magic	= FOWNERS_MAGIC,
+	},
+
 	/* UTS namespace */
 	[CR_FD_UTSNS] = {
 		.fmt	= FMT_FNAME_UTSNS,
diff --git a/include/crtools.h b/include/crtools.h
index ee35cc7..a869536 100644
--- a/include/crtools.h
+++ b/include/crtools.h
@@ -30,6 +30,7 @@ enum {
 	CR_FD_INETSK,
 	CR_FD_ITIMERS,
 	CR_FD_CREDS,
+	CR_FD_FOWNERS,
 
 	/*
 	 * Global entries
@@ -77,6 +78,7 @@ extern struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX];
 #define FMT_FNAME_INETSK	"inetsk-%d.img"
 #define FMT_FNAME_ITIMERS	"itimers-%d.img"
 #define FMT_FNAME_CREDS		"creds-%d.img"
+#define FMT_FNAME_FOWNERS	"fowners-%d.img"
 #define FMT_FNAME_UTSNS		"utsns-%d.img"
 #define FMT_FNAME_IPCNS_VAR	"ipcns-var-%d.img"
 #define FMT_FNAME_IPCNS_SHM	"ipcns-shm-%d.img"
@@ -112,7 +114,8 @@ struct cr_fdset {
 	CR_FD_DESC_USE(CR_FD_UNIXSK)		|\
 	CR_FD_DESC_USE(CR_FD_INETSK)		|\
 	CR_FD_DESC_USE(CR_FD_ITIMERS)		|\
-	CR_FD_DESC_USE(CR_FD_CREDS)		)
+	CR_FD_DESC_USE(CR_FD_CREDS)		|\
+	CR_FD_DESC_USE(CR_FD_FOWNERS))
 #define CR_FD_DESC_NS				(\
 	CR_FD_DESC_USE(CR_FD_UTSNS)		|\
 	CR_FD_DESC_USE(CR_FD_IPCNS_VAR)		|\
diff --git a/include/image.h b/include/image.h
index 2847440..5773a7a 100644
--- a/include/image.h
+++ b/include/image.h
@@ -22,6 +22,7 @@
 #define SK_QUEUES_MAGIC	0x56264026 /* Suzdal */
 #define UTSNS_MAGIC	0x54473203 /* Smolensk */
 #define CREDS_MAGIC	0x54023547 /* Kozelsk */
+#define FOWNERS_MAGIC	0x59453036 /* Kolpino */
 #define IPCNS_VAR_MAGIC	0x53115007 /* Samara */
 #define IPCNS_SHM_MAGIC	0x46283044 /* Odessa */
 #define IPCNS_MSG_MAGIC	0x55453737 /* Moscow */
@@ -36,10 +37,24 @@
 #define FDINFO_CWD	3
 #define FDINFO_EXE	4
 
+#define FOWNER_FD	1
+#define FOWNER_PIPE	2
+
 #define PAGE_IMAGE_SIZE	4096
 #define PAGE_RSS	1
 #define PAGE_ANON	2
 
+struct fowner_entry {
+	u8	type;
+	u64	id;
+
+	u32	uid;
+	u32	euid;
+	u32	signum;
+	u32	pid_type;
+	u32	pid;
+} __packed;
+
 struct fdinfo_entry {
 	u8	type;
 	u8	len;
diff --git a/include/parasite.h b/include/parasite.h
index 5936317..c255394 100644
--- a/include/parasite.h
+++ b/include/parasite.h
@@ -30,6 +30,7 @@ enum {
 	PARASITE_CMD_DUMP_MISC,
 	PARASITE_CMD_DUMP_TID_ADDR,
 	PARASITE_CMD_DUMP_SK_QUEUES,
+	PARASITE_CMD_DUMP_FOWNERS,
 
 	PARASITE_CMD_MAX,
 };
-- 
1.7.7.6



More information about the CRIU mailing list