--------------------- PatchSet 698 Date: 2003/04/22 19:16:24 Author: serassio Branch: nt Tag: (none) Log: win32 source cleanup before merge with HEAD to avoid conflicts Members: src/main.cc:1.15.2.7->1.15.2.8 src/stat.cc:1.10.2.4->1.10.2.5 src/unlinkd.cc:1.7.2.2->1.7.2.3 src/win32.cc:1.4.2.5->1.4.2.6 Index: squid3/src/main.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/main.cc,v retrieving revision 1.15.2.7 retrieving revision 1.15.2.8 diff -u -r1.15.2.7 -r1.15.2.8 --- squid3/src/main.cc 22 Apr 2003 12:48:52 -0000 1.15.2.7 +++ squid3/src/main.cc 22 Apr 2003 19:16:24 -0000 1.15.2.8 @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.15.2.7 2003/04/22 12:48:52 serassio Exp $ + * $Id: main.cc,v 1.15.2.8 2003/04/22 19:16:24 serassio Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -42,7 +42,7 @@ #include "ACLASN.h" #include "ACL.h" -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE #include "squid_windows.h" #include @@ -99,7 +99,7 @@ usage(void) { fprintf(stderr, -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE "Usage: %s [-dhirsvzCDFRVYX] [-f config-file] [-[au] port] [-k signal] [-n name] [-O CommandLine]\n" #else "Usage: %s [-dhsvzCDFNRVYX] [-f config-file] [-[au] port] [-k signal]\n" @@ -109,13 +109,13 @@ " -f file Use given config-file instead of\n" " %s\n" " -h Print help message.\n" -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE " -i Installs as a Windows Service (see -n option).\n" #endif " -k reconfigure|rotate|shutdown|interrupt|kill|debug|check|parse\n" " Parse configuration file, then send signal to \n" " running copy (except -k parse) and exit.\n" -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE " -n name Specify Windows Service name to use for service operations\n" " default is: " _WIN_SQUID_DEFAULT_SERVICE_NAME ".\n" " -r Removes a Windows Service (see -n option).\n" @@ -128,7 +128,7 @@ " -D Disable initial DNS tests.\n" " -F Don't serve any requests until store is rebuilt.\n" " -N No daemon mode.\n" -#if (defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_))) +#if USE_WIN32_SERVICE " -O options\n" " Set Windows Service Command line options in Registry.\n" #endif @@ -147,7 +147,7 @@ extern char *optarg; int c; -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE while ((c = getopt(argc, argv, "CDFNO:RSVYXa:d:f:hik:m::n:rsu:vz?")) != -1) { #else @@ -172,7 +172,7 @@ case 'N': opt_no_daemon = 1; break; -#if (defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_))) +#if USE_WIN32_SERVICE case 'O': opt_command_line = 1; @@ -215,7 +215,7 @@ opt_reload_hit_only = 1; break; -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE case 'i': opt_install_service = TRUE; @@ -309,7 +309,7 @@ } -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE case 'n': xfree(WIN32_Service_name); @@ -349,7 +349,7 @@ case 'v': printf("Squid Cache: Version %s\nconfigure options: %s\n", version_string, SQUID_CONFIGURE_OPTIONS); -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE printf("Compiled as Windows System Service.\n"); @@ -843,7 +843,7 @@ configured_once = 1; } -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE /* When USE_WIN32_SERVICE is defined, the main function is placed in win32.cc */ extern "C" void WINAPI SquidMain(int argc, char **argv) @@ -934,7 +934,7 @@ failure_notify = fatal_dump; -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE WIN32_svcstatusupdate(SERVICE_START_PENDING, 10000); @@ -942,7 +942,7 @@ mainParseOptions(argc, argv); -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE if (opt_install_service) { WIN32_InstallService(); @@ -990,7 +990,7 @@ parse_err = parseConfigFile(ConfigFile); if (opt_parse_cfg_only) -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE return; @@ -1041,7 +1041,7 @@ setEffectiveUser(); debug(0, 0) ("Creating Swap Directories\n"); storeCreateSwapDirectories(); -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE return; #else @@ -1072,7 +1072,7 @@ fd_open(2, FD_LOG, "stderr"); } -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE WIN32_svcstatusupdate(SERVICE_START_PENDING, 10000); @@ -1080,7 +1080,7 @@ mainInitialize(); -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE WIN32_svcstatusupdate(SERVICE_RUNNING, 0); @@ -1111,7 +1111,7 @@ (int) wait); do_shutdown = 0; shutting_down = 1; -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE WIN32_svcstatusupdate(SERVICE_STOP_PENDING, (wait + 1) * 1000); #endif @@ -1172,7 +1172,7 @@ } /* NOTREACHED */ -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE return; #else @@ -1190,7 +1190,7 @@ pid = readPidFile(); if (pid > 1) { -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE if (opt_signal_service) WIN32_sendSignal(opt_send_signal); @@ -1437,7 +1437,7 @@ static void SquidShutdown(void *unused) { -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE WIN32_svcstatusupdate(SERVICE_STOP_PENDING, 10000); #endif @@ -1468,7 +1468,7 @@ unlinkdClose(); #endif -#if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) +#if USE_WIN32_SERVICE WIN32_svcstatusupdate(SERVICE_STOP_PENDING, 10000); #endif Index: squid3/src/stat.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/stat.cc,v retrieving revision 1.10.2.4 retrieving revision 1.10.2.5 diff -u -r1.10.2.4 -r1.10.2.5 --- squid3/src/stat.cc 16 Mar 2003 11:09:18 -0000 1.10.2.4 +++ squid3/src/stat.cc 22 Apr 2003 19:16:25 -0000 1.10.2.5 @@ -1,6 +1,6 @@ /* - * $Id: stat.cc,v 1.10.2.4 2003/03/16 11:09:18 serassio Exp $ + * $Id: stat.cc,v 1.10.2.5 2003/04/22 19:16:25 serassio Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -460,7 +460,8 @@ 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); + storeAppendPrintf(sentry,"Service command line is: %s\n", + WIN32_Service_Command_Line); } else storeAppendPrintf(sentry,"Running on %s\n",WIN32_OS_string); Index: squid3/src/unlinkd.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/unlinkd.cc,v retrieving revision 1.7.2.2 retrieving revision 1.7.2.3 diff -u -r1.7.2.2 -r1.7.2.3 --- squid3/src/unlinkd.cc 22 Apr 2003 10:58:21 -0000 1.7.2.2 +++ squid3/src/unlinkd.cc 22 Apr 2003 19:16:26 -0000 1.7.2.3 @@ -1,6 +1,6 @@ /* - * $Id: unlinkd.cc,v 1.7.2.2 2003/04/22 10:58:21 serassio Exp $ + * $Id: unlinkd.cc,v 1.7.2.3 2003/04/22 19:16:26 serassio Exp $ * * DEBUG: section 2 Unlink Daemon * AUTHOR: Duane Wessels @@ -226,7 +226,6 @@ void unlinkdInit(void) { -#ifdef USE_UNLINKD const char *args[2]; @@ -287,11 +286,7 @@ debug(2, 4) ("Unlinkd handle: 0x%x, PID: %d\n", (unsigned)hIpc, pid); #endif -#else - - debug(2, 1) ("Unlinkd is disabled\n"); -#endif /* def USE_UNLINKD */ } #endif /* ndef UNLINK_DAEMON */ Index: squid3/src/win32.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/win32.cc,v retrieving revision 1.4.2.5 retrieving revision 1.4.2.6 diff -u -r1.4.2.5 -r1.4.2.6 --- squid3/src/win32.cc 22 Apr 2003 10:58:21 -0000 1.4.2.5 +++ squid3/src/win32.cc 22 Apr 2003 19:16:26 -0000 1.4.2.6 @@ -1,6 +1,6 @@ /* - * $Id: win32.cc,v 1.4.2.5 2003/04/22 10:58:21 serassio Exp $ + * $Id: win32.cc,v 1.4.2.6 2003/04/22 19:16:26 serassio Exp $ * * * * * * * * * Legal stuff * * * * * * * * @@ -40,8 +40,6 @@ #include "squid.h" -/* This code compiles only on Cygwin & Windows NT Port */ -#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) #include "squid_windows.h" #ifdef _SQUID_MSWIN_ #if HAVE_WIN32_PSAPI @@ -53,7 +51,7 @@ static unsigned int GetOSVersion(); void WIN32_svcstatusupdate(DWORD, DWORD); void WINAPI WIN32_svcHandler(DWORD); -#ifdef USE_WIN32_SERVICE +#if USE_WIN32_SERVICE static int WIN32_StoreKey(const char *, DWORD, unsigned char *, int); static int WIN32_create_key(void); static void WIN32_build_argv (char *); @@ -68,7 +66,7 @@ SQUIDCEXTERN LPCRITICAL_SECTION dbg_mutex; #endif /* End native Windows NT EXPERIMENTAL PORT */ -#ifdef USE_WIN32_SERVICE +#if USE_WIN32_SERVICE static SERVICE_STATUS svcStatus; static SERVICE_STATUS_HANDLE svcHandle; static int WIN32_argc; @@ -98,7 +96,7 @@ #else #define CHANGESERVICECONFIG2 "ChangeServiceConfig2A" #endif -#ifdef USE_WIN32_SERVICE +#if USE_WIN32_SERVICE static SC_ACTION Squid_SCAction[] = { { SC_ACTION_RESTART, 60000 } }; static char Squid_ServiceDescriptionString[] = SOFTWARENAME " " VERSION " WWW Proxy Server"; static SERVICE_DESCRIPTION Squid_ServiceDescription = { Squid_ServiceDescriptionString }; @@ -118,7 +116,7 @@ /* LOCAL FUNCTIONS */ /* ====================================================================== */ -#ifdef USE_WIN32_SERVICE +#if USE_WIN32_SERVICE static int WIN32_create_key(void) { @@ -326,7 +324,7 @@ return _WIN_OS_UNKNOWN; } -#ifdef USE_WIN32_SERVICE +#if USE_WIN32_SERVICE /* Build argv, argc from string passed from Windows. */ static void WIN32_build_argv(char *cmd) { @@ -381,7 +379,7 @@ void WIN32_Abort(int sig) { -#ifdef USE_WIN32_SERVICE +#if USE_WIN32_SERVICE svcStatus.dwWin32ExitCode = ERROR_SERVICE_SPECIFIC_ERROR; svcStatus.dwServiceSpecificExitCode = 1; #endif @@ -396,7 +394,7 @@ #ifdef _SQUID_MSWIN_ Win32SockCleanup(); #endif -#ifdef USE_WIN32_SERVICE +#if USE_WIN32_SERVICE if (!Squid_Aborting) { svcStatus.dwCurrentState = SERVICE_STOPPED; @@ -413,7 +411,7 @@ _exit(0); } -#ifdef USE_WIN32_SERVICE +#if USE_WIN32_SERVICE int WIN32_Subsystem_Init(int * argc, char *** argv) #else int @@ -428,7 +426,7 @@ if (atexit(WIN32_Exit) != 0) return 1; -#ifdef USE_WIN32_SERVICE +#if USE_WIN32_SERVICE if (WIN32_run_mode == _WIN_SQUID_RUN_MODE_SERVICE) { @@ -522,7 +520,7 @@ return 0; } -#ifdef USE_WIN32_SERVICE +#if USE_WIN32_SERVICE void WIN32_svcstatusupdate(DWORD svcstate, DWORD WaitHint) { @@ -996,6 +994,4 @@ #endif /* End native Windows NT EXPERIMENTAL PORT */ -#endif /* defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) */ - #endif /* WIN32_C */