#ifndef SQUID_OS_MSWIN_H
#define SQUID_OS_MSWIN_H
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
#define ACL WindowsACL
#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
#define PRINTF_FORMAT_ARG3
#endif
-#endif /* _SQUID_WIN32_ */
+#endif /* _SQUID_WINDOWS_ */
#endif /* SQUID_OS_MSWIN_H */
#ifndef SQUID_OS_WINDOWS_H
#define SQUID_OS_WINDOWS_H
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
#ifndef ACL
#define ACL WindowsACL
#undef _MSWIN_ACL_WAS_NOT_DEFINED
#endif
-#endif /* _SQUID_WIN32_ */
+#endif /* _SQUID_WINDOWS_ */
#endif /* SQUID_OS_WINDOWS_H */
#elif defined(__CYGWIN32__) || defined(__CYGWIN__)
#define _SQUID_CYGWIN_ 1
-#define _SQUID_WIN32_ 1
+#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_WIN32_ 1
+#define _SQUID_WINDOWS_ 1
#elif defined(__APPLE__)
#define _SQUID_APPLE_ 1
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
#include <io.h>
#endif
#if HAVE_CTYPE_H
#endif
/* Check if we try to compile on a Windows Platform */
-#if defined(_SQUID_CYGWIN_) || defined(_SQUID_MSWIN_)
+#if !_SQUID_WINDOWS_
+/* NON Windows Platform !!! */
+#error NON WINDOWS PLATFORM
+#endif
#include "valid.h"
}
return 0;
}
-
-#else /* NON Windows Platform !!! */
-
-#error NON WINDOWS PLATFORM
-
-#endif
#include "util.h"
/* Check if we try to compile on a Windows Platform */
-#if defined(_SQUID_CYGWIN_) || defined(_SQUID_MSWIN_)
+#if !_SQUID_WINDOWS_
+/* NON Windows Platform !!! */
+#error NON WINDOWS PLATFORM
+#endif
-#if defined(_SQUID_CYGWIN_)
+#if _SQUID_CYGWIN_
#include <wchar.h>
#endif
#include "valid.h"
}
return result;
}
-#else /* NON Windows Platform !!! */
-
-#error NON WINDOWS PLATFORM
-
-#endif
#ifndef _VALID_H_
#define _VALID_H_
-#ifdef _SQUID_CYGWIN_
+#if _SQUID_CYGWIN_
#include <windows.h>
#endif
#include <lm.h>
#include "helpers/defines.h"
#include "include/util.h"
-#ifdef _SQUID_CYGWIN_
+#if _SQUID_CYGWIN_
#include <wchar.h>
int _wcsicmp(const wchar_t *, const wchar_t *);
#endif
#include "include/util.h"
-#ifdef _SQUID_CYGWIN_
+#if _SQUID_CYGWIN_
#include <wchar.h>
int _wcsicmp(const wchar_t *, const wchar_t *);
#endif
i--;
snprintf(from, MAXPATHLEN, "%s.%d", path, i - 1);
snprintf(to, MAXPATHLEN, "%s.%d", path, i);
-#if defined(_SQUID_OS2_) || defined(_SQUID_WIN32_)
+#if _SQUID_OS2_ || _SQUID_WINDOWS_
remove(to);
#endif
rename(from, to);
}
if (rotate_count > 0) {
snprintf(to, MAXPATHLEN, "%s.%d", path, 0);
-#if defined(_SQUID_OS2_) || defined(_SQUID_WIN32_)
+#if _SQUID_OS2_ || _SQUID_WINDOWS_
remove(to);
#endif
rename(path, to);
#ifndef _INC_SQUID_WINDOWS_H
#define _INC_SQUID_WINDOWS_H
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
#ifndef ACL
#define ACL WindowsACL
#undef _MSWIN_ACL_WAS_NOT_DEFINED
#endif
-#endif /* _SQUID_WIN32_ */
-
+#endif /* _SQUID_WINDOWS_ */
#endif /* _INC_SQUID_WINDOWS_H */
#ifndef _LIBSSPWIN32_H_
#define _LIBSSPWIN32_H_
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
#define SECURITY_WIN32
#define NTLM_PACKAGE_NAME "NTLM"
#define NEGOTIATE_PACKAGE_NAME "Negotiate"
-#ifdef _SQUID_CYGWIN_
+#if _SQUID_CYGWIN_
#include <wchar.h>
#define _T(x) TEXT(x)
#else
extern BOOL Use_Unicode;
extern BOOL NTLM_LocalCall;
-#endif /* _SQUID_WIN32_ */
-
+#endif /* _SQUID_WINDOWS_ */
#endif /* LIBSSPWIN32_H_ */
t = mktime(tm);
if (t != -1) {
time_t dst = 0;
-#if defined (_TIMEZONE)
-#elif defined (_timezone)
-#elif defined(_SQUID_AIX_)
-#elif defined(_SQUID_CYGWIN_)
-#elif defined(_SQUID_MSWIN_)
-#elif defined(_SQUID_SGI_)
-#else
+#if !(defined(_TIMEZONE) || defined(_timezone) || _SQUID_AIX_ || _SQUID_WINDOWS_ || _SQUID_SGI_)
extern long timezone;
#endif
/*
*/
if (tm->tm_isdst > 0)
dst = -3600;
-#if defined ( _timezone) || defined(_SQUID_WIN32_)
+#if defined(_timezone) || _SQUID_WINDOWS_
t -= (_timezone + dst);
#else
t -= (timezone + dst);
return (NULL);
}
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
setmode(fileno(wordFile), O_TEXT);
-
#endif
fromFile = 1;
AIODiskFile::open(int flags, mode_t mode, RefCount<IORequestor> callback)
{
/* Simulate async calls */
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
fd = aio_open(path.termedBuf(), flags);
#else
fd = file_open(path.termedBuf() , flags);
AIODiskFile::close ()
{
assert (!closed);
-#ifdef _SQUID_WIN32_
-
+#if _SQUID_WINDOWS_
aio_close(fd);
#else
-
file_close(fd);
#endif
#include "comm.h"
#include "aio_win32.h"
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
VOID CALLBACK IoCompletionRoutine(DWORD dwErrorCode,
DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped)
{
{
return aiocbp->aio_sigevent.sigev_signo;
}
-#endif /* _SQUID_WIN32_ */
+#endif /* _SQUID_WINDOWS_ */
#if USE_DISKIO_AIO
-#ifdef _SQUID_CYGWIN_
+#if _SQUID_CYGWIN_
#include "squid_windows.h"
#endif
#if USE_DISKIO_AIO
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
#include "aio_win32.h"
#else
#if HAVE_AIO_H
*/
#include "config.h"
-#ifdef _SQUID_CYGWIN_
+#if _SQUID_CYGWIN_
#include <squid_windows.h>
#endif
#include "squid.h"
if (fp == NULL)
fatalf("Unable to open configuration file: %s: %s", file_name, xstrerror());
-#ifdef _SQUID_WIN32_
-
+#if _SQUID_WINDOWS_
setmode(fileno(fp), O_TEXT);
-
#endif
SetConfigFilename(file_name, bool(is_pipe));
return 0;
}
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
setmode(fileno(file), O_BINARY);
-
#endif
scanned_count = cacheIndexScan(idx, fname, file);
exit(1);
}
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
setmode(fileno(fp), O_TEXT);
#endif
exit(1);
}
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
setmode(fileno(fp), O_TEXT);
-
#endif
fprintf(fp,
exit(1);
}
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
setmode(fileno(fp), O_TEXT);
-
#endif
gen_conf(entries, fp, 1);
perror(conf_filename_short);
exit(1);
}
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
setmode(fileno(fp), O_TEXT);
#endif
gen_conf(entries, fp, 0);
#endif
#include "cbdata.h"
-#if defined(_SQUID_CYGWIN_)
+#if _SQUID_CYGWIN_
#include <sys/ioctl.h>
#endif
#ifdef HAVE_NETINET_TCP_H
int flags;
int dummy = 0;
#endif
-#ifdef _SQUID_WIN32_
-
+#if _SQUID_WINDOWS_
int nonblocking = TRUE;
-#ifdef _SQUID_CYGWIN_
-
+#if _SQUID_CYGWIN_
if (fd_table[fd].type != FD_PIPE) {
#endif
return COMM_ERROR;
}
-#ifdef _SQUID_CYGWIN_
-
+#if _SQUID_CYGWIN_
} else {
#endif
#endif
}
#endif
-#ifdef _SQUID_CYGWIN_
-
+#if _SQUID_CYGWIN_
}
-
#endif
fd_table[fd].flags.nonblocking = 1;
debug_log = stderr;
}
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
setmode(fileno(debug_log), O_TEXT);
-
#endif
}
#define HTTP_REQBUF_SZ 4096
/* CygWin & Windows NT Port */
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
#define _WIN_SQUID_SERVICE_CONTROL_STOP SERVICE_CONTROL_STOP
#define _WIN_SQUID_SERVICE_CONTROL_SHUTDOWN SERVICE_CONTROL_SHUTDOWN
#define _WIN_SQUID_SERVICE_CONTROL_INTERROGATE SERVICE_CONTROL_INTERROGATE
static PF diskHandleRead;
static PF diskHandleWrite;
-#if defined(_SQUID_WIN32_) || defined(_SQUID_OS2_)
+#if _SQUID_WINDOWS_ || _SQUID_OS2_
static int
diskWriteIsComplete(int fd)
{
}
if (F->flags.write_daemon) {
-#if defined(_SQUID_WIN32_) || defined(_SQUID_OS2_)
+#if _SQUID_WINDOWS_ || _SQUID_OS2_
/*
* on some operating systems, you can not delete or rename
* open files, so we won't allow delayed close.
*/
-
while (!diskWriteIsComplete(fd))
diskHandleWrite(fd, NULL);
-
#else
-
F->flags.close_request = 1;
-
debugs(6, 2, "file_close: FD " << fd << ", delaying close");
-
PROF_stop(file_close);
-
return;
-
#endif
}
xrename(const char *from, const char *to)
{
debugs(21, 2, "xrename: renaming " << from << " to " << to);
-#if defined (_SQUID_OS2_) || defined (_SQUID_WIN32_)
+#if _SQUID_OS2_ || _SQUID_WINDOWS_
remove(to);
#endif
using external DNS process.
*/
#if !USE_DNSSERVERS
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
#include "squid_windows.h"
#define REG_TCPIP_PARA_INTERFACES "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces"
#define REG_TCPIP_PARA "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
#ifndef _SQUID_MSWIN_
static void idnsParseResolvConf(void);
#endif
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
static void idnsParseWIN32Registry(void);
static void idnsParseWIN32SearchList(const char *);
#endif
return;
}
-#if defined(_SQUID_CYGWIN_)
+#if _SQUID_CYGWIN_
setmode(fileno(fp), O_TEXT);
-
#endif
while (fgets(buf, RESOLV_BUFSZ, fp)) {
#endif
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
static void
idnsParseWIN32SearchList(const char * Separator)
{
idnsParseResolvConf();
#endif
-#ifdef _SQUID_WIN32_
-
+#if _SQUID_WINDOWS_
if (0 == nns)
idnsParseWIN32Registry();
-
#endif
if (0 == nns) {
debugs(78, 1, "Warning: Could not find any nameservers. Trying to use localhost");
-#ifdef _SQUID_WIN32_
-
+#if _SQUID_WINDOWS_
debugs(78, 1, "Please check your TCP-IP settings or /etc/resolv.conf file");
#else
-
debugs(78, 1, "Please check your /etc/resolv.conf file");
#endif
/* CygWin & Windows NT Port */
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
/*
* Supported Windows OS types codes
*/
and can be wrapped
*/
-#if _SQUID_WIN32_
-
+#if _SQUID_WINDOWS_
struct arpreq {
Ip::Address arp_pa; /* protocol address */
Eui::Eui48::lookup(Ip::Address &c)
{
struct arpreq arpReq;
-#if !_SQUID_WIN32_
+#if !_SQUID_WINDOWS_
struct sockaddr_in *sa = NULL;
-#endif /* !_SQUID_WIN32_ */
+#endif /* !_SQUID_WINDOWS_ */
Ip::Address ipAddr = c;
ipAddr.SetPort(0);
set(arpReq.arp_ha.sa_data, 6);
return true;
-#elif _SQUID_WIN32_
+#elif _SQUID_WINDOWS_
DWORD dwNetTable = 0;
/* rename */
if (state->fd >= 0) {
-#if defined(_SQUID_OS2_) || defined(_SQUID_WIN32_)
+#if _SQUID_OS2_ || _SQUID_WINDOWS_
file_close(state->fd);
state->fd = -1;
-
#endif
xrename(state->newLog, state->cur);
/* rename */
if (state->fd >= 0) {
-#if defined(_SQUID_OS2_) || defined (_SQUID_WIN32_)
+#if _SQUID_OS2_ || _SQUID_WINDOWS_
file_close(state->fd);
state->fd = -1;
-
#endif
xrename(state->newLog, state->cur);
extern unsigned int WIN32_Socks_initialized; /* 0 */
#endif
-#ifdef _SQUID_WIN32_
-
+#if _SQUID_WINDOWS_
extern unsigned int WIN32_OS_version; /* 0 */
extern char *WIN32_OS_string; /* NULL */
extern char *WIN32_Service_name; /* NULL */
#include <netinet/ip_icmp.h>
#endif
-#ifndef _SQUID_LINUX_
-#ifndef _SQUID_CYGWIN_
-#ifndef _SQUID_MSWIN_
+#if !_SQUID_LINUX_ && !_SQUID_WINDOWS_
#define icmphdr icmp
#define iphdr ip
#endif
-#endif
-#endif
/* Linux uses its own field names. */
#if defined (_SQUID_LINUX_)
to use the native Windows port definitions.
*/
-#ifdef _SQUID_WIN32_
-
+#if _SQUID_WINDOWS_
#include "fde.h"
#ifdef _SQUID_MSWIN_
debugs(1, 0, "Starting Squid Cache version " << version_string << " for " << CONFIG_HOST_TYPE << "...");
-#ifdef _SQUID_WIN32_
-
+#if _SQUID_WINDOWS_
if (WIN32_run_mode == _WIN_SQUID_RUN_MODE_SERVICE) {
debugs(1, 0, "Running as " << WIN32_Service_name << " Windows System Service on " << WIN32_OS_string);
debugs(1, 0, "Service command line is: " << WIN32_Service_Command_Line);
} else
debugs(1, 0, "Running on " << WIN32_OS_string);
-
#endif
debugs(1, 1, "Process ID " << getpid());
{
ConfigureCurrentKid(argv[0]);
-#ifdef _SQUID_WIN32_
-
+#if _SQUID_WINDOWS_
int WIN32_init_err;
#endif
#endif
-#ifdef _SQUID_WIN32_
-
+#if _SQUID_WINDOWS_
if ((WIN32_init_err = WIN32_Subsystem_Init(&argc, &argv)))
return WIN32_init_err;
-
#endif
/* call mallopt() before anything else */
return;
}
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
setmode(fileno(fp), O_TEXT);
-
#endif
mimeFreeMemory();
/* CygWin & Windows NT Port */
/* win32.c */
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
SQUIDCEXTERN int WIN32_Subsystem_Init(int *, char ***);
SQUIDCEXTERN void WIN32_sendSignal(int);
SQUIDCEXTERN void WIN32_Abort(int);
SQUIDCEXTERN void WIN32_InstallService(void);
SQUIDCEXTERN void WIN32_RemoveService(void);
SQUIDCEXTERN int SquidMain(int, char **);
-#endif /* _SQUID_WIN32_ */
+#endif /* _SQUID_WINDOWS_ */
#ifdef _SQUID_MSWIN_
SQUIDCEXTERN int WIN32_pipe(int[2]);
#if HAVE_LIMITS_H
#include <limits.h>
#endif
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
#include <io.h>
#endif
#if HAVE_SYS_MOUNT_H
storeAppendPrintf(sentry, "Squid Object Cache: Version %s\n",
version_string);
-#if _SQUID_WIN32_
-
+#if _SQUID_WINDOWS_
if (WIN32_run_mode == _WIN_SQUID_RUN_MODE_SERVICE) {
storeAppendPrintf(sentry,"\nRunning as %s Windows System Service on %s\n",
WIN32_Service_name, WIN32_OS_string);
storeAppendPrintf(sentry,"Service command line is: %s\n", WIN32_Service_Command_Line);
} else
storeAppendPrintf(sentry,"Running on %s\n",WIN32_OS_string);
-
#endif
storeAppendPrintf(sentry, "Start Time:\t%s\n",
void
setSystemLimits(void)
{
-#if HAVE_SETRLIMIT && defined(RLIMIT_NOFILE) && !defined(_SQUID_CYGWIN_)
+#if HAVE_SETRLIMIT && defined(RLIMIT_NOFILE) && !_SQUID_CYGWIN_
/* limit system filedescriptors to our own limit */
struct rlimit rl;
if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
return;
}
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
setmode(fileno(fp), O_TEXT);
-
#endif
while (fgets(buf, 1024, fp)) { /* for each line */
/** \endcond */
#endif
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
#include <io.h>
#endif
#if HAVE_STDIO_H
xstrerror());
exit(-1);
}
-#ifdef _SQUID_WIN32_
+#if _SQUID_WINDOWS_
setmode(put_fd, O_BINARY);
-
#endif
fstat(put_fd, &sb);