[CRIU] [PATCH 14/22] files: Move signalfd into files image

Pavel Emelyanov xemul at virtuozzo.com
Fri Jun 30 14:00:42 MSK 2017


Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/cr-restore.c         | 2 +-
 criu/files.c              | 3 +++
 criu/include/image-desc.h | 2 +-
 criu/signalfd.c           | 8 ++++++--
 images/fdinfo.proto       | 2 ++
 5 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 4fd30f8..f637ba2 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -264,7 +264,6 @@ static struct collect_image_info *cinfos[] = {
 	&pipe_cinfo,
 	&fifo_cinfo,
 	&unix_sk_cinfo,
-	&signalfd_cinfo,
 	&inotify_cinfo,
 	&inotify_mark_cinfo,
 	&fanotify_cinfo,
@@ -285,6 +284,7 @@ static struct collect_image_info *cinfos_files[] = {
 	&eventfd_cinfo,
 	&epoll_cinfo,
 	&epoll_tfd_cinfo,
+	&signalfd_cinfo,
 };
 
 /* These images are requered to restore namespaces */
diff --git a/criu/files.c b/criu/files.c
index fee032c..2d5ec5e 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -1823,6 +1823,9 @@ static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i)
 	case FD_TYPES__EVENTPOLL:
 		ret = collect_one_file_entry(fe, fe->epfd->id, &fe->epfd->base, &epoll_cinfo);
 		break;
+	case FD_TYPES__SIGNALFD:
+		ret = collect_one_file_entry(fe, fe->sgfd->id, &fe->sgfd->base, &signalfd_cinfo);
+		break;
 	}
 
 	return ret;
diff --git a/criu/include/image-desc.h b/criu/include/image-desc.h
index bd18050..0b9ad00 100644
--- a/criu/include/image-desc.h
+++ b/criu/include/image-desc.h
@@ -66,7 +66,6 @@ enum {
 	CR_FD_TTY_INFO,
 	CR_FD_TTY_DATA,
 	CR_FD_REMAP_FPATH,
-	CR_FD_SIGNALFD,
 	CR_FD_INOTIFY_FILE,
 	CR_FD_FANOTIFY_FILE,
 	CR_FD_TUNFILE,
@@ -106,6 +105,7 @@ enum {
 	CR_FD_NETLINK_SK,
 	CR_FD_EVENTFD_FILE,
 	CR_FD_EVENTPOLL_FILE,
+	CR_FD_SIGNALFD,
 
 	CR_FD_AUTOFS,
 	CR_FD_NS,
diff --git a/criu/signalfd.c b/criu/signalfd.c
index f33efa1..bd117a3 100644
--- a/criu/signalfd.c
+++ b/criu/signalfd.c
@@ -27,6 +27,7 @@ int is_signalfd_link(char *link)
 static int dump_one_signalfd(int lfd, u32 id, const struct fd_parms *p)
 {
 	SignalfdEntry sfd = SIGNALFD_ENTRY__INIT;
+	FileEntry fe = FILE_ENTRY__INIT;
 
 	if (parse_fdinfo(lfd, FD_TYPES__SIGNALFD, &sfd))
 		return -1;
@@ -35,8 +36,11 @@ static int dump_one_signalfd(int lfd, u32 id, const struct fd_parms *p)
 	sfd.flags = p->flags;
 	sfd.fown = (FownEntry *)&p->fown;
 
-	return pb_write_one(img_from_set(glob_imgset, CR_FD_SIGNALFD),
-			&sfd, PB_SIGNALFD);
+	fe.type = FD_TYPES__SIGNALFD;
+	fe.id = sfd.id;
+	fe.sgfd = &sfd;
+
+	return pb_write_one(img_from_set(glob_imgset, CR_FD_FILES), &fe, PB_FILE);
 }
 
 const struct fdtype_ops signalfd_dump_ops = {
diff --git a/images/fdinfo.proto b/images/fdinfo.proto
index 011c55c..89b7e3b 100644
--- a/images/fdinfo.proto
+++ b/images/fdinfo.proto
@@ -7,6 +7,7 @@ import "packet-sock.proto";
 import "sk-netlink.proto";
 import "eventfd.proto";
 import "eventpoll.proto";
+import "signalfd.proto";
 
 enum fd_types {
 	UND		= 0;
@@ -49,4 +50,5 @@ message file_entry {
 	optional netlink_sk_entry	nlsk	= 7;
 	optional eventfd_file_entry	efd	= 8;
 	optional eventpoll_file_entry	epfd	= 9;
+	optional signalfd_entry		sgfd	= 10;
 }
-- 
2.1.4



More information about the CRIU mailing list