From: Amos Jeffries Date: Mon, 9 Sep 2013 07:17:19 +0000 (-0600) Subject: Windows: cleanup Squid OS detection macros X-Git-Tag: SQUID_3_3_10~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=738c7ed71a33295050833eca0241f71a7ce15a04;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 59368aced8..aa8716c607 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..a731792e04 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 @@ -296,7 +296,7 @@ getgrnam(char *unused) { return &grp; } -#if defined(__MINGW32__) /* MinGW environment */ +#if _SQUID_MINGW_ int _free_osfhnd(int filehandle) { diff --git a/compat/os/mswin.h b/compat/os/mswin.h index 7b2081feaf..c23c4d9e3d 100644 --- a/compat/os/mswin.h +++ b/compat/os/mswin.h @@ -343,7 +343,7 @@ typedef struct { SQUIDCEXTERN _CRTIMP ioinfo * __pioinfo[]; SQUIDCEXTERN int __cdecl _free_osfhnd(int); -#elif defined(__MINGW32__) /* MinGW environment */ +#elif _SQUID_MINGW_ /* MinGW environment */ __MINGW_IMPORT ioinfo * __pioinfo[]; SQUIDCEXTERN int _free_osfhnd(int); 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/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 eb4461bc99..0672a1e644 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) { @@ -532,7 +532,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 744985f8a5..ec50e7bb7b 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 @@ -304,7 +304,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 020dc33d7c..0ce4fb82ce 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 @@ -332,7 +332,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 dfce3568da..05bc028ec2 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -8390,7 +8390,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 0c9bc28c80..2e7b2c6a86 100644 --- a/src/cf_gen_defines +++ b/src/cf_gen_defines @@ -32,7 +32,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 3f107c4203..ea073eb1cf 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -670,7 +670,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); @@ -729,7 +729,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; @@ -1330,7 +1330,7 @@ commSetTcpRcvbuf(int fd, int size) int commSetNonBlocking(int fd) { -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ int flags; int dummy = 0; #endif @@ -1350,7 +1350,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()); @@ -1374,7 +1374,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 b10d2619bb..efff2fde69 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_ @@ -366,7 +366,7 @@ idnsParseNameservers(void) } } -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ static void idnsParseResolvConf(void) { @@ -1535,7 +1535,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 c690c415dc..72500b3b40 100644 --- a/src/fde.cc +++ b/src/fde.cc @@ -55,7 +55,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, @@ -79,7 +79,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", @@ -94,7 +94,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 680cea615b..91a7517ac6 100644 --- a/src/fde.h +++ b/src/fde.h @@ -136,7 +136,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; @@ -189,7 +189,7 @@ private: ssl = NULL; dynamicSslContext = NULL; #endif -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ win32.handle = NULL; #endif tosFromServer = '\0'; diff --git a/src/globals.h b/src/globals.h index cc640597ab..211dcf84ce 100644 --- a/src/globals.h +++ b/src/globals.h @@ -113,7 +113,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 3f603caf1e..602945aede 100644 --- a/src/helper.cc +++ b/src/helper.cc @@ -97,7 +97,7 @@ HelperServerBase::initStats() void HelperServerBase::closePipesSafely() { -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ int no = index + 1; shutdown(writePipe->fd, SD_BOTH); @@ -110,7 +110,7 @@ HelperServerBase::closePipesSafely() readPipe->close(); writePipe->close(); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ if (hIpc) { if (WaitForSingleObject(hIpc, 5000) != WAIT_OBJECT_0) { getCurrentTime(); @@ -126,7 +126,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)); @@ -137,7 +137,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 3490715e77..995a52d870 100644 --- a/src/icmp/pinger.cc +++ b/src/icmp/pinger.cc @@ -72,7 +72,7 @@ #include "IcmpPinger.h" #include "ip/tools.h" -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ #if HAVE_WINSOCK2_H #include @@ -106,7 +106,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 5fda815309..9c5d232ed9 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 @@ -619,7 +619,7 @@ rotate_logs(int sig) { do_rotate = 1; RotateSignal = sig; -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ #if !HAVE_SIGACTION signal(sig, rotate_logs); @@ -633,7 +633,7 @@ reconfigure(int sig) { do_reconfigure = 1; ReconfigureSignal = sig; -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ #if !HAVE_SIGACTION signal(sig, reconfigure); @@ -662,7 +662,7 @@ shut_down(int sig) " pid " << ppid << ": " << xstrerror()); } -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ #if KILL_PARENT_OPT if (!IamMasterProcess() && ppid > 1) { @@ -1020,7 +1020,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"); @@ -1577,7 +1577,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. @@ -1620,7 +1620,7 @@ mainStartScript(const char *prog) } } -#endif /* _SQUID_MSWIN_ */ +#endif /* _SQUID_WINDOWS_ */ static int checkRunningPid(void) @@ -1650,7 +1650,7 @@ checkRunningPid(void) static void watch_child(char *argv[]) { -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ char *prog; #if _SQUID_NEXT_ @@ -1819,7 +1819,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 fc542eb479..58782a8a7e 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 fcc6217e96..41422fc99d 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 72f2a77195..0606ee56ab 100644 --- a/src/store_dir.cc +++ b/src/store_dir.cc @@ -127,7 +127,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; @@ -136,7 +136,7 @@ StoreController::createOneStore(Store &aStore) aStore.create(); -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ exit(0); @@ -148,7 +148,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 591419795e..f235b9f89d 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -366,7 +366,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); @@ -454,7 +454,7 @@ debug_trap(const char *message) void sig_child(int sig) { -#if !_SQUID_MSWIN_ +#if !_SQUID_WINDOWS_ #if _SQUID_NEXT_ union wait status; #else @@ -994,7 +994,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 d560d677d1..a5d700f723 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) @@ -610,7 +610,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"); @@ -634,7 +634,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 @@ -646,7 +646,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); @@ -785,7 +785,7 @@ read_reply(int s, cachemgr_request * req) } fclose(fp); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ remove(tmpfile); xfree(tmpfile); @@ -902,7 +902,7 @@ main(int argc, char *argv[]) cachemgr_request *req; now = time(NULL); -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ Win32SockInit(); atexit(Win32SockCleanup); @@ -1027,7 +1027,7 @@ read_request(void) else return NULL; -#if _SQUID_MSWIN_ +#if _SQUID_WINDOWS_ if (strlen(buf) == 0 || strlen(buf) == 4000) #else