[CRIU] [PATCH v5 23/33] files: Set fds event after sending fd to peer

Kirill Tkhai ktkhai at virtuozzo.com
Mon Dec 26 06:28:23 PST 2016


This is need to make receiving a fle non-blocking.
We will sleep on task_st futex instead of this.

v5: Do not set event in send_fd_to_self()

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/files.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/criu/files.c b/criu/files.c
index 8e04309b6..e798a4062 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -957,13 +957,16 @@ int recv_fd_from_peer(struct fdinfo_list_entry *fle)
 int send_fd_to_peer(int fd, struct fdinfo_list_entry *fle)
 {
 	struct sockaddr_un saddr;
-	int len, sock;
+	int len, sock, ret;
 
 	sock = get_service_fd(TRANSPORT_FD_OFF);
 
 	transport_name_gen(&saddr, &len, fle->pid);
 	pr_info("\t\tSend fd %d to %s\n", fd, saddr.sun_path + 1);
-	return send_fds(sock, &saddr, len, &fd, 1, (void *)&fle, sizeof(struct fdinfo_list_entry *));
+	ret = send_fds(sock, &saddr, len, &fd, 1, (void *)&fle, sizeof(struct fdinfo_list_entry *));
+	if (ret < 0)
+		return -1;
+	return set_fds_event(fle->pid);
 }
 
 static int send_fd_to_self(int fd, struct fdinfo_list_entry *fle)



More information about the CRIU mailing list