This patch is generated from the unix_sockets-1 branch of HEAD-1 in squid Sun Jan 25 14:35:09 2004 GMT See http://devel.squid-cache.org/ Index: squid/configure.in diff -u squid/configure.in:1.49 squid/configure.in:1.10.2.6 --- squid/configure.in:1.49 Mon Apr 1 12:29:39 2002 +++ squid/configure.in Thu Apr 4 15:51:48 2002 @@ -1612,6 +1612,7 @@ setsid \ sigaction \ snprintf \ + socketpair \ srand48 \ srandom \ statfs \ Index: squid/src/defines.h diff -u squid/src/defines.h:1.17 squid/src/defines.h:1.7.2.6 --- squid/src/defines.h:1.17 Wed Feb 27 01:16:52 2002 +++ squid/src/defines.h Thu Apr 4 15:51:50 2002 @@ -193,6 +193,16 @@ #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 Index: squid/src/dns.c diff -u squid/src/dns.c:1.6 squid/src/dns.c:1.3.2.3 --- squid/src/dns.c:1.6 Fri Mar 16 09:22:13 2001 +++ squid/src/dns.c Sat Apr 14 06:04:47 2001 @@ -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.5 squid/src/icmp.c:1.3.2.3 --- squid/src/icmp.c:1.5 Sun Mar 31 07:12:47 2002 +++ squid/src/icmp.c Thu Apr 4 15:51:50 2002 @@ -196,7 +196,7 @@ int wfd; args[0] = "(pinger)"; args[1] = NULL; - x = ipcCreate(IPC_UDP_SOCKET, + x = ipcCreate(IPC_DGRAM, Config.Program.pinger, args, "Pinger Socket", @@ -206,6 +206,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.8 squid/src/ipc.c:1.3.2.4 --- squid/src/ipc.c:1.8 Tue Dec 25 04:38:51 2001 +++ squid/src/ipc.c Thu Apr 4 15:51:50 2002 @@ -123,6 +123,29 @@ 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]; + int buflen = 32768; + if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) { + debug(50, 0) ("ipcCreate: socketpair: %s\n", xstrerror()); + return -1; + } + setsockopt(fds[0], SOL_SOCKET, SO_SNDBUF, (void *)&buflen, sizeof(buflen)); + setsockopt(fds[0], SOL_SOCKET, SO_RCVBUF, (void *)&buflen, sizeof(buflen)); + setsockopt(fds[1], SOL_SOCKET, SO_SNDBUF, (void *)&buflen, sizeof(buflen)); + setsockopt(fds[1], SOL_SOCKET, SO_RCVBUF, (void *)&buflen, sizeof(buflen)); + 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.7 squid/src/redirect.c:1.5.2.3 --- squid/src/redirect.c:1.7 Sat Mar 3 02:44:32 2001 +++ squid/src/redirect.c Sat Apr 14 06:04:48 2001 @@ -158,7 +158,7 @@ redirectors = helperCreate("redirector"); 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.7 squid/src/unlinkd.c:1.3.2.5 --- squid/src/unlinkd.c:1.7 Tue Dec 25 04:38:51 2001 +++ squid/src/unlinkd.c Thu Apr 4 15:51:51 2002 @@ -165,8 +165,9 @@ args[1] = NULL; #if USE_POLL && defined(_SQUID_OSF_) /* pipes and poll() don't get along on DUNIX -DW */ - x = ipcCreate(IPC_TCP_SOCKET, + x = ipcCreate(IPC_STREAM, #else + /* We currently need to use FIFO.. see below */ x = ipcCreate(IPC_FIFO, #endif Config.Program.unlinkd, Index: squid/src/auth/basic/auth_basic.c diff -u squid/src/auth/basic/auth_basic.c:1.17 squid/src/auth/basic/auth_basic.c:1.2.4.6 --- squid/src/auth/basic/auth_basic.c:1.17 Wed Oct 24 02:42:14 2001 +++ squid/src/auth/basic/auth_basic.c Thu Apr 4 15:51:51 2002 @@ -543,7 +543,7 @@ basicauthenticators = helperCreate("basicauthenticator"); basicauthenticators->cmdline = basicConfig->authenticate; basicauthenticators->n_to_start = basicConfig->authenticateChildren; - basicauthenticators->ipc_type = IPC_TCP_SOCKET; + basicauthenticators->ipc_type = IPC_STREAM; helperOpenServers(basicauthenticators); if (!init) { cachemgrRegister("basicauthenticator", Index: squid/src/auth/digest/auth_digest.c diff -u squid/src/auth/digest/auth_digest.c:1.13 squid/src/auth/digest/auth_digest.c:1.1.4.6 --- squid/src/auth/digest/auth_digest.c:1.13 Sat Jan 12 19:21:39 2002 +++ squid/src/auth/digest/auth_digest.c Thu Apr 4 15:51:51 2002 @@ -881,7 +881,7 @@ digestauthenticators = helperCreate("digestauthenticator"); digestauthenticators->cmdline = digestConfig->authenticate; digestauthenticators->n_to_start = digestConfig->authenticateChildren; - digestauthenticators->ipc_type = IPC_TCP_SOCKET; + digestauthenticators->ipc_type = IPC_STREAM; helperOpenServers(digestauthenticators); if (!init) { cachemgrRegister("digestauthenticator", "User Authenticator Stats", Index: squid/src/auth/ntlm/auth_ntlm.c diff -u squid/src/auth/ntlm/auth_ntlm.c:1.19 squid/src/auth/ntlm/auth_ntlm.c:1.3.2.6 --- squid/src/auth/ntlm/auth_ntlm.c:1.19 Mon Feb 18 15:43:12 2002 +++ squid/src/auth/ntlm/auth_ntlm.c Thu Apr 4 15:51:51 2002 @@ -242,7 +242,7 @@ assert(proxy_auth_cache); ntlmauthenticators->cmdline = ntlmConfig->authenticate; ntlmauthenticators->n_to_start = ntlmConfig->authenticateChildren; - ntlmauthenticators->ipc_type = IPC_TCP_SOCKET; + ntlmauthenticators->ipc_type = IPC_STREAM; ntlmauthenticators->datapool = ntlm_helper_state_pool; ntlmauthenticators->IsAvailable = authenticateNTLMHelperServerAvailable; ntlmauthenticators->OnEmptyQueue = authenticateNTLMHelperServerOnEmpty; Index: squid/src/fs/diskd/store_dir_diskd.c diff -u squid/src/fs/diskd/store_dir_diskd.c:1.34 squid/src/fs/diskd/store_dir_diskd.c:1.9.2.6 --- squid/src/fs/diskd/store_dir_diskd.c:1.34 Mon Apr 1 13:58:06 2002 +++ squid/src/fs/diskd/store_dir_diskd.c Thu Apr 4 15:51:52 2002 @@ -410,12 +410,7 @@ args[2] = skey2; args[3] = skey3; args[4] = 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.diskd, args, "diskd", squid-unix_sockets-1-HEAD-1.new squid-unix_sockets-1-HEAD-1 differ: char 76, line 2