[CRIU] [PATCH 2/3] compel: Add recv fd helper

Pavel Emelyanov xemul at virtuozzo.com
Mon Mar 6 08:40:26 PST 2017


The same for libcompel.so user.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 compel/include/uapi/infect-util.h |  1 +
 compel/src/lib/infect-util.c      | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/compel/include/uapi/infect-util.h b/compel/include/uapi/infect-util.h
index bd2010c..7307ba5 100644
--- a/compel/include/uapi/infect-util.h
+++ b/compel/include/uapi/infect-util.h
@@ -2,4 +2,5 @@
 #define __COMPEL_INFECT_UTIL_H__
 struct parasite_ctl;
 extern int compel_util_send_fd(struct parasite_ctl *ctl, int fd);
+extern int compel_util_recv_fd(struct parasite_ctl *ctl, int *pfd);
 #endif
diff --git a/compel/src/lib/infect-util.c b/compel/src/lib/infect-util.c
index b8f20bf..5d6d0dd 100644
--- a/compel/src/lib/infect-util.c
+++ b/compel/src/lib/infect-util.c
@@ -19,3 +19,14 @@ int compel_util_send_fd(struct parasite_ctl *ctl, int fd)
 	return 0;
 }
 
+int compel_util_recv_fd(struct parasite_ctl *ctl, int *pfd)
+{
+	int sk;
+
+	sk = compel_rpc_sock(ctl);
+	if ((*pfd = recv_fd(sk)) < 0) {
+		pr_perror("Can't send file descriptor");
+		return -1;
+	}
+	return 0;
+}
-- 
2.5.5



More information about the CRIU mailing list