--------------------- PatchSet 8527 Date: 2006/08/19 16:56:53 Author: serassio Branch: nt Tag: (none) Log: Fixed Windows logfile-daemon support Members: port/win32/Makefile.am:1.1.14.5->1.1.14.6 port/win32/squid.dsw:1.1.38.5->1.1.38.6 port/win32/squid_mswin.mak:1.1.38.3->1.1.38.4 port/win32/update.cmd:1.1.36.9->1.1.36.10 port/win32/logfiled/.cvsignore:1.1->1.1.2.1 port/win32/logfiled/logfiled.dsp:1.1->1.1.2.1 src/logfile-daemon.c:1.3.2.5->1.3.2.6 src/logfile.c:1.10.2.4->1.10.2.5 Index: squid/port/win32/Makefile.am =================================================================== RCS file: /cvsroot/squid-sf//squid/port/win32/Attic/Makefile.am,v retrieving revision 1.1.14.5 retrieving revision 1.1.14.6 diff -u -r1.1.14.5 -r1.1.14.6 --- squid/port/win32/Makefile.am 26 Jun 2006 18:29:09 -0000 1.1.14.5 +++ squid/port/win32/Makefile.am 19 Aug 2006 16:58:54 -0000 1.1.14.6 @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in # -# $Id: Makefile.am,v 1.1.14.5 2006/06/26 18:29:09 serassio Exp $ +# $Id: Makefile.am,v 1.1.14.6 2006/08/19 16:58:54 serassio Exp $ # EXTRA_DIST = \ @@ -49,6 +49,7 @@ libsnmp/libsnmp.dsp \ libsspwin32/libsspwin32.dsp \ libufs/libufs.dsp \ + logfiled/logfiled.dsp \ NCSA_auth/NCSA_auth.dsp \ negotiate_auth/negotiate_auth.dsp \ nt_auth/nt_auth.dsp \ Index: squid/port/win32/squid.dsw =================================================================== RCS file: /cvsroot/squid-sf//squid/port/win32/Attic/squid.dsw,v retrieving revision 1.1.38.5 retrieving revision 1.1.38.6 diff -u -r1.1.38.5 -r1.1.38.6 --- squid/port/win32/squid.dsw 18 Jun 2006 12:21:47 -0000 1.1.38.5 +++ squid/port/win32/squid.dsw 19 Aug 2006 16:56:53 -0000 1.1.38.6 @@ -65,6 +65,9 @@ Begin Project Dependency Project_Dep_Name digest_pw_auth End Project Dependency + Begin Project Dependency + Project_Dep_Name logfiled + End Project Dependency }}} ############################################################################### @@ -498,6 +501,18 @@ ############################################################################### +Project: "logfiled"=".\logfiled\logfiled.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "modules"=".\modules.dsp" - Package Owner=<4> Package=<5> Index: squid/port/win32/squid_mswin.mak =================================================================== RCS file: /cvsroot/squid-sf//squid/port/win32/Attic/squid_mswin.mak,v retrieving revision 1.1.38.3 retrieving revision 1.1.38.4 diff -u -r1.1.38.3 -r1.1.38.4 --- squid/port/win32/squid_mswin.mak 2 Jun 2006 13:06:59 -0000 1.1.38.3 +++ squid/port/win32/squid_mswin.mak 19 Aug 2006 16:56:53 -0000 1.1.38.4 @@ -23,7 +23,8 @@ UNLINKD_EXE = unlinkd$(exec_suffix) PINGER_EXE = pinger$(exec_suffix) CACHEMGR_EXE = cachemgr$(cgi_suffix) -DISKD_EXE = diskd$(exec_suffix) +DISKD_EXE = diskd-daemon$(exec_suffix) +LOGFILED_EXE = logfile-daemon$(exec_suffix) DEFAULT_HTTP_PORT = 3128 DEFAULT_ICP_PORT = 3130 @@ -41,6 +42,7 @@ DEFAULT_PINGER = $(libexecdir)/$(PINGER_EXE) DEFAULT_UNLINKD = $(libexecdir)/$(UNLINKD_EXE) DEFAULT_DISKD = $(libexecdir)/$(DISKD_EXE) +DEFAULT_LOGFILED = $(libexecdir)/$(LOGFILED_EXE) DEFAULT_ICON_DIR = $(datadir)/icons DEFAULT_ERROR_DIR = $(datadir)/errors/English DEFAULT_MIB_PATH = $(datadir)/mib.txt @@ -71,6 +73,7 @@ s%@DEFAULT_UNLINKD@%$(DEFAULT_UNLINKD)%g;\ s%@DEFAULT_PINGER@%$(DEFAULT_PINGER)%g;\ s%@DEFAULT_DISKD@%$(DEFAULT_DISKD)%g;\ + s%@DEFAULT_LOGFILED@%$(DEFAULT_LOGFILED)%g;\ s%@DEFAULT_CACHE_LOG@%$(DEFAULT_CACHE_LOG)%g;\ s%@DEFAULT_ACCESS_LOG@%$(DEFAULT_ACCESS_LOG)%g;\ s%@DEFAULT_STORE_LOG@%$(DEFAULT_STORE_LOG)%g;\ Index: squid/port/win32/update.cmd =================================================================== RCS file: /cvsroot/squid-sf//squid/port/win32/Attic/update.cmd,v retrieving revision 1.1.36.9 retrieving revision 1.1.36.10 diff -u -r1.1.36.9 -r1.1.36.10 --- squid/port/win32/update.cmd 12 Aug 2006 19:26:38 -0000 1.1.36.9 +++ squid/port/win32/update.cmd 19 Aug 2006 16:56:53 -0000 1.1.36.10 @@ -12,6 +12,7 @@ copy %0\..\squid\%1\squid.exe %2\sbin\squid.exe copy %0\..\unlinkd\%1\unlinkd.exe %2\libexec\unlinkd.exe +copy %0\..\logfiled\%1\logfiled.exe %2\libexec\logfile-daemon.exe if exist %0\..\dnsserver\%1\dnsserver.exe copy %0\..\dnsserver\%1\dnsserver.exe %2\libexec\dnsserver.exe if exist %0\..\pinger\%1\pinger.exe copy %0\..\pinger\%1\pinger.exe %2\libexec\pinger.exe copy %0\..\squidclient\%1\squidclient.exe %2\bin\squidclient.exe --- /dev/null Wed Feb 14 01:16:55 2007 +++ squid/port/win32/logfiled/.cvsignore Wed Feb 14 01:16:57 2007 @@ -0,0 +1,2 @@ +Debug +Release --- /dev/null Wed Feb 14 01:16:55 2007 +++ squid/port/win32/logfiled/logfiled.dsp Wed Feb 14 01:16:57 2007 @@ -0,0 +1,102 @@ +# Microsoft Developer Studio Project File - Name="logfiled" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=logfiled - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "logfiled.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "logfiled.mak" CFG="logfiled - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "logfiled - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "logfiled - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "logfiled - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /I "../../../include" /I "../../../src" /I "../include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /D _FILE_OFFSET_BITS=64 /YX /FD /c +# ADD BASE RSC /l 0x410 /d "NDEBUG" +# ADD RSC /l 0x410 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "logfiled - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /G6 /MTd /W3 /Gm /GX /ZI /Od /I "../../../include" /I "../../../src" /I "../include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "HAVE_CONFIG_H" /D _FILE_OFFSET_BITS=64 /YX /FD /GZ /c +# ADD BASE RSC /l 0x410 /d "_DEBUG" +# ADD RSC /l 0x410 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "logfiled - Win32 Release" +# Name "logfiled - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE="..\..\..\src\logfile-daemon.c" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project Index: squid/src/logfile-daemon.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/logfile-daemon.c,v retrieving revision 1.3.2.5 retrieving revision 1.3.2.6 diff -u -r1.3.2.5 -r1.3.2.6 --- squid/src/logfile-daemon.c 19 Aug 2006 13:54:34 -0000 1.3.2.5 +++ squid/src/logfile-daemon.c 19 Aug 2006 16:56:54 -0000 1.3.2.6 @@ -1,5 +1,9 @@ #include "config.h" +#ifdef _SQUID_MSWIN_ +#define _WIN32_WINNT 0x0500 +#include +#endif #if HAVE_STDIO_H #include #endif @@ -45,9 +49,14 @@ #define LOGFILE_BUF_LEN 65536 int do_flush = 0; +FILE *fp; +#ifdef _SQUID_MSWIN_ +VOID CALLBACK signal_alarm(PVOID * unused, BOOL TimerOrWaitFired) +#else static void signal_alarm(int unused) +#endif { do_flush = 1; } @@ -72,10 +81,16 @@ i--; snprintf(from, MAXPATHLEN, "%s.%d", path, i - 1); snprintf(to, MAXPATHLEN, "%s.%d", path, i); +#if defined(_SQUID_OS2_) || defined(_SQUID_WIN32_) + remove(to); +#endif rename(from, to); } if (rotate_count > 0) { snprintf(to, MAXPATHLEN, "%s.%d", path, 0); +#if defined(_SQUID_OS2_) || defined(_SQUID_WIN32_) + remove(to); +#endif rename(path, to); } } @@ -94,14 +109,25 @@ main(int argc, char *argv[]) { int t; - FILE *fp; char buf[LOGFILE_BUF_LEN]; int rotate_count = 10; int do_buffer = 0; +#ifdef _SQUID_MSWIN_ + HANDLE hTimer = NULL; + HANDLE hTimerQueue = NULL; +#endif /* Try flushing to disk every second */ +#ifdef _SQUID_MSWIN_ + if (!CreateTimerQueueTimer(&hTimer, hTimerQueue, signal_alarm, NULL , 1000, 1000, WT_EXECUTEINTIMERTHREAD)) + { + printf("CreateTimerQueueTimer failed (%d)\n", GetLastError()); + exit (1); + } +#else signal(SIGALRM, signal_alarm); ualarm(1000000, 1000000); +#endif if (argc < 2) { printf("Error: usage: %s \n", argv[0]); Index: squid/src/logfile.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/logfile.c,v retrieving revision 1.10.2.4 retrieving revision 1.10.2.5 diff -u -r1.10.2.4 -r1.10.2.5 --- squid/src/logfile.c 19 Aug 2006 13:54:34 -0000 1.10.2.4 +++ squid/src/logfile.c 19 Aug 2006 16:56:54 -0000 1.10.2.5 @@ -274,6 +274,11 @@ Logfile *lf; const char *args[5]; char *tmpbuf; +#ifdef _SQUID_MSWIN_ + HANDLE hIpc; + pid_t pid; +#endif + CBDATA_INIT_TYPE(Logfile); lf = cbdataAlloc(Logfile); cbdataLock(lf); @@ -302,7 +307,11 @@ args[0] = "(logfile-daemon)"; args[1] = path; args[2] = NULL; - lf->pid = ipcCreate(IPC_STREAM, Config.Program.logfile_daemon, args, "logfile-daemon", &lf->rfd, &lf->wfd); + lf->pid = ipcCreate(IPC_STREAM, Config.Program.logfile_daemon, args, "logfile-daemon", &lf->rfd, &lf->wfd +#ifdef _SQUID_MSWIN_ + , &hIpc, &pid +#endif + ); if (lf->pid < 0) fatal("Couldn't start logfile helper"); }