[CRIU] [PATCH RFC v2 11/14] files: Kill fd parameter of transport_name_gen()

Kirill Tkhai ktkhai at virtuozzo.com
Fri Oct 28 14:07:33 PDT 2016


Since transport socket is per-process, we do not need
fd parameter anymore.

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

diff --git a/criu/files.c b/criu/files.c
index 0c7544c..c39238c 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -883,11 +883,10 @@ static struct fd_open_state states[] = {
 
 #define want_post_open_stage()	do { states[2].required = true; } while (0)
 
-static void transport_name_gen(struct sockaddr_un *addr, int *len,
-		int pid, int fd)
+static void transport_name_gen(struct sockaddr_un *addr, int *len, int pid)
 {
 	addr->sun_family = AF_UNIX;
-	snprintf(addr->sun_path, UNIX_PATH_MAX, "x/crtools-fd-%d-%d", pid, fd);
+	snprintf(addr->sun_path, UNIX_PATH_MAX, "x/crtools-fd-%d", pid);
 	*len = SUN_LEN(addr);
 	*addr->sun_path = '\0';
 }
@@ -950,7 +949,7 @@ int send_fd_to_peer(int fd, struct fdinfo_list_entry *fle)
 
 	pr_info("\t\tWait fdinfo pid=%d\n", fle->pid);
 	futex_wait_while(&pstree_item_by_virt(fle->pid)->transport_fd, 0);
-	transport_name_gen(&saddr, &len, fle->pid, -1);
+	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, false, (unsigned long *)&fle);
 }
@@ -1663,7 +1662,7 @@ static int open_transport_socket(pid_t pid)
 		return -1;
 	}
 
-	transport_name_gen(&saddr, &slen, pid, -1);
+	transport_name_gen(&saddr, &slen, pid);
 	if (bind(sock, (struct sockaddr *)&saddr, slen) < 0) {
 		pr_perror("Can't bind transport socket %s", saddr.sun_path + 1);
 		return -1;



More information about the CRIU mailing list