[master] b26a62dd2 Replace the mgt/wrk cli pipe(2) with a socketpair(AF_UNIX, SOCK_STREAM,…)

Poul-Henning Kamp phk at FreeBSD.org
Mon Jan 15 09:21:06 UTC 2024


commit b26a62dd24ffcbde77d58757e3ef08aaf73f1bdd
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jan 15 09:18:52 2024 +0000

    Replace the mgt/wrk cli pipe(2) with a socketpair(AF_UNIX, SOCK_STREAM,…)
    
    This should be a no-op on all contemporary UNIX implementations, but
    let's see what vtest tells us...

diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c
index b4fd329bb..0ea50c16e 100644
--- a/bin/varnishd/mgt/mgt_child.c
+++ b/bin/varnishd/mgt/mgt_child.c
@@ -42,6 +42,7 @@
 #include <syslog.h>
 #include <unistd.h>
 #include <sys/types.h>
+#include <sys/socket.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 
@@ -318,7 +319,7 @@ mgt_launch_child(struct cli *cli)
 	child_state = CH_STARTING;
 
 	/* Open pipe for mgt->child CLI */
-	AZ(pipe(cp));
+	AZ(socketpair(AF_UNIX, SOCK_STREAM, 0, cp));
 	heritage.cli_in = cp[0];
 	assert(cp[0] > STDERR_FILENO);	// See #2782
 	assert(cp[1] > STDERR_FILENO);


More information about the varnish-commit mailing list