[CRIU] [PATCH 2/3] scm: Allow to pass flags argument to recv_fds()

Kirill Tkhai ktkhai at virtuozzo.com
Wed Jan 25 01:46:28 PST 2017


This will be used to pass MSG_DONTWAIT in next patch.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 include/common/scm-code.c |    4 ++--
 include/common/scm.h      |    9 +++++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/include/common/scm-code.c b/include/common/scm-code.c
index 4015405d2..b36bf68e9 100644
--- a/include/common/scm-code.c
+++ b/include/common/scm-code.c
@@ -75,7 +75,7 @@ int send_fds(int sock, struct sockaddr_un *saddr, int len,
 	return 0;
 }
 
-int recv_fds(int sock, int *fds, int nr_fds, void *data, unsigned ch_size)
+int __recv_fds(int sock, int *fds, int nr_fds, void *data, unsigned ch_size, int flags)
 {
 	struct scm_fdset fdset;
 	struct cmsghdr *cmsg;
@@ -88,7 +88,7 @@ int recv_fds(int sock, int *fds, int nr_fds, void *data, unsigned ch_size)
 		min_fd = min(CR_SCM_MAX_FD, nr_fds - i);
 		scm_fdset_init_chunk(&fdset, min_fd, data, ch_size);
 
-		ret = __sys(recvmsg)(sock, &fdset.hdr, 0);
+		ret = __sys(recvmsg)(sock, &fdset.hdr, flags);
 		if (ret <= 0)
 			return ret ? __sys_err(ret) : -ENOMSG;
 
diff --git a/include/common/scm.h b/include/common/scm.h
index 3874d1c8e..ab27137b8 100644
--- a/include/common/scm.h
+++ b/include/common/scm.h
@@ -27,8 +27,13 @@ struct scm_fdset {
 
 extern int send_fds(int sock, struct sockaddr_un *saddr, int len,
 		int *fds, int nr_fds, void *data, unsigned ch_size);
-extern int recv_fds(int sock, int *fds, int nr_fds,
-		void *data, unsigned ch_size);
+extern int __recv_fds(int sock, int *fds, int nr_fds,
+		void *data, unsigned ch_size, int flags);
+static inline int recv_fds(int sock, int *fds, int nr_fds,
+		void *data, unsigned ch_size)
+{
+	return __recv_fds(sock, fds, nr_fds, data, ch_size, 0);
+}
 
 static inline int send_fd(int sock, struct sockaddr_un *saddr, int saddr_len, int fd)
 {



More information about the CRIU mailing list