#if HAVE_NETDB_H
#include <netdb.h>
#endif
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
#undef IN_ADDR
#include <ws2tcpip.h>
#endif
#ifndef SQUID_OS_AIX_H
#define SQUID_OS_AIX_H
-#ifdef _SQUID_AIX_
+#if _SQUID_AIX_
/****************************************************************************
*--------------------------------------------------------------------------*
#ifndef SQUID_OS_DRAGONFLY_H
#define SQUID_OS_DRAGONFLY_H
-#ifdef _SQUID_DRAGONFLY_
+#if _SQUID_DRAGONFLY_
/****************************************************************************
*--------------------------------------------------------------------------*
#ifndef SQUID_OS_FREEBSD_H
#define SQUID_OS_FREEBSD_H
-#ifdef _SQUID_FREEBSD_
+#if _SQUID_FREEBSD_
/****************************************************************************
*--------------------------------------------------------------------------*
#ifndef SQUID_OS_HPUX_H
#define SQUID_OS_PHUX_H
-#ifdef _SQUID_HPUX_
+#if _SQUID_HPUX_
/****************************************************************************
*--------------------------------------------------------------------------*
#ifndef SQUID_OS_LINUX_H
#define SQUID_OS_LINUX_H
-#ifdef _SQUID_LINUX_
+#if _SQUID_LINUX_
/****************************************************************************
*--------------------------------------------------------------------------*
#ifndef SQUID_OS_MACOSX_H
#define SQUID_OS_MACOSX_H
-#ifdef _SQUID_APPLE_
+#if _SQUID_APPLE_
/****************************************************************************
*--------------------------------------------------------------------------*
#ifndef SQUID_OS_NETBSD_H
#define SQUID_OS_NETBSD_H
-#ifdef _SQUID_NETBSD_
+#if _SQUID_NETBSD_
/****************************************************************************
*--------------------------------------------------------------------------*
#ifndef SQUID_OS_NEXT_H
#define SQUID_OS_NEXT_H
-#ifdef _SQUID_NEXT_
+#if _SQUID_NEXT_
/****************************************************************************
*--------------------------------------------------------------------------*
#ifndef SQUID_OS_OPENBSD_H
#define SQUID_OS_OPENBSD_H
-#ifdef _SQUID_OPENBSD_
+#if _SQUID_OPENBSD_
/****************************************************************************
*--------------------------------------------------------------------------*
#ifndef SQUID_OS_OS2_H
#define SQUID_OS_OS2_H
-#ifdef _SQUID_OS2_
+#if _SQUID_OS2_
/****************************************************************************
*--------------------------------------------------------------------------*
#ifndef SQUID_OS_QNX_H
#define SQUID_OS_QNX_H
-#ifdef _SQUID_QNX_
+#if _SQUID_QNX_
/****************************************************************************
*--------------------------------------------------------------------------*
#ifndef SQUID_OS_SUNOS_H
#define SQUID_OS_SUNOS_H
-#ifdef _SQUID_SUNOS_
+#if _SQUID_SUNOS_
/****************************************************************************
*--------------------------------------------------------------------------*
* "%lx" instead of "%llx"
*/
#ifndef PRId64
-#ifdef _SQUID_MSWIN_ /* Windows native port using MSVCRT */
+#if _SQUID_MSWIN_ /* Windows native port using MSVCRT */
#define PRId64 "I64d"
#elif SIZEOF_INT64_T > SIZEOF_LONG
#define PRId64 "lld"
#endif
#ifndef PRIu64
-#ifdef _SQUID_MSWIN_ /* Windows native port using MSVCRT */
+#if _SQUID_MSWIN_ /* Windows native port using MSVCRT */
#define PRIu64 "I64u"
#elif SIZEOF_INT64_T > SIZEOF_LONG
#define PRIu64 "llu"
#endif
#ifndef PRIX64
-#ifdef _SQUID_MSWIN_ /* Windows native port using MSVCRT */
+#if _SQUID_MSWIN_ /* Windows native port using MSVCRT */
#define PRIX64 "I64X"
#elif SIZEOF_INT64_T > SIZEOF_LONG
#define PRIX64 "llX"
#include <string.h>
#include <ctype.h>
-#ifdef _SQUID_MSWIN_ /* Native Windows port and MinGW */
+#if _SQUID_MSWIN_ /* Native Windows port and MinGW */
#define snprintf _snprintf
#include <windows.h>
/* 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
*/
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
if (use_tls) {
HMODULE WLDAP32Handle;
char progname[] = "basic_radius_auth";
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
void
Win32SockCleanup(void)
{
WSACleanup();
return;
}
-#endif /* ifdef _SQUID_MSWIN_ */
+#endif
/*
* Diff two timeval, b - a
fprintf(stderr, "FATAL: %s: Shared secret not specified\n", argv[0]);
exit(1);
}
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
{
WSADATA wsaData;
WSAStartup(2, &wsaData);
debug(char *format,...)
{
#ifdef DEBUG
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
if (debug_enabled) {
va_list args;
#include "ldap_backend.h"
-#ifdef _SQUID_MSWIN_ /* Native Windows port and MinGW */
+#if _SQUID_MSWIN_ /* Native Windows port and MinGW */
#define snprintf _snprintf
#include <windows.h>
/* 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
*/
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
if (use_tls) {
HMODULE WLDAP32Handle;
#include "digest_common.h"
-#ifdef _SQUID_MSWIN_ /* Native Windows port and MinGW */
+#if _SQUID_MSWIN_ /* Native Windows port and MinGW */
#define snprintf _snprintf
#include <windows.h>
#include "ldap_backend.h"
-#ifdef _SQUID_MSWIN_ /* Native Windows port and MinGW */
+#if _SQUID_MSWIN_ /* Native Windows port and MinGW */
#define snprintf _snprintf
#include <windows.h>
/* 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
*/
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
if (use_tls) {
HMODULE WLDAP32Handle;
#include <ctype.h>
#endif
-#ifdef _SQUID_MSWIN_ /* Native Windows port and MinGW */
+#if _SQUID_MSWIN_ /* Native Windows port and MinGW */
#define snprintf _snprintf
#include <windows.h>
/* 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
*/
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
if (use_tls) {
HMODULE WLDAP32Handle;
/* Windows Port */
/* win32lib.c */
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
SQUIDCEXTERN int chroot (const char *);
SQUIDCEXTERN int ftruncate(int, off_t);
#if !HAVE_GETTIMEOFDAY
;;
esac
+ #
+ # Scan for incorrect use of #ifdef/#ifndef
+ #
+ grep -R -E "ifn?def .*_SQUID_" ./* | grep -v -E "_H$" | while read f; do echo "PROBLEM?: ${f}"; done
+
#
# DEBUG Section list maintenance
#
typedef int64_t off64_t;
#endif
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
union sigval {
int sival_int; /* integer value */
#include "squid.h"
#include "squid_windows.h"
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
#ifndef _MSWSOCK_
#include <mswsock.h>
#endif
WIN32_Exit();
}
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
void
WIN32_IpAddrChangeMonitorExit()
{
void
WIN32_Exit()
{
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
Win32SockCleanup();
#endif
#if USE_WIN32_SERVICE
}
#endif
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
if (dbg_mutex)
DeleteCriticalSection(dbg_mutex);
_exit(0);
}
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
static DWORD WINAPI
WIN32_IpAddrChangeMonitor(LPVOID lpParam)
{
svcStatus.dwCheckPoint = 0;
svcStatus.dwWaitHint = 10000;
SetServiceStatus(svcHandle, &svcStatus);
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
_setmaxstdio(Squid_MaxFD);
#endif
}
#endif /* USE_WIN32_SERVICE */
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
if (Win32SockInit() < 0)
return 1;
}
} else {
WIN32_run_mode = _WIN_SQUID_RUN_MODE_INTERACTIVE;
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
opt_no_daemon = 1;
if (t < 2)
xstrncpy(request, "menu", MAX_URL);
-#ifdef _SQUID_OS2_
+#if _SQUID_OS2_
if (t == 2 && request[0] == '\0') {
/*
* emx's sscanf insists of returning 2 because it sets request
enum State state;
int rc = 0;
char *ptr = NULL;
-#ifdef _SQUID_OS2_
+#if _SQUID_OS2_
const char *rmode = "rt";
#else
static void
comm_empty_os_read_buffers(int fd)
{
-#ifdef _SQUID_LINUX_
+#if _SQUID_LINUX_
/* prevent those nasty RST packets */
char buf[SQUID_TCP_SO_RCVBUF];
commSetReuseAddr(new_socket);
if (addr.GetPort() > (u_short) 0) {
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
if (sock_type != SOCK_DGRAM)
#endif
commSetNoLinger(new_socket);
fd_table[conn->fd].flags.close_on_exec = 1;
if (conn->local.GetPort() > (u_short) 0) {
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
if (AI->ai_socktype != SOCK_DGRAM)
#endif
fd_table[conn->fd].flags.nolinger = 1;
* we leak memory on many connect requests because of EINPROGRESS.
* If you find that this code is needed, please file a bug report. */
#if 0
-#ifdef _SQUID_LINUX_
+#if _SQUID_LINUX_
/* 2007-11-27:
* Linux Debian replaces our allocated AI pointer with garbage when
* connect() fails. This leads to segmentation faults deallocating
if (x >= 0)
return x;
-#ifdef _SQUID_LINUX_
+#if _SQUID_LINUX_
if (ECONNREFUSED != errno)
#endif
int
commSetNonBlocking(int fd)
{
-#ifndef _SQUID_MSWIN_
+#if !_SQUID_MSWIN_
int flags;
int dummy = 0;
#endif
} else {
#endif
#endif
-#ifndef _SQUID_MSWIN_
+#if !_SQUID_MSWIN_
if ((flags = fcntl(fd, F_GETFL, dummy)) < 0) {
debugs(50, 0, "FD " << fd << ": fcntl F_GETFL: " << xstrerror());
int
commUnsetNonBlocking(int fd)
{
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
int nonblocking = FALSE;
if (ioctlsocket(fd, FIONBIO, (unsigned long *) &nonblocking) < 0) {
static void _db_print_stderr(const char *format, va_list args);
static void _db_print_file(const char *format, va_list args);
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
SQUIDCEXTERN LPCRITICAL_SECTION dbg_mutex;
typedef BOOL (WINAPI * PFInitializeCriticalSectionAndSpinCount) (LPCRITICAL_SECTION, DWORD);
#endif
va_list args2;
va_list args3;
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
/* Multiple WIN32 threads may call this simultaneously */
if (!dbg_mutex) {
_db_print_syslog(format, args3);
#endif
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
LeaveCriticalSection(dbg_mutex);
#endif
i--;
snprintf(from, MAXPATHLEN, "%s.%d", debug_log_file, i - 1);
snprintf(to, MAXPATHLEN, "%s.%d", debug_log_file, i);
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
remove
(to);
#endif
* You can't rename open files on Microsoft "operating systems"
* so we close before renaming.
*/
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
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);
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
remove
(to);
#endif
/*
* Max number of ICP messages to receive per call to icpHandleUdp
*/
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
#define INCOMING_ICP_MAX 1
#else
#define INCOMING_ICP_MAX 15
/*
* Max number of DNS messages to receive per call to DNS read handler
*/
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
#define INCOMING_DNS_MAX 1
#else
#define INCOMING_DNS_MAX 15
* Max number of HTTP connections to accept per call to httpAccept
* and PER HTTP PORT
*/
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
#define INCOMING_HTTP_MAX 1
#else
#define INCOMING_HTTP_MAX 10
static void idnsFreeNameservers(void);
static void idnsFreeSearchpath(void);
static void idnsParseNameservers(void);
-#ifndef _SQUID_MSWIN_
+#if !_SQUID_MSWIN_
static void idnsParseResolvConf(void);
#endif
#if _SQUID_WINDOWS_
}
}
-#ifndef _SQUID_MSWIN_
+#if !_SQUID_MSWIN_
static void
idnsParseResolvConf(void)
{
if (ignoreErrno(errno))
break;
-#ifdef _SQUID_LINUX_
+#if _SQUID_LINUX_
/* Some Linux systems seem to set the FD for reading and then
* return ECONNREFUSED when sendto() fails and generates an ICMP
* port unreachable message. */
assert(0 == nns);
idnsParseNameservers();
-#ifndef _SQUID_MSWIN_
+#if !_SQUID_MSWIN_
if (0 == nns)
idnsParseResolvConf();
}
}
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
{
WSADATA wsaData;
memset(request, '\0', REQ_SZ);
if (fgets(request, REQ_SZ, stdin) == NULL) {
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
WSACleanup();
#endif
exit(1);
int default_read_method(int, char *, int);
int default_write_method(int, const char *, int);
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
int socket_read_method(int, char *, int);
int socket_write_method(int, const char *, int);
int file_read_method(int, char *, int);
*F = fde();
}
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
int
socket_read_method(int fd, char *buf, int len)
F->type = type;
F->flags.open = 1;
F->epoll_state = 0;
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
F->win32.handle = _get_osfhandle(fd);
if (!flags.open)
return;
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
storeAppendPrintf(&dumpEntry, "%4d 0x%-8lX %-6.6s %4d %7"PRId64"%c %7"PRId64"%c %-21s %s\n",
fdNumber,
{
int i;
storeAppendPrintf(dumpEntry, "Active file descriptors:\n");
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
storeAppendPrintf(dumpEntry, "%-4s %-10s %-6s %-4s %-7s* %-7s* %-21s %s\n",
"File",
"Nwrite",
"Remote Address",
"Description");
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
storeAppendPrintf(dumpEntry, "---- ---------- ------ ---- -------- -------- --------------------- ------------------------------\n");
#else
storeAppendPrintf(dumpEntry, "---- ------ ---- -------- -------- --------------------- ------------------------------\n");
SSL *ssl;
SSL_CTX *dynamicSslContext; ///< cached and then freed when fd is closed
#endif
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
struct {
long handle;
} win32;
ssl = NULL;
dynamicSslContext = NULL;
#endif
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
win32.handle = NULL;
#endif
tosFromServer = '\0';
if (::stat(path, &swap_sb) < 0) {
debugs (47, 2, "COSS swap space space being allocated.");
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
mkdir(path);
#else
fatalf("Swap directory %s is not a directory.", aPath);
}
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
} else if (0 == mkdir(aPath)) {
#else
if (dir_pointer == NULL) {
if (errno == ENOENT) {
debugs(36, 0, "storeDirClean: WARNING: Creating " << p1);
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
if (mkdir(p1) == 0)
#else
extern int64_t store_maxobjsize; /* -1 */
extern hash_table *proxy_auth_username_cache; /* NULL */
extern int incoming_sockets_accepted;
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
extern unsigned int WIN32_Socks_initialized; /* 0 */
#endif
void
HelperServerBase::closePipesSafely()
{
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
int no = index + 1;
shutdown(writePipe->fd, SD_BOTH);
readPipe->close();
writePipe->close();
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
if (hIpc) {
if (WaitForSingleObject(hIpc, 5000) != WAIT_OBJECT_0) {
getCurrentTime();
void
HelperServerBase::closeWritePipeSafely()
{
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
int no = index + 1;
shutdown(writePipe->fd, (readPipe->fd == writePipe->fd ? SD_BOTH : SD_SEND));
readPipe->fd = -1;
writePipe->close();
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
if (hIpc) {
if (WaitForSingleObject(hIpc, 5000) != WAIT_OBJECT_0) {
getCurrentTime();
#endif
/* Linux uses its own field names. */
-#if defined (_SQUID_LINUX_)
+#if _SQUID_LINUX_
#ifdef icmp_id
#undef icmp_id
#endif
#if _SQUID_WINDOWS_
#include "fde.h"
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
#if HAVE_WINSOCK2_H
#include <winsock2.h>
Close();
}
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
void
Win32SockCleanup(void)
{
int
IcmpPinger::Open(void)
{
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
WSADATA wsaData;
WSAPROTOCOL_INFO wpi;
void
IcmpPinger::Close(void)
{
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
shutdown(icmp_sock, SD_BOTH);
close(icmp_sock);
if (localhost.SetIPv4())
SendEcho(localhost, S_ICMP_ECHO, "localhost");
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
debugs(37, 4, HERE << "Pinger handle: 0x" << std::hex << hIpc << std::dec << ", PID: " << pid);
debugs(37, 1, HERE << "Closing Pinger socket on FD " << icmp_sock);
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
send(icmp_sock, (const void *) "$shutdown\n", 10, 0);
comm_close(icmp_sock);
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
if (hIpc) {
if (WaitForSingleObject(hIpc, 12000) != WAIT_OBJECT_0) {
#include "Icmp6.h"
#include "IcmpPinger.h"
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
#if HAVE_WINSOCK2_H
#include <winsock2.h>
if (ignoreErrno(errno))
break;
-#ifdef _SQUID_LINUX_
+#if _SQUID_LINUX_
/* Some Linux systems seem to set the FD for reading and then
* return ECONNREFUSED when sendto() fails and generates an ICMP
* port unreachable message. */
#if HAVE_NETINET_IP_H
#include <netinet/ip.h>
#endif
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
#include <ws2tcpip.h>
#endif
#if HAVE_NETDB_H
class Kid
{
public:
-#ifdef _SQUID_NEXT_
+#if _SQUID_NEXT_
typedef union wait status_type;
#else
typedef int status_type;
#endif
-#ifndef SQUID_BUILD_INFO
+#if !defined(SQUID_BUILD_INFO)
#define SQUID_BUILD_INFO ""
#endif
static void mainSetCwd(void);
static int checkRunningPid(void);
-#ifndef _SQUID_MSWIN_
+#if !_SQUID_MSWIN_
static const char *squid_start_script = "squid_start";
#endif
{
do_rotate = 1;
RotateSignal = sig;
-#ifndef _SQUID_MSWIN_
+#if !_SQUID_MSWIN_
#if !HAVE_SIGACTION
signal(sig, rotate_logs);
{
do_reconfigure = 1;
ReconfigureSignal = sig;
-#ifndef _SQUID_MSWIN_
+#if !_SQUID_MSWIN_
#if !HAVE_SIGACTION
signal(sig, reconfigure);
" pid " << ppid << ": " << xstrerror());
}
-#ifndef _SQUID_MSWIN_
+#if !_SQUID_MSWIN_
#if KILL_PARENT_OPT
if (!IamMasterProcess() && ppid > 1) {
{
keepCapabilities();
leave_suid(); /* Run as non privilegied user */
-#ifdef _SQUID_OS2_
+#if _SQUID_OS2_
return;
#endif
setSystemLimits();
debugs(1, 1, "With " << Squid_MaxFD << " file descriptors available");
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
debugs(1, 1, "With " << _getmaxstdio() << " CRT stdio descriptors available");
WIN32_sendSignal(opt_send_signal);
exit(0);
} else
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
{
fprintf(stderr, "%s: ERROR: Could not send ", APP_SHORTNAME);
fprintf(stderr, "signal to Squid Service:\n");
exit(0);
}
-#ifndef _SQUID_MSWIN_
+#if !_SQUID_MSWIN_
/*
* This function is run when Squid is in daemon mode, just
* before the parent forks and starts up the child process.
_exit(-1);
} else {
do {
-#ifdef _SQUID_NEXT_
+#if _SQUID_NEXT_
union wait status;
rpid = wait4(cpid, &status, 0, NULL);
#else
static void
watch_child(char *argv[])
{
-#ifndef _SQUID_MSWIN_
+#if !_SQUID_MSWIN_
char *prog;
-#ifdef _SQUID_NEXT_
+#if _SQUID_NEXT_
union wait status;
#else
squid_signal(SIGINT, SIG_IGN, SA_RESTART);
-#ifdef _SQUID_NEXT_
+#if _SQUID_NEXT_
pid = wait3(&status, 0, NULL);
} else {
syslog(LOG_NOTICE, "Squid Parent: unknown child process %d exited", pid);
}
-#ifdef _SQUID_NEXT_
+#if _SQUID_NEXT_
} while ((pid = wait3(&status, WNOHANG, NULL)) > 0);
#else
}
* prototypes for system functions missing from system includes
*/
-#ifdef _SQUID_SOLARIS_
+#if _SQUID_SOLARIS_
SQUIDCEXTERN int getrusage(int, struct rusage *);
SQUIDCEXTERN int getpagesize(void);
SQUIDCEXTERN void WIN32_RemoveService(void);
SQUIDCEXTERN int SquidMain(int, char **);
#endif /* _SQUID_WINDOWS_ */
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
SQUIDCEXTERN int WIN32_pipe(int[2]);
#include "config.h"
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
/** \cond AUTODOCS-IGNORE */
using namespace Squid;
/** \endcond */
Ssl::FileLocker::~FileLocker()
{
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
if (hFile != INVALID_HANDLE_VALUE) {
UnlockFile(hFile, 0, 0, 1, 0);
CloseHandle(hFile);
std::string cert_full(db_path + "/" + cert_dir);
std::string size_full(db_path + "/" + size_file);
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
if (mkdir(db_path.c_str()))
#else
if (mkdir(db_path.c_str(), 0777))
#endif
throw std::runtime_error("Cannot create " + db_path);
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
if (mkdir(cert_full.c_str()))
#else
if (mkdir(cert_full.c_str(), 0777))
/// Unlock file
~FileLocker();
private:
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
HANDLE hFile; ///< Windows file handle.
#else
int fd; ///< Linux file descriptor.
bool setClientSNI(SSL *ssl, const char *fqdn);
} //namespace Ssl
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
-#ifdef __cplusplus
+#if defined(__cplusplus)
/** \cond AUTODOCS-IGNORE */
namespace Squid
* The following is a workaround for create store directories sequentially
* when running on native Windows port.
*/
-#ifndef _SQUID_MSWIN_
+#if !_SQUID_MSWIN_
if (fork())
return;
aStore.create();
-#ifndef _SQUID_MSWIN_
+#if !_SQUID_MSWIN_
exit(0);
{
swapDir->create();
-#ifndef _SQUID_MSWIN_
+#if !_SQUID_MSWIN_
pid_t pid;
do {
int status;
-#ifdef _SQUID_NEXT_
+#if _SQUID_NEXT_
pid = wait3(&status, WNOHANG, NULL);
#else
static void restoreCapabilities(int keep);
int DebugSignal = -1;
-#ifdef _SQUID_LINUX_
+#if _SQUID_LINUX_
/* Workaround for crappy glic header files */
SQUIDCEXTERN int backtrace(void *, int);
SQUIDCEXTERN void backtrace_symbols_fd(void *, int, int);
fprintf(debug_log, "FATAL: Received signal %d...dying.\n", sig);
#if PRINT_STACK_TRACE
-#ifdef _SQUID_HPUX_
+#if _SQUID_HPUX_
{
extern void U_STACK_TRACE(void); /* link with -lcl */
fflush(debug_log);
void
sig_child(int sig)
{
-#ifndef _SQUID_MSWIN_
-#ifdef _SQUID_NEXT_
+#if !_SQUID_MSWIN_
+#if _SQUID_NEXT_
union wait status;
#else
pid_t pid;
do {
-#ifdef _SQUID_NEXT_
+#if _SQUID_NEXT_
pid = wait3(&status, WNOHANG, NULL);
#else
debugs(50, 0, "sigaction: sig=" << sig << " func=" << func << ": " << xstrerror());
#else
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
/*
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.
void
unlinkdClose(void)
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
{
if (unlinkd_wfd > -1) {
debugs(2, 1, "Unlinkd pipe opened on FD " << unlinkd_wfd);
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
debugs(2, 4, "Unlinkd handle: 0x" << std::hex << hIpc << std::dec << ", PID: " << pid);
#include "squid.h"
#include "squid_windows.h"
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
#if HAVE_WIN32_PSAPI
#include <psapi.h>
#endif
static int check_target_acl(const char *hostname, int port);
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
static int s_iInitCount = 0;
int Win32SockInit(void)
return;
}
-#endif /* ifdef _SQUID_MSWIN_ */
+#endif
static const char *
safe_str(const char *str)
read_reply(int s, cachemgr_request * req)
{
char buf[4 * 1024];
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
int reply;
char *tmpfile = tempnam(NULL, "tmp0000");
parse_menu = 1;
if (fp == NULL) {
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
perror(tmpfile);
xfree(tmpfile);
#else
return 1;
}
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
while ((reply=recv(s, buf , sizeof(buf), 0)) > 0)
fwrite(buf, 1, reply, fp);
}
fclose(fp);
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
remove(tmpfile);
xfree(tmpfile);
cachemgr_request *req;
now = time(NULL);
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
Win32SockInit();
atexit(Win32SockCleanup);
else
return NULL;
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
if (strlen(buf) == 0 || strlen(buf) == 4000)
#else
#include "rfc1123.h"
#include "SquidTime.h"
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
/** \cond AUTODOCS-IGNORE */
using namespace Squid;
/** \endcond */
int total_bytes = 0;
int io_timeout = 120;
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
void
Win32SockCleanup(void)
{
WSACleanup();
return;
}
-#endif /* ifdef _SQUID_MSWIN_ */
+#endif
static void
usage(const char *progname)
break;
}
}
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
{
WSADATA wsaData;
WSAStartup(2, &wsaData);
if (put_file) {
int x;
lseek(put_fd, 0, SEEK_SET);
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
while ((x = read(put_fd, buf, sizeof(buf))) > 0) {
#else
}
/* Read the data */
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
setmode(1, O_BINARY);
#endif
perror("client: ERROR writing to stdout");
}
-#ifdef _SQUID_MSWIN_
+#if _SQUID_MSWIN_
setmode(1, O_TEXT);
#endif
static ssize_t
myread(int fd, void *buf, size_t len)
{
-#ifndef _SQUID_MSWIN_
+#if !_SQUID_MSWIN_
alarm(io_timeout);
return read(fd, buf, len);
#else
static ssize_t
mywrite(int fd, void *buf, size_t len)
{
-#ifndef _SQUID_MSWIN_
+#if !_SQUID_MSWIN_
alarm(io_timeout);
return write(fd, buf, len);
#else