Squid-2.2.STABLE2: UNIX domain IPC communication Switches Squid to UNIX domain IPC communication with it's child processes instead of TCP/IP on the loopback interface or pipes. Index: squid/configure diff -u squid/configure:1.1.1.30.2.4 squid/configure:1.1.1.30.2.5 --- squid/configure:1.1.1.30.2.4 Thu Apr 29 22:49:25 1999 +++ squid/configure Tue May 11 00:59:02 1999 @@ -4010,6 +4010,7 @@ setsid \ sigaction \ snprintf \ + socketpair \ srand48 \ srandom \ sysconf \ Index: squid/configure.in diff -u squid/configure.in:1.1.1.32.2.4 squid/configure.in:1.1.1.32.2.5 --- squid/configure.in:1.1.1.32.2.4 Thu Apr 29 22:49:29 1999 +++ squid/configure.in Tue May 11 00:59:06 1999 @@ -929,6 +929,7 @@ setsid \ sigaction \ snprintf \ + socketpair \ srand48 \ srandom \ sysconf \ Index: squid/src/authenticate.c diff -u squid/src/authenticate.c:1.1.1.7 squid/src/authenticate.c:1.1.1.7.10.1 --- squid/src/authenticate.c:1.1.1.7 Sun Jan 24 09:34:04 1999 +++ squid/src/authenticate.c Tue May 11 00:59:30 1999 @@ -114,7 +114,7 @@ authenticators = helperCreate("authenticator"); authenticators->cmdline = Config.Program.authenticate; authenticators->n_to_start = Config.authenticateChildren; - authenticators->ipc_type = IPC_TCP_SOCKET; + authenticators->ipc_type = IPC_STREAM; helperOpenServers(authenticators); if (!init) { cachemgrRegister("authenticator", Index: squid/src/defines.h diff -u squid/src/defines.h:1.1.1.23 squid/src/defines.h:1.1.1.23.6.3 --- squid/src/defines.h:1.1.1.23 Mon Apr 12 23:11:00 1999 +++ squid/src/defines.h Tue May 11 01:13:17 1999 @@ -193,7 +193,17 @@ #define IPC_TCP_SOCKET 1 #define IPC_UDP_SOCKET 2 #define IPC_FIFO 3 +#define IPC_UNIX_STREAM 4 +#define IPC_UNIX_DGRAM 5 +#if HAVE_SOCKETPAIR && defined (AF_UNIX) +#define IPC_STREAM IPC_UNIX_STREAM +#define IPC_DGRAM IPC_UNIX_DGRAM +#else +#define IPC_STREAM IPC_TCP_SOCKET +#define IPC_DGRAM IPC_UDP_SOCKET +#endif + #define STORE_META_KEY STORE_META_KEY_MD5 #define STORE_META_TLD_START sizeof(int)+sizeof(char) Index: squid/src/dns.c diff -u squid/src/dns.c:1.1.1.19 squid/src/dns.c:1.1.1.19.10.1 --- squid/src/dns.c:1.1.1.19 Sun Jan 24 09:34:09 1999 +++ squid/src/dns.c Tue May 11 00:59:31 1999 @@ -54,7 +54,7 @@ if (dnsservers == NULL) dnsservers = helperCreate("dnsserver"); dnsservers->n_to_start = Config.dnsChildren; - dnsservers->ipc_type = IPC_TCP_SOCKET; + dnsservers->ipc_type = IPC_STREAM; assert(dnsservers->cmdline == NULL); wordlistAdd(&dnsservers->cmdline, Config.Program.dnsserver); if (Config.onoff.res_defnames) Index: squid/src/icmp.c diff -u squid/src/icmp.c:1.1.1.18 squid/src/icmp.c:1.1.1.18.10.1 --- squid/src/icmp.c:1.1.1.18 Sun Jan 24 09:34:13 1999 +++ squid/src/icmp.c Tue May 11 00:59:31 1999 @@ -193,7 +193,7 @@ int wfd; args[0] = "(pinger)"; args[1] = NULL; - x = ipcCreate(IPC_UDP_SOCKET, + x = ipcCreate(IPC_DGRAM, Config.Program.pinger, args, "Pinger Socket", @@ -203,6 +203,7 @@ return; assert(rfd == wfd); icmp_sock = rfd; + fd_note (icmp_sock, "pinger"); commSetSelect(icmp_sock, COMM_SELECT_READ, icmpRecv, NULL, 0); commSetTimeout(icmp_sock, -1, NULL, NULL); debug(29, 1) ("Pinger socket opened on FD %d\n", icmp_sock); Index: squid/src/ipc.c diff -u squid/src/ipc.c:1.1.1.7 squid/src/ipc.c:1.1.1.7.10.1 --- squid/src/ipc.c:1.1.1.7 Sun Jan 24 09:34:14 1999 +++ squid/src/ipc.c Tue May 11 00:59:31 1999 @@ -123,6 +123,24 @@ fd_open(cwfd = p2c[1], FD_PIPE, "IPC FIFO Child Write"); fd_open(crfd = c2p[0], FD_PIPE, "IPC FIFO Child Read"); fd_open(pwfd = c2p[1], FD_PIPE, "IPC FIFO Parent Write"); +#if HAVE_SOCKETPAIR && defined(AF_UNIX) + } else if (type == IPC_UNIX_STREAM) { + int fds[2]; + if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) { + debug(50, 0) ("ipcCreate: socketpair: %s\n", xstrerror()); + return -1; + } + fd_open(prfd = pwfd = fds[0], FD_PIPE, "IPC UNIX STREAM Parent"); + fd_open(crfd = cwfd = fds[1], FD_PIPE, "IPC UNIX STREAM Parent"); + } else if (type == IPC_UNIX_DGRAM) { + int fds[2]; + if (socketpair(AF_UNIX, SOCK_DGRAM, 0, fds) < 0) { + debug(50, 0) ("ipcCreate: socketpair: %s\n", xstrerror()); + return -1; + } + fd_open(prfd = pwfd = fds[0], FD_PIPE, "IPC UNIX DGRAM Parent"); + fd_open(crfd = cwfd = fds[1], FD_PIPE, "IPC UNIX DGRAM Parent"); +#endif } else { assert(IPC_NONE); } Index: squid/src/redirect.c diff -u squid/src/redirect.c:1.1.1.18 squid/src/redirect.c:1.1.1.18.10.1 --- squid/src/redirect.c:1.1.1.18 Sun Jan 24 09:34:18 1999 +++ squid/src/redirect.c Tue May 11 00:59:31 1999 @@ -133,7 +133,7 @@ redirectors = helperCreate("redirector"); wordlistAdd(&redirectors->cmdline, Config.Program.redirect); redirectors->n_to_start = Config.redirectChildren; - redirectors->ipc_type = IPC_TCP_SOCKET; + redirectors->ipc_type = IPC_STREAM; helperOpenServers(redirectors); if (!init) { cachemgrRegister("redirector", Index: squid/src/unlinkd.c diff -u squid/src/unlinkd.c:1.1.1.12 squid/src/unlinkd.c:1.1.1.12.2.1 --- squid/src/unlinkd.c:1.1.1.12 Wed Apr 21 14:50:37 1999 +++ squid/src/unlinkd.c Tue May 11 00:59:32 1999 @@ -116,12 +116,7 @@ struct timeval slp; args[0] = "(unlinkd)"; args[1] = NULL; -#if HAVE_POLL && defined(_SQUID_OSF_) - /* pipes and poll() don't get along on DUNIX -DW */ - x = ipcCreate(IPC_TCP_SOCKET, -#else - x = ipcCreate(IPC_FIFO, -#endif + x = ipcCreate(IPC_STREAM, Config.Program.unlinkd, args, "unlinkd", Index: squid/include/autoconf.h.in diff -u squid/include/autoconf.h.in:1.1.1.25 squid/include/autoconf.h.in:1.1.1.25.4.1 --- squid/include/autoconf.h.in:1.1.1.25 Tue Apr 20 17:25:50 1999 +++ squid/include/autoconf.h.in Tue May 11 01:01:26 1999 @@ -360,6 +360,9 @@ /* Define if you have the snprintf function. */ #undef HAVE_SNPRINTF +/* Define if you have the socketpair function. */ +#undef HAVE_SOCKETPAIR + /* Define if you have the srand48 function. */ #undef HAVE_SRAND48