From: Amos Jeffries Date: Mon, 8 Oct 2012 05:21:11 +0000 (-0600) Subject: Windows: cleanup Squid OS detection macros X-Git-Tag: SQUID_3_4_0_1~605 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7aa9bb3ef627dfe52c0999f12759bb151a4e92c5;p=thirdparty%2Fsquid.git Windows: cleanup Squid OS detection macros * _SQUID_WINDOWS_ for any Windows build specific code * _SQUID_CYGWIN_ for CygWin Windows build specific code * _SQUID_MINGW_ for MinGW Windows build specific code --- diff --git a/compat/getnameinfo.c b/compat/getnameinfo.c index 76c6ec28e1..194fd03277 100644 --- a/compat/getnameinfo.c +++ b/compat/getnameinfo.c @@ -112,7 +112,7 @@ #include #endif -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ #undef IN_ADDR #include #endif diff --git a/compat/mswin.cc b/compat/mswin.cc index baa8a88715..03fa66ec2d 100644 --- a/compat/mswin.cc +++ b/compat/mswin.cc @@ -37,7 +37,7 @@ /* The following code section is part of an EXPERIMENTAL native */ /* Windows NT/2000 Squid port - Compiles only on MS Visual C++ or MinGW */ -#if _SQUID_MSWIN_ || _SQUID_MINGW_ +#if _SQUID_WINDOWS_ && !_SQUID_CYGWIN_ #undef strerror #define sys_nerr _sys_nerr diff --git a/compat/osdetect.h b/compat/osdetect.h index 4b98346432..d3fbce0cf7 100644 --- a/compat/osdetect.h +++ b/compat/osdetect.h @@ -73,10 +73,6 @@ #define _SQUID_WINDOWS_ 1 #elif defined(WIN32) || defined(WINNT) || defined(__WIN32__) || defined(__WIN32) -/* We are using _SQUID_MSWIN_ define in cf.data.pre, so - it must be defined to 1 to avoid the build failure of cfgen. - */ -#define _SQUID_MSWIN_ 1 #define _SQUID_WINDOWS_ 1 #elif defined(__APPLE__) diff --git a/compat/types.h b/compat/types.h index 59a32cbe63..20e265a1d5 100644 --- a/compat/types.h +++ b/compat/types.h @@ -91,7 +91,7 @@ * "%lx" instead of "%llx" */ #ifndef PRId64 -#if _SQUID_MSWIN_ /* Windows native port using MSVCRT */ +#if _SQUID_WINDOWS_ #define PRId64 "I64d" #elif SIZEOF_INT64_T > SIZEOF_LONG #define PRId64 "lld" @@ -101,7 +101,7 @@ #endif #ifndef PRIu64 -#if _SQUID_MSWIN_ /* Windows native port using MSVCRT */ +#if _SQUID_WINDOWS_ #define PRIu64 "I64u" #elif SIZEOF_INT64_T > SIZEOF_LONG #define PRIu64 "llu" @@ -111,7 +111,7 @@ #endif #ifndef PRIX64 -#if _SQUID_MSWIN_ /* Windows native port using MSVCRT */ +#if _SQUID_WINDOWS_ #define PRIX64 "I64X" #elif SIZEOF_INT64_T > SIZEOF_LONG #define PRIX64 "llX" diff --git a/configure.ac b/configure.ac index 4b915e107c..7f1c2cdd20 100644 --- a/configure.ac +++ b/configure.ac @@ -2405,7 +2405,8 @@ AC_CHECK_HEADERS( \ inttypes.h \ db.h \ db_185.h \ - wchar.h + wchar.h \ + ws2tcpip.h ) CHECK_STRUCT_PAM_CONV diff --git a/helpers/basic_auth/LDAP/basic_ldap_auth.cc b/helpers/basic_auth/LDAP/basic_ldap_auth.cc index aef28f5834..c580df076c 100644 --- a/helpers/basic_auth/LDAP/basic_ldap_auth.cc +++ b/helpers/basic_auth/LDAP/basic_ldap_auth.cc @@ -93,8 +93,7 @@ #include #include -#if _SQUID_MSWIN_ /* Native Windows port and MinGW */ - +#if _SQUID_WINDOWS_ && !_SQUID_CYGWIN_ #define snprintf _snprintf #include #include @@ -554,7 +553,7 @@ main(int argc, char **argv) /* On Windows ldap_start_tls_s is available starting from Windows XP, * so we need to bind at run-time with the function entry point */ -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ if (use_tls) { HMODULE WLDAP32Handle; diff --git a/helpers/basic_auth/RADIUS/basic_radius_auth.cc b/helpers/basic_auth/RADIUS/basic_radius_auth.cc index 3efa8b0562..73e2304f71 100644 --- a/helpers/basic_auth/RADIUS/basic_radius_auth.cc +++ b/helpers/basic_auth/RADIUS/basic_radius_auth.cc @@ -120,7 +120,7 @@ static int retries = 10; char progname[] = "basic_radius_auth"; -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ void Win32SockCleanup(void) { @@ -522,7 +522,7 @@ main(int argc, char **argv) fprintf(stderr, "FATAL: %s: Shared secret not specified\n", argv[0]); exit(1); } -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ { WSADATA wsaData; WSAStartup(2, &wsaData); diff --git a/helpers/basic_auth/SSPI/valid.h b/helpers/basic_auth/SSPI/valid.h index c6113b66e7..86339e8e0c 100644 --- a/helpers/basic_auth/SSPI/valid.h +++ b/helpers/basic_auth/SSPI/valid.h @@ -88,7 +88,7 @@ static void debug(char *format,...) { #ifdef DEBUG -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ if (debug_enabled) { va_list args; @@ -97,7 +97,7 @@ debug(char *format,...) vfprintf(stderr, format, args); va_end(args); } -#endif /* _SQUID_MSWIN_ */ +#endif /* _SQUID_WINDOWS_ */ #endif /* DEBUG */ } #endif /* __GNUC__ */ diff --git a/helpers/digest_auth/LDAP/ldap_backend.cc b/helpers/digest_auth/LDAP/ldap_backend.cc index f7d9244e00..46409866ef 100644 --- a/helpers/digest_auth/LDAP/ldap_backend.cc +++ b/helpers/digest_auth/LDAP/ldap_backend.cc @@ -12,7 +12,7 @@ #include "ldap_backend.h" -#if _SQUID_MSWIN_ /* Native Windows port and MinGW */ +#if _SQUID_WINDOWS_ && !_SQUID_CYGWIN_ #define snprintf _snprintf #include @@ -303,7 +303,7 @@ ldapconnect(void) /* On Windows ldap_start_tls_s is available starting from Windows XP, * so we need to bind at run-time with the function entry point */ -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ if (use_tls) { HMODULE WLDAP32Handle; diff --git a/helpers/digest_auth/eDirectory/edir_ldapext.cc b/helpers/digest_auth/eDirectory/edir_ldapext.cc index 812b4e82bb..f0f362254d 100644 --- a/helpers/digest_auth/eDirectory/edir_ldapext.cc +++ b/helpers/digest_auth/eDirectory/edir_ldapext.cc @@ -26,7 +26,7 @@ #include "digest_common.h" -#if _SQUID_MSWIN_ /* Native Windows port and MinGW */ +#if _SQUID_WINDOWS_ && !_SQUID_CYGWIN_ #define snprintf _snprintf #include diff --git a/helpers/digest_auth/eDirectory/ldap_backend.cc b/helpers/digest_auth/eDirectory/ldap_backend.cc index 814a5df023..e7deefc258 100644 --- a/helpers/digest_auth/eDirectory/ldap_backend.cc +++ b/helpers/digest_auth/eDirectory/ldap_backend.cc @@ -11,7 +11,7 @@ #include "ldap_backend.h" -#if _SQUID_MSWIN_ /* Native Windows port and MinGW */ +#if _SQUID_WINDOWS_ && !_SQUID_CYGWIN_ #define snprintf _snprintf #include @@ -331,7 +331,7 @@ ldapconnect(void) /* On Windows ldap_start_tls_s is available starting from Windows XP, * so we need to bind at run-time with the function entry point */ -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ if (use_tls) { HMODULE WLDAP32Handle; diff --git a/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc b/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc index 48d8691696..30394da729 100644 --- a/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc +++ b/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc @@ -51,7 +51,7 @@ #include #endif -#if _SQUID_MSWIN_ /* Native Windows port and MinGW */ +#if _SQUID_WINDOWS_ && !_SQUID_CYGWIN_ #define snprintf _snprintf #include @@ -451,7 +451,7 @@ main(int argc, char **argv) /* On Windows ldap_start_tls_s is available starting from Windows XP, * so we need to bind at run-time with the function entry point */ -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ if (use_tls) { HMODULE WLDAP32Handle; diff --git a/include/squid.h b/include/squid.h index 8db5c118fc..b844bddf18 100644 --- a/include/squid.h +++ b/include/squid.h @@ -115,7 +115,7 @@ #define SQUID_MAXPATHLEN 256 // TODO: determine if this is required. OR if compat/os/mswin.h works -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ /** \cond AUTODOCS-IGNORE */ using namespace Squid; /** \endcond */ diff --git a/include/util.h b/include/util.h index 69be2b209d..b3b60b7f23 100644 --- a/include/util.h +++ b/include/util.h @@ -111,7 +111,7 @@ SQUIDCEXTERN unsigned int RoundTo(const unsigned int num, const unsigned int wha /* Windows Port */ /* win32lib.c */ -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ SQUIDCEXTERN int chroot (const char *); #if !HAVE_GETTIMEOFDAY SQUIDCEXTERN int gettimeofday(struct timeval * ,void *); diff --git a/lib/dirent.c b/lib/dirent.c index 898240344e..83d82aa6d2 100644 --- a/lib/dirent.c +++ b/lib/dirent.c @@ -49,7 +49,7 @@ #include "squid.h" /* The following code section is part of the native Windows Squid port */ -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ #include "util.h" #include @@ -309,4 +309,4 @@ seekdir(DIR * dirp, long lPos) while ((dirp->dd_stat < lPos) && readdir(dirp)); } } -#endif /* _SQUID_MSWIN_ */ +#endif /* _SQUID_WINDOWS_ */ diff --git a/src/DiskIO/AIO/aio_win32.h b/src/DiskIO/AIO/aio_win32.h index 9596209bc1..fb05246277 100644 --- a/src/DiskIO/AIO/aio_win32.h +++ b/src/DiskIO/AIO/aio_win32.h @@ -42,7 +42,7 @@ typedef int64_t off64_t; #endif -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ union sigval { int sival_int; /* integer value */ @@ -104,6 +104,6 @@ int aio_error64(const struct aiocb64 *); int aio_open(const char *, int); void aio_close(int); -#endif /* _SQUID_MSWIN_ */ +#endif /* _SQUID_WINDOWS_ */ #endif /* USE_DISKIO_AIO */ #endif /* __WIN32_AIO_H__ */ diff --git a/src/WinSvc.cc b/src/WinSvc.cc index 9f8ba5a56e..cac66d5d18 100644 --- a/src/WinSvc.cc +++ b/src/WinSvc.cc @@ -35,7 +35,7 @@ #include "protos.h" #include "squid_windows.h" -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ #ifndef _MSWSOCK_ #include #endif diff --git a/src/cf.data.pre b/src/cf.data.pre index f640b8d943..c2f154bea9 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -8080,7 +8080,7 @@ DOC_START DOC_END NAME: windows_ipaddrchangemonitor -IFDEF: _SQUID_MSWIN_ +IFDEF: _SQUID_WINDOWS_ COMMENT: on|off TYPE: onoff DEFAULT: on diff --git a/src/cf_gen_defines b/src/cf_gen_defines index c430bbb1b9..1fd4ab9ca0 100644 --- a/src/cf_gen_defines +++ b/src/cf_gen_defines @@ -29,7 +29,7 @@ BEGIN { define["USE_WCCP"]="--enable-wccp" define["USE_WCCPv2"]="--enable-wccpv2" define["USE_QOS_TOS"]="--enable-zph-qos" - define["_SQUID_MSWIN_"]="MS Windows" + define["_SQUID_WINDOWS_"]="MS Windows" define["SO_MARK&&USE_LIBCAP"]="Packet MARK (Linux)" } /^IFDEF:/ { diff --git a/src/comm.cc b/src/comm.cc index c5a1ed7010..ee63785436 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -655,7 +655,7 @@ comm_apply_flags(int new_socket, commSetReuseAddr(new_socket); if (addr.GetPort() > (unsigned short) 0) { -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ if (sock_type != SOCK_DGRAM) #endif commSetNoLinger(new_socket); @@ -714,7 +714,7 @@ comm_import_opened(const Comm::ConnectionPointer &conn, fd_table[conn->fd].flags.close_on_exec = 1; if (conn->local.GetPort() > (unsigned short) 0) { -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ if (AI->ai_socktype != SOCK_DGRAM) #endif fd_table[conn->fd].flags.nolinger = 1; @@ -1315,7 +1315,7 @@ commSetTcpRcvbuf(int fd, int size) int commSetNonBlocking(int fd) { -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ int flags; int dummy = 0; #endif @@ -1335,7 +1335,7 @@ commSetNonBlocking(int fd) } else { #endif #endif -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ if ((flags = fcntl(fd, F_GETFL, dummy)) < 0) { debugs(50, 0, "FD " << fd << ": fcntl F_GETFL: " << xstrerror()); @@ -1359,7 +1359,7 @@ commSetNonBlocking(int fd) int commUnsetNonBlocking(int fd) { -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ int nonblocking = FALSE; if (ioctlsocket(fd, FIONBIO, (unsigned long *) &nonblocking) < 0) { diff --git a/src/comm/Loops.h b/src/comm/Loops.h index d587da9392..56f064037b 100644 --- a/src/comm/Loops.h +++ b/src/comm/Loops.h @@ -36,7 +36,7 @@ void QuickPollRequired(void); * This is a per-port limit for ICP/HTCP ports. * DNS has a separate limit. */ -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ #define INCOMING_UDP_MAX 1 #else #define INCOMING_UDP_MAX 15 @@ -45,7 +45,7 @@ void QuickPollRequired(void); /** * Max number of DNS messages to receive per call to DNS read handler */ -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ #define INCOMING_DNS_MAX 1 #else #define INCOMING_DNS_MAX 15 @@ -55,7 +55,7 @@ void QuickPollRequired(void); * Max number of new TCP connections to accept per call to the TCP listener poller. * This is a per-port limit for HTTP/HTTPS ports. */ -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ #define INCOMING_TCP_MAX 1 #else #define INCOMING_TCP_MAX 10 diff --git a/src/debug.cc b/src/debug.cc index 590587b776..7a639ef567 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -62,7 +62,7 @@ static void _db_print_syslog(const char *format, va_list args); static void _db_print_stderr(const char *format, va_list args); static void _db_print_file(const char *format, va_list args); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ extern LPCRITICAL_SECTION dbg_mutex; typedef BOOL (WINAPI * PFInitializeCriticalSectionAndSpinCount) (LPCRITICAL_SECTION, DWORD); #endif @@ -76,7 +76,7 @@ _db_print(const char *format,...) va_list args2; va_list args3; -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ /* Multiple WIN32 threads may call this simultaneously */ if (!dbg_mutex) { @@ -129,7 +129,7 @@ _db_print(const char *format,...) _db_print_syslog(format, args3); #endif -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ LeaveCriticalSection(dbg_mutex); #endif @@ -485,7 +485,7 @@ _db_rotate_log(void) --i; snprintf(from, MAXPATHLEN, "%s.%d", debug_log_file, i - 1); snprintf(to, MAXPATHLEN, "%s.%d", debug_log_file, i); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ remove (to); #endif @@ -496,14 +496,14 @@ _db_rotate_log(void) * You can't rename open files on Microsoft "operating systems" * so we close before renaming. */ -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ if (debug_log != stderr) fclose(debug_log); #endif /* Rotate the current log to .0 */ if (Debug::rotateNumber > 0) { snprintf(to, MAXPATHLEN, "%s.%d", debug_log_file, 0); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ remove (to); #endif diff --git a/src/dns_internal.cc b/src/dns_internal.cc index 27578b0daf..7af69c1455 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -236,7 +236,7 @@ static void idnsAddPathComponent(const char *buf); static void idnsFreeNameservers(void); static void idnsFreeSearchpath(void); static void idnsParseNameservers(void); -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ static void idnsParseResolvConf(void); #endif #if _SQUID_WINDOWS_ @@ -365,7 +365,7 @@ idnsParseNameservers(void) } } -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ static void idnsParseResolvConf(void) { @@ -1534,7 +1534,7 @@ dnsInit(void) assert(0 == nns); idnsParseNameservers(); -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ if (0 == nns) idnsParseResolvConf(); diff --git a/src/dnsserver.cc b/src/dnsserver.cc index 17630da24f..d15a37332f 100644 --- a/src/dnsserver.cc +++ b/src/dnsserver.cc @@ -497,7 +497,7 @@ main(int argc, char *argv[]) } } -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ { WSADATA wsaData; @@ -511,7 +511,7 @@ main(int argc, char *argv[]) memset(request, '\0', REQ_SZ); if (fgets(request, REQ_SZ, stdin) == NULL) { -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ WSACleanup(); #endif exit(1); diff --git a/src/fd.cc b/src/fd.cc index 4655fe47f5..2dca81d55e 100644 --- a/src/fd.cc +++ b/src/fd.cc @@ -49,7 +49,7 @@ int default_read_method(int, char *, int); int default_write_method(int, const char *, int); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ int socket_read_method(int, char *, int); int socket_write_method(int, const char *, int); int file_read_method(int, char *, int); @@ -122,7 +122,7 @@ fd_close(int fd) *F = fde(); } -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ int socket_read_method(int fd, char *buf, int len) @@ -222,7 +222,7 @@ fd_open(int fd, unsigned int type, const char *desc) F->type = type; F->flags.open = 1; F->epoll_state = 0; -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ F->win32.handle = _get_osfhandle(fd); diff --git a/src/fde.cc b/src/fde.cc index 8aae9767f5..2eef778abb 100644 --- a/src/fde.cc +++ b/src/fde.cc @@ -53,7 +53,7 @@ fde::dumpStats (StoreEntry &dumpEntry, int fdNumber) if (!flags.open) return; -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ storeAppendPrintf(&dumpEntry, "%4d 0x%-8lX %-6.6s %4d %7" PRId64 "%c %7" PRId64 "%c %-21s %s\n", fdNumber, @@ -77,7 +77,7 @@ fde::DumpStats (StoreEntry *dumpEntry) { int i; storeAppendPrintf(dumpEntry, "Active file descriptors:\n"); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ storeAppendPrintf(dumpEntry, "%-4s %-10s %-6s %-4s %-7s* %-7s* %-21s %s\n", "File", @@ -92,7 +92,7 @@ fde::DumpStats (StoreEntry *dumpEntry) "Nwrite", "Remote Address", "Description"); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ storeAppendPrintf(dumpEntry, "---- ---------- ------ ---- -------- -------- --------------------- ------------------------------\n"); #else storeAppendPrintf(dumpEntry, "---- ------ ---- -------- -------- --------------------- ------------------------------\n"); diff --git a/src/fde.h b/src/fde.h index f82e190901..5263a1399c 100644 --- a/src/fde.h +++ b/src/fde.h @@ -132,7 +132,7 @@ public: SSL *ssl; SSL_CTX *dynamicSslContext; ///< cached and then freed when fd is closed #endif -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ struct { long handle; } win32; @@ -185,7 +185,7 @@ private: ssl = NULL; dynamicSslContext = NULL; #endif -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ win32.handle = NULL; #endif tosFromServer = '\0'; diff --git a/src/fs/coss/store_dir_coss.cc b/src/fs/coss/store_dir_coss.cc index 5b66e4365e..f9e55812ed 100644 --- a/src/fs/coss/store_dir_coss.cc +++ b/src/fs/coss/store_dir_coss.cc @@ -901,7 +901,7 @@ CossSwapDir::create() if (::stat(path, &swap_sb) < 0) { debugs (47, 2, "COSS swap space space being allocated."); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ mkdir(path); #else diff --git a/src/fs/ufs/UFSSwapDir.cc b/src/fs/ufs/UFSSwapDir.cc index 3fa84bc461..7560be48d4 100644 --- a/src/fs/ufs/UFSSwapDir.cc +++ b/src/fs/ufs/UFSSwapDir.cc @@ -575,7 +575,7 @@ Fs::Ufs::UFSSwapDir::createDirectory(const char *aPath, int should_exist) fatalf("Swap directory %s is not a directory.", aPath); } -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ } else if (0 == mkdir(aPath)) { #else @@ -1307,7 +1307,7 @@ Fs::Ufs::UFSSwapDir::DirClean(int swap_index) if (dir_pointer == NULL) { if (errno == ENOENT) { debugs(36, DBG_CRITICAL, HERE << "WARNING: Creating " << p1); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ if (mkdir(p1) == 0) #else diff --git a/src/globals.h b/src/globals.h index 3980d926d8..517e0d895f 100644 --- a/src/globals.h +++ b/src/globals.h @@ -115,7 +115,7 @@ extern size_t store_pages_max; /* 0 */ extern int64_t store_maxobjsize; /* -1 */ extern hash_table *proxy_auth_username_cache; /* NULL */ extern int incoming_sockets_accepted; -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ extern unsigned int WIN32_Socks_initialized; /* 0 */ #endif #if _SQUID_WINDOWS_ diff --git a/src/helper.cc b/src/helper.cc index 73c4b8855f..85d0dc0392 100644 --- a/src/helper.cc +++ b/src/helper.cc @@ -96,7 +96,7 @@ HelperServerBase::initStats() void HelperServerBase::closePipesSafely() { -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ int no = index + 1; shutdown(writePipe->fd, SD_BOTH); @@ -109,7 +109,7 @@ HelperServerBase::closePipesSafely() readPipe->close(); writePipe->close(); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ if (hIpc) { if (WaitForSingleObject(hIpc, 5000) != WAIT_OBJECT_0) { getCurrentTime(); @@ -125,7 +125,7 @@ HelperServerBase::closePipesSafely() void HelperServerBase::closeWritePipeSafely() { -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ int no = index + 1; shutdown(writePipe->fd, (readPipe->fd == writePipe->fd ? SD_BOTH : SD_SEND)); @@ -136,7 +136,7 @@ HelperServerBase::closeWritePipeSafely() readPipe->fd = -1; writePipe->close(); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ if (hIpc) { if (WaitForSingleObject(hIpc, 5000) != WAIT_OBJECT_0) { getCurrentTime(); diff --git a/src/icmp/Icmp4.h b/src/icmp/Icmp4.h index 231fc668d7..6a39f2c5d6 100644 --- a/src/icmp/Icmp4.h +++ b/src/icmp/Icmp4.h @@ -83,7 +83,7 @@ #if _SQUID_WINDOWS_ #include "fde.h" -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ #if HAVE_WINSOCK2_H #include @@ -123,7 +123,7 @@ typedef struct icmphdr { uint32_t timestamp; /* not part of ICMP, but we need it */ } icmphdr; -#endif /* _SQUID_MSWIN_ */ +#endif /* _SQUID_WINDOWS_ */ #ifndef ICMP_ECHO #define ICMP_ECHO 8 diff --git a/src/icmp/IcmpPinger.cc b/src/icmp/IcmpPinger.cc index 76580c3d92..e69123a6da 100644 --- a/src/icmp/IcmpPinger.cc +++ b/src/icmp/IcmpPinger.cc @@ -58,7 +58,7 @@ IcmpPinger::~IcmpPinger() Close(); } -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ void Win32SockCleanup(void) { @@ -70,7 +70,7 @@ Win32SockCleanup(void) int IcmpPinger::Open(void) { -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ WSADATA wsaData; WSAPROTOCOL_INFO wpi; @@ -152,7 +152,7 @@ IcmpPinger::Open(void) return icmp_sock; -#else /* !_SQUID_MSWIN_ */ +#else /* !_SQUID_WINDOWS_ */ /* non-windows apps use stdin/out pipes as the squid channel(s) */ socket_from_squid = 0; // use STDIN macro ?? @@ -164,7 +164,7 @@ IcmpPinger::Open(void) void IcmpPinger::Close(void) { -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ shutdown(icmp_sock, SD_BOTH); close(icmp_sock); diff --git a/src/icmp/IcmpSquid.cc b/src/icmp/IcmpSquid.cc index 4d5490be4f..d2cd6a647d 100644 --- a/src/icmp/IcmpSquid.cc +++ b/src/icmp/IcmpSquid.cc @@ -263,11 +263,11 @@ IcmpSquid::Open(void) if (localhost.SetIPv4()) SendEcho(localhost, S_ICMP_ECHO, "localhost"); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ debugs(37, 4, HERE << "Pinger handle: 0x" << std::hex << hIpc << std::dec << ", PID: " << pid); -#endif /* _SQUID_MSWIN_ */ +#endif /* _SQUID_WINDOWS_ */ return icmp_sock; #else /* USE_ICMP */ return -1; @@ -284,7 +284,7 @@ IcmpSquid::Close(void) debugs(37, DBG_IMPORTANT, HERE << "Closing Pinger socket on FD " << icmp_sock); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ send(icmp_sock, (const void *) "$shutdown\n", 10, 0); @@ -292,7 +292,7 @@ IcmpSquid::Close(void) comm_close(icmp_sock); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ if (hIpc) { if (WaitForSingleObject(hIpc, 12000) != WAIT_OBJECT_0) { diff --git a/src/icmp/pinger.cc b/src/icmp/pinger.cc index 3151ab55c4..a9a25421f3 100644 --- a/src/icmp/pinger.cc +++ b/src/icmp/pinger.cc @@ -71,7 +71,7 @@ #include "Icmp6.h" #include "IcmpPinger.h" -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ #if HAVE_WINSOCK2_H #include @@ -105,7 +105,7 @@ Win32__WSAFDIsSet(int fd, fd_set FAR * set) /* non-windows use STDOUT for feedback to squid */ #define LINK_TO_SQUID 1 -#endif /* _SQUID_MSWIN_ */ +#endif /* _SQUID_WINDOWS_ */ // ICMP Engines are declared global here so they can call each other easily. IcmpPinger control; diff --git a/src/ip/Address.h b/src/ip/Address.h index 9ec57cba0f..520ed92671 100644 --- a/src/ip/Address.h +++ b/src/ip/Address.h @@ -45,7 +45,7 @@ #if HAVE_NETINET_IP_H #include #endif -#if _SQUID_MSWIN_ +#if HAVE_WS2TCPIP_H #include #endif #if HAVE_NETDB_H diff --git a/src/main.cc b/src/main.cc index a0e91a12b6..5468467d8f 100644 --- a/src/main.cc +++ b/src/main.cc @@ -203,7 +203,7 @@ static void SquidShutdown(void); static void mainSetCwd(void); static int checkRunningPid(void); -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ static const char *squid_start_script = "squid_start"; #endif @@ -618,7 +618,7 @@ rotate_logs(int sig) { do_rotate = 1; RotateSignal = sig; -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ #if !HAVE_SIGACTION signal(sig, rotate_logs); @@ -632,7 +632,7 @@ reconfigure(int sig) { do_reconfigure = 1; ReconfigureSignal = sig; -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ #if !HAVE_SIGACTION signal(sig, reconfigure); @@ -661,7 +661,7 @@ shut_down(int sig) " pid " << ppid << ": " << xstrerror()); } -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ #if KILL_PARENT_OPT if (!IamMasterProcess() && ppid > 1) { @@ -1019,7 +1019,7 @@ mainInitialize(void) setSystemLimits(); debugs(1, DBG_IMPORTANT, "With " << Squid_MaxFD << " file descriptors available"); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ debugs(1, DBG_IMPORTANT, "With " << _getmaxstdio() << " CRT stdio descriptors available"); @@ -1576,7 +1576,7 @@ sendSignal(void) exit(0); } -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ /* * This function is run when Squid is in daemon mode, just * before the parent forks and starts up the child process. @@ -1619,7 +1619,7 @@ mainStartScript(const char *prog) } } -#endif /* _SQUID_MSWIN_ */ +#endif /* _SQUID_WINDOWS_ */ static int checkRunningPid(void) @@ -1649,7 +1649,7 @@ checkRunningPid(void) static void watch_child(char *argv[]) { -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ char *prog; #if _SQUID_NEXT_ @@ -1818,7 +1818,7 @@ watch_child(char *argv[]) } /* NOTREACHED */ -#endif /* _SQUID_MSWIN_ */ +#endif /* _SQUID_WINDOWS_ */ } diff --git a/src/ssl/certificate_db.cc b/src/ssl/certificate_db.cc index 0e1e530790..addd853dd2 100644 --- a/src/ssl/certificate_db.cc +++ b/src/ssl/certificate_db.cc @@ -23,7 +23,7 @@ Ssl::Lock::Lock(std::string const &aFilename) : filename(aFilename), -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ hFile(INVALID_HANDLE_VALUE) #else fd(-1) @@ -33,7 +33,7 @@ Ssl::Lock::Lock(std::string const &aFilename) : bool Ssl::Lock::locked() const { -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ return hFile != INVALID_HANDLE_VALUE; #else return fd != -1; @@ -43,7 +43,7 @@ bool Ssl::Lock::locked() const void Ssl::Lock::lock() { -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ hFile = CreateFile(TEXT(filename.c_str()), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) #else @@ -52,7 +52,7 @@ void Ssl::Lock::lock() #endif throw std::runtime_error("Failed to open file " + filename); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ if (!LockFile(hFile, 0, 0, 1, 0)) #else if (flock(fd, LOCK_EX) != 0) @@ -62,7 +62,7 @@ void Ssl::Lock::lock() void Ssl::Lock::unlock() { -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ if (hFile != INVALID_HANDLE_VALUE) { UnlockFile(hFile, 0, 0, 1, 0); CloseHandle(hFile); diff --git a/src/ssl/certificate_db.h b/src/ssl/certificate_db.h index 1a2b07b7f1..c817fa3390 100644 --- a/src/ssl/certificate_db.h +++ b/src/ssl/certificate_db.h @@ -23,7 +23,7 @@ public: const char *name() const { return filename.c_str(); } private: std::string filename; -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ HANDLE hFile; ///< Windows file handle. #else int fd; ///< Linux file descriptor. diff --git a/src/ssl/support.h b/src/ssl/support.h index 5b6f0bf0ca..efff316471 100644 --- a/src/ssl/support.h +++ b/src/ssl/support.h @@ -244,7 +244,7 @@ int asn1timeToString(ASN1_TIME *tm, char *buf, int len); bool setClientSNI(SSL *ssl, const char *fqdn); } //namespace Ssl -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ #if defined(__cplusplus) @@ -272,6 +272,6 @@ int SSL_set_fd(SSL *ssl, int fd) #endif /* __cplusplus */ -#endif /* _SQUID_MSWIN_ */ +#endif /* _SQUID_WINDOWS_ */ #endif /* SQUID_SSL_SUPPORT_H */ diff --git a/src/store_dir.cc b/src/store_dir.cc index d8acbdb02c..fb82c21702 100644 --- a/src/store_dir.cc +++ b/src/store_dir.cc @@ -124,7 +124,7 @@ StoreController::createOneStore(Store &aStore) * The following is a workaround for create store directories sequentially * when running on native Windows port. */ -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ if (fork()) return; @@ -133,7 +133,7 @@ StoreController::createOneStore(Store &aStore) aStore.create(); -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ exit(0); @@ -145,7 +145,7 @@ StoreController::create() { swapDir->create(); -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ pid_t pid; diff --git a/src/tools.cc b/src/tools.cc index 6170662831..440d7652c0 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -368,7 +368,7 @@ death(int sig) #endif #endif /* PRINT_STACK_TRACE */ -#if SA_RESETHAND == 0 && !_SQUID_MSWIN_ +#if SA_RESETHAND == 0 && !_SQUID_WINDOWS_ signal(SIGSEGV, SIG_DFL); signal(SIGBUS, SIG_DFL); @@ -456,7 +456,7 @@ debug_trap(const char *message) void sig_child(int sig) { -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ #if _SQUID_NEXT_ union wait status; #else @@ -995,7 +995,7 @@ squid_signal(int sig, SIGHDLR * func, int flags) debugs(50, DBG_CRITICAL, "sigaction: sig=" << sig << " func=" << func << ": " << xstrerror()); #else -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ /* On Windows, only SIGINT, SIGILL, SIGFPE, SIGTERM, SIGBREAK, SIGABRT and SIGSEGV signals are supported, so we must care of don't call signal() for other value. diff --git a/src/unlinkd.cc b/src/unlinkd.cc index 64224a83e4..6edf0d822e 100644 --- a/src/unlinkd.cc +++ b/src/unlinkd.cc @@ -149,7 +149,7 @@ unlinkdUnlink(const char *path) void unlinkdClose(void) -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ { if (unlinkd_wfd > -1) { @@ -224,7 +224,7 @@ unlinkdInit(void) #if USE_POLL && _SQUID_OSF_ /* pipes and poll() don't get along on DUNIX -DW */ IPC_STREAM, -#elif _SQUID_MSWIN_ +#elif _SQUID_WINDOWS_ /* select() will fail on a pipe */ IPC_TCP_SOCKET, #else @@ -265,7 +265,7 @@ unlinkdInit(void) debugs(2, DBG_IMPORTANT, "Unlinkd pipe opened on FD " << unlinkd_wfd); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ debugs(2, 4, "Unlinkd handle: 0x" << std::hex << hIpc << std::dec << ", PID: " << pid); diff --git a/src/win32.cc b/src/win32.cc index 7d2bfd64f9..ba039a5c07 100644 --- a/src/win32.cc +++ b/src/win32.cc @@ -35,7 +35,7 @@ #include "squid_windows.h" #include "win32.h" -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ #if HAVE_WIN32_PSAPI #include #endif diff --git a/src/win32.h b/src/win32.h index 5834dba61e..d5719a62dc 100644 --- a/src/win32.h +++ b/src/win32.h @@ -33,7 +33,7 @@ * */ -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ #if HAVE_SYS_TIME_H #include diff --git a/tools/cachemgr.cc b/tools/cachemgr.cc index e0c1a8fdda..6785aa62a0 100644 --- a/tools/cachemgr.cc +++ b/tools/cachemgr.cc @@ -164,7 +164,7 @@ static const char *make_auth_header(const cachemgr_request * req); static int check_target_acl(const char *hostname, int port); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ static int s_iInitCount = 0; int Win32SockInit(void) @@ -607,7 +607,7 @@ static int read_reply(int s, cachemgr_request * req) { char buf[4 * 1024]; -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ int reply; char *tmpfile = tempnam(NULL, "tmp0000"); @@ -631,7 +631,7 @@ read_reply(int s, cachemgr_request * req) parse_menu = 1; if (fp == NULL) { -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ perror(tmpfile); xfree(tmpfile); #else @@ -643,7 +643,7 @@ read_reply(int s, cachemgr_request * req) return 1; } -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ while ((reply=recv(s, buf , sizeof(buf), 0)) > 0) fwrite(buf, 1, reply, fp); @@ -782,7 +782,7 @@ read_reply(int s, cachemgr_request * req) } fclose(fp); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ remove(tmpfile); xfree(tmpfile); @@ -897,7 +897,7 @@ main(int argc, char *argv[]) cachemgr_request *req; now = time(NULL); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ Win32SockInit(); atexit(Win32SockCleanup); @@ -1005,7 +1005,7 @@ read_request(void) else return NULL; -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ if (strlen(buf) == 0 || strlen(buf) == 4000) #else