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

Kirill Tkhai ktkhai at virtuozzo.com
Tue Dec 13 07:07:33 PST 2016


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

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

diff --git a/criu/files.c b/criu/files.c
index 73c23b4..a5568cf 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -928,13 +928,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)
@@ -963,7 +966,7 @@ static int send_fd_to_self(int fd, struct fdinfo_list_entry *fle)
 
 	fle->received = 1;
 
-	return 0;
+	return set_fds_event(fle->pid);
 }
 
 static int post_open_fd(int pid, struct fdinfo_list_entry *fle)



More information about the CRIU mailing list