--------------------- PatchSet 3018 Date: 2001/09/12 20:21:15 Author: serassio Branch: nt-2_3 Tag: (none) Log: Merged Andrey's work Members: include/autoconf.h:1.1.2.7->1.1.2.8 include/squid-mswin.h:1.1.2.2->1.1.2.3 include/util.h:1.1.1.3.4.1.2.4->1.1.1.3.4.1.2.5 lib/win32lib.c:1.1.2.5->1.1.2.6 src/defines.h:1.1.1.3.4.2.2.4->1.1.1.3.4.2.2.5 src/dnsserver.c:1.1.1.3.4.1.2.3->1.1.1.3.4.1.2.4 src/main.c:1.1.1.3.4.2.2.10->1.1.1.3.4.2.2.11 src/squid.h:1.1.1.3.4.1.2.4->1.1.1.3.4.1.2.5 src/tools.c:1.1.1.3.4.1.2.9->1.1.1.3.4.1.2.10 src/win32.c:1.1.2.6->1.1.2.7 Index: squid/include/autoconf.h =================================================================== RCS file: /cvsroot/squid-sf//squid/include/Attic/autoconf.h,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -r1.1.2.7 -r1.1.2.8 --- squid/include/autoconf.h 13 Aug 2001 17:09:16 -0000 1.1.2.7 +++ squid/include/autoconf.h 12 Sep 2001 20:21:15 -0000 1.1.2.8 @@ -488,6 +488,7 @@ /* Define if you have the header file. */ #undef HAVE_DIRENT_H +#define HAVE_DIRENT_H 1 /* Define if you have the header file. */ #undef HAVE_ERRNO_H Index: squid/include/squid-mswin.h =================================================================== RCS file: /cvsroot/squid-sf//squid/include/Attic/squid-mswin.h,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- squid/include/squid-mswin.h 10 Sep 2001 20:30:07 -0000 1.1.2.2 +++ squid/include/squid-mswin.h 12 Sep 2001 20:21:15 -0000 1.1.2.3 @@ -1,6 +1,7 @@ /* - * $Id: squid-mswin.h,v 1.1.2.2 2001/09/10 20:30:07 serassio Exp $ + * $Id: squid-mswin.h,v 1.1.2.3 2001/09/12 20:21:15 serassio Exp $ * + * AUTHOR: Guido Serassio & Andrey Shorin * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ * ---------------------------------------------------------- @@ -31,19 +32,64 @@ */ /* Some tricks for MS Compilers */ + +#define __STDC__ 1 + +#pragma include_alias(, ) + #define alloca _alloca #define chdir _chdir +#define close _close +#define dup _dup +#define dup2 _dup2 +#define fdopen _fdopen +#define fileno _fileno +#define fstat _fstati64 #define getcwd _getcwd #define getpid _getpid +#define geteuid() 100 +#define lseek _lseeki64 +#define memccpy _memccpy +#define mkdir(p,m) _mkdir(p) +#define open _open +#define putenv _putenv +#define setgid(g) 100 #define setmode _setmode +#define setuid(l) 100 +#define sleep(t) Sleep((t)*1000) #define snprintf _snprintf +#define stat _stati64 #define strcasecmp _stricmp +#define strdup _strdup #define strncasecmp _strnicmp +#define tempnam _tempnam +#define umask _umask +#define unlink _unlink #define vsnprintf _vsnprintf -#define O_BYNARY _O_BINARY + +// temp +#define read _read +#define write _write + +#define O_RDONLY _O_RDONLY +#define O_BINARY _O_BINARY +#define O_WRONLY _O_WRONLY +#define O_APPEND _O_APPEND +#define O_TRUNC _O_TRUNC +#define O_CREAT _O_CREAT #define O_TEXT _O_TEXT + #define S_IRWXO 007 #define S_ISDIR(m) (((m) & _S_IFDIR) == _S_IFDIR) + +#define SIGHUP 1 /* hangup */ +#define SIGKILL 9 /* kill (cannot be caught or ignored) */ +#define SIGBUS 10 /* bus error */ +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#define SIGCHLD 20 /* to parent on child stop or exit */ +#define SIGUSR1 30 /* user defined signal 1 */ +#define SIGUSR2 31 /* user defined signal 2 */ + #define ushort unsigned short int #define uid_t int #define gid_t int @@ -54,6 +100,8 @@ #endif #include +/* prevent inclusion of wingdi.h */ +#define NOGDI #include #include "readdir.h" @@ -67,6 +115,9 @@ #define EWOULDBLOCK WSAEWOULDBLOCK #define EALREADY WSAEALREADY #define ETIMEDOUT WSAETIMEDOUT +#define ECONNREFUSED WSAECONNREFUSED +#define ECONNRESET WSAECONNRESET +#define ERESTART WSATRY_AGAIN #if defined (COMM_C) || defined (COMM_SELECT_C) #define recv(x,y,z) recv(x,y,z,0) Index: squid/include/util.h =================================================================== RCS file: /cvsroot/squid-sf//squid/include/util.h,v retrieving revision 1.1.1.3.4.1.2.4 retrieving revision 1.1.1.3.4.1.2.5 diff -u -r1.1.1.3.4.1.2.4 -r1.1.1.3.4.1.2.5 --- squid/include/util.h 8 Sep 2001 09:36:19 -0000 1.1.1.3.4.1.2.4 +++ squid/include/util.h 12 Sep 2001 20:21:15 -0000 1.1.1.3.4.1.2.5 @@ -1,5 +1,5 @@ /* - * $Id: util.h,v 1.1.1.3.4.1.2.4 2001/09/08 09:36:19 serassio Exp $ + * $Id: util.h,v 1.1.1.3.4.1.2.5 2001/09/12 20:21:15 serassio Exp $ * * AUTHOR: Harvest Derived * @@ -131,7 +131,6 @@ extern int kill(pid_t, int); extern void gettimeofday(struct timeval * ,void *); extern int statfs(const char *, struct statfs *); -extern int mkdir(const char *, mode_t); extern const char * wsastrerror(int); extern struct passwd *getpwnam(char *); extern struct group *getgrnam(char *); Index: squid/lib/win32lib.c =================================================================== RCS file: /cvsroot/squid-sf//squid/lib/win32lib.c,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -u -r1.1.2.5 -r1.1.2.6 --- squid/lib/win32lib.c 8 Sep 2001 09:36:19 -0000 1.1.2.5 +++ squid/lib/win32lib.c 12 Sep 2001 20:21:15 -0000 1.1.2.6 @@ -1,5 +1,5 @@ /* - * $Id: win32lib.c,v 1.1.2.5 2001/09/08 09:36:19 serassio Exp $ + * $Id: win32lib.c,v 1.1.2.6 2001/09/12 20:21:15 serassio Exp $ * * * * * * * * * Legal stuff * * * * * * * * @@ -111,17 +111,6 @@ return 0; } -int mkdir(const char * path, mode_t mode) - -{ - if (CreateDirectory(path, NULL) != 0) - return 0; - else - return -1; -} - - - static int optiserr(int argc, char * const *argv, int oint, const char *optstr, int optchr, int err) Index: squid/src/defines.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/defines.h,v retrieving revision 1.1.1.3.4.2.2.4 retrieving revision 1.1.1.3.4.2.2.5 diff -u -r1.1.1.3.4.2.2.4 -r1.1.1.3.4.2.2.5 --- squid/src/defines.h 19 Aug 2001 19:31:38 -0000 1.1.1.3.4.2.2.4 +++ squid/src/defines.h 12 Sep 2001 20:21:15 -0000 1.1.1.3.4.2.2.5 @@ -1,6 +1,6 @@ /* - * $Id: defines.h,v 1.1.1.3.4.2.2.4 2001/08/19 19:31:38 serassio Exp $ + * $Id: defines.h,v 1.1.1.3.4.2.2.5 2001/09/12 20:21:15 serassio Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -309,13 +309,4 @@ #define _WIN_SQUID_SERVICE_OPTION "--ntservice" #define _WIN_SQUID_RUN_MODE_INTERACTIVE 0 #define _WIN_SQUID_RUN_MODE_SERVICE 1 -#ifdef _SQUID_MSWIN_ -#define SIGHUP 1 /* hangup */ -#define SIGKILL 9 /* kill (cannot be caught or ignored) */ -#define SIGBUS 10 /* bus error */ -#define SIGPIPE 13 /* write on a pipe with no one to read it */ -#define SIGCHLD 20 /* to parent on child stop or exit */ -#define SIGUSR1 30 /* user defined signal 1 */ -#define SIGUSR2 31 /* user defined signal 2 */ -#endif #endif Index: squid/src/dnsserver.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/dnsserver.c,v retrieving revision 1.1.1.3.4.1.2.3 retrieving revision 1.1.1.3.4.1.2.4 diff -u -r1.1.1.3.4.1.2.3 -r1.1.1.3.4.1.2.4 --- squid/src/dnsserver.c 14 Jun 2001 21:34:24 -0000 1.1.1.3.4.1.2.3 +++ squid/src/dnsserver.c 12 Sep 2001 20:21:15 -0000 1.1.1.3.4.1.2.4 @@ -1,6 +1,6 @@ /* - * $Id: dnsserver.c,v 1.1.1.3.4.1.2.3 2001/06/14 21:34:24 serassio Exp $ + * $Id: dnsserver.c,v 1.1.1.3.4.1.2.4 2001/09/12 20:21:15 serassio Exp $ * * DEBUG: section 0 DNS Resolver * AUTHOR: Harvest Derived @@ -232,11 +232,7 @@ break; if (++retry == 3) break; -#ifdef _SQUID_MSWIN_ - Sleep(1000); -#else sleep(1); -#endif } if (NULL == result) { if (h_errno == TRY_AGAIN) { Index: squid/src/main.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/main.c,v retrieving revision 1.1.1.3.4.2.2.10 retrieving revision 1.1.1.3.4.2.2.11 diff -u -r1.1.1.3.4.2.2.10 -r1.1.1.3.4.2.2.11 --- squid/src/main.c 13 Aug 2001 17:09:17 -0000 1.1.1.3.4.2.2.10 +++ squid/src/main.c 12 Sep 2001 20:21:15 -0000 1.1.1.3.4.2.2.11 @@ -1,6 +1,6 @@ /* - * $Id: main.c,v 1.1.1.3.4.2.2.10 2001/08/13 17:09:17 serassio Exp $ + * $Id: main.c,v 1.1.1.3.4.2.2.11 2001/09/12 20:21:15 serassio Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -38,9 +38,6 @@ #if defined(USE_WIN32_SERVICE) && (defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)) #include #include -#ifdef _SQUID_MSWIN_ -#include -#endif static int opt_install_service = FALSE; static int opt_remove_service = FALSE; static int opt_signal_service = FALSE; Index: squid/src/squid.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/squid.h,v retrieving revision 1.1.1.3.4.1.2.4 retrieving revision 1.1.1.3.4.1.2.5 diff -u -r1.1.1.3.4.1.2.4 -r1.1.1.3.4.1.2.5 --- squid/src/squid.h 1 Sep 2001 15:08:12 -0000 1.1.1.3.4.1.2.4 +++ squid/src/squid.h 12 Sep 2001 20:21:15 -0000 1.1.1.3.4.1.2.5 @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.1.1.3.4.1.2.4 2001/09/01 15:08:12 serassio Exp $ + * $Id: squid.h,v 1.1.1.3.4.1.2.5 2001/09/12 20:21:15 serassio Exp $ * * AUTHOR: Duane Wessels * @@ -197,9 +197,7 @@ #include #define NAMLEN(dirent) strlen((dirent)->d_name) #else /* HAVE_DIRENT_H */ -#ifndef _SQUID_MSWIN_ #define dirent direct -#endif #define NAMLEN(dirent) (dirent)->d_namlen #if HAVE_SYS_NDIR_H #include Index: squid/src/tools.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/tools.c,v retrieving revision 1.1.1.3.4.1.2.9 retrieving revision 1.1.1.3.4.1.2.10 diff -u -r1.1.1.3.4.1.2.9 -r1.1.1.3.4.1.2.10 --- squid/src/tools.c 1 Sep 2001 10:46:22 -0000 1.1.1.3.4.1.2.9 +++ squid/src/tools.c 12 Sep 2001 20:21:15 -0000 1.1.1.3.4.1.2.10 @@ -1,6 +1,6 @@ /* - * $Id: tools.c,v 1.1.1.3.4.1.2.9 2001/09/01 10:46:22 serassio Exp $ + * $Id: tools.c,v 1.1.1.3.4.1.2.10 2001/09/12 20:21:15 serassio Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -38,9 +38,6 @@ #include #include #include -#ifdef _SQUID_MSWIN_ -#include -#endif #endif #define DEAD_MSG "\ @@ -556,7 +553,6 @@ leave_suid(void) { debug(21, 3) ("leave_suid: PID %d called\n", getpid()); -#ifndef _SQUID_MSWIN_ if (geteuid() != 0) return; /* Started as a root, check suid option */ @@ -579,7 +575,6 @@ if (setuid(Config2.effectiveUserID) < 0) debug(50, 0) ("ALERT: setuid: %s\n", xstrerror()); #endif -#endif } /* Enter a privilegied section */ @@ -587,13 +582,11 @@ enter_suid(void) { debug(21, 3) ("enter_suid: PID %d taking root priveleges\n", getpid()); -#ifndef _SQUID_MSWIN_ #if HAVE_SETRESUID setresuid(-1, 0, -1); #else setuid(0); #endif -#endif } /* Give up the posibility to gain privilegies. Index: squid/src/win32.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/win32.c,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -u -r1.1.2.6 -r1.1.2.7 --- squid/src/win32.c 19 Aug 2001 19:31:38 -0000 1.1.2.6 +++ squid/src/win32.c 12 Sep 2001 20:21:15 -0000 1.1.2.7 @@ -468,10 +468,10 @@ /* try to stop the service */ if (ControlService(schService, _WIN_SQUID_SERVICE_CONTROL_STOP, &svcStatus)) { - Sleep(1000); + sleep(1); while (QueryServiceStatus(schService, &svcStatus)) { if (svcStatus.dwCurrentState == SERVICE_STOP_PENDING) - Sleep(1000); + sleep(1); else break; }