2 * AUTHOR: Andrey Shorin <tolsty@tushino.com>
3 * AUTHOR: Guido Serassio <serassio@squid-cache.org>
5 * SQUID Web Proxy Cache http://www.squid-cache.org/
6 * ----------------------------------------------------------
8 * Squid is the result of efforts by numerous individuals from
9 * the Internet community; see the CONTRIBUTORS file for full
10 * details. Many organizations have provided support for Squid's
11 * development; see the SPONSORS file for full details. Squid is
12 * Copyrighted (C) 2001 by the Regents of the University of
13 * California; see the COPYRIGHT file for full details. Squid
14 * incorporates software developed and/or copyrighted by other
15 * sources; see the CREDITS file for full details.
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
32 #ifndef SQUID_OS_MSWINDOWS_H
33 #define SQUID_OS_MSWINDOWS_H
37 /* we target Windows XP and later - some API are missing otherwise */
43 #define _WIN32_WINNT WINVER
45 #endif /* _SQUID_MINGW_ */
49 #endif /* HAVE_FCNTL_H */
52 #endif /* HAVE_FCNTL_H */
55 #endif /* HAVE_SYS_STAT_H */
57 #define ACL WindowsACL
58 #if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
60 #define _CRT_SECURE_NO_DEPRECATE
61 #pragma warning( disable : 4290 )
62 #pragma warning( disable : 4996 )
66 /* Some MinGW version defines min() and max() as macros
67 causing the fail of the build process. The following
68 #define will disable that definition
70 #if defined(__GNUC__) && !NOMINMAX
74 #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
75 # define __USE_FILE_OFFSET64 1
78 #if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
80 #if defined(__USE_FILE_OFFSET64)
81 typedef uint64_t ino_t
;
83 typedef unsigned long ino_t
;
86 #define INT64_MAX _I64_MAX
87 #define INT64_MIN _I64_MIN
89 #include "default_config_file.h"
90 /* Some tricks for MS Compilers */
92 #define THREADLOCAL __declspec(thread)
94 #elif defined(__GNUC__) /* gcc environment */
96 #define THREADLOCAL __attribute__((section(".tls")))
100 /* ONLY Microsoft C Compiler needs these: */
101 #if defined(_MSC_VER)
102 #define alloca _alloca
103 #define fileno _fileno
104 #define fstat _fstati64
105 #define lseek _lseeki64
106 #define memccpy _memccpy
107 #define mkdir(p,F) _mkdir((p))
108 #define mktemp _mktemp
109 #define snprintf _snprintf
110 #define stat _stati64
111 #define strcasecmp _stricmp
112 #define strdup _strdup
113 #define strlwr _strlwr
114 #define strncasecmp _strnicmp
115 #define tempnam _tempnam
116 #define vsnprintf _vsnprintf
119 /* CygWin and MinGW compilers need these. Microsoft C Compiler does not. */
120 #if _SQUID_MINGW_ || _SQUID_CYGWIN_
121 #define mkdir(p,F) mkdir((p))
124 /* Microsoft C Compiler and CygWin need these. MinGW does not */
125 #if defined(_MSC_VER) || _SQUID_CYGWIN_
126 SQUIDCEXTERN
int WIN32_ftruncate(int fd
, off_t size
);
127 #define ftruncate WIN32_ftruncate
128 SQUIDCEXTERN
int WIN32_truncate(const char *pathname
, off_t length
);
129 #define truncate WIN32_truncate
132 /* All three compiler systems need these: */
136 #define fdopen _fdopen
137 #define getcwd _getcwd
138 #define getpid _getpid
139 #define pclose _pclose
141 #define putenv _putenv
142 #define setmode _setmode
143 #define sleep(t) Sleep((t)*1000)
145 #define unlink _unlink
147 #define O_RDONLY _O_RDONLY
148 #define O_WRONLY _O_WRONLY
149 #define O_RDWR _O_RDWR
150 #define O_APPEND _O_APPEND
152 #define O_CREAT _O_CREAT
153 #define O_TRUNC _O_TRUNC
154 #define O_EXCL _O_EXCL
156 #define O_TEXT _O_TEXT
157 #define O_BINARY _O_BINARY
158 #define O_RAW _O_BINARY
159 #define O_TEMPORARY _O_TEMPORARY
160 #define O_NOINHERIT _O_NOINHERIT
161 #define O_SEQUENTIAL _O_SEQUENTIAL
162 #define O_RANDOM _O_RANDOM
165 #define S_IFMT _S_IFMT
166 #define S_IFDIR _S_IFDIR
167 #define S_IFCHR _S_IFCHR
168 #define S_IFREG _S_IFREG
169 #define S_IREAD _S_IREAD
170 #define S_IWRITE _S_IWRITE
171 #define S_IEXEC _S_IEXEC
175 #if defined(_MSC_VER)
176 #define S_ISDIR(m) (((m) & _S_IFDIR) == _S_IFDIR)
179 #define SIGHUP 1 /* hangup */
180 #define SIGKILL 9 /* kill (cannot be caught or ignored) */
181 #define SIGBUS 10 /* bus error */
182 #define SIGPIPE 13 /* write on a pipe with no one to read it */
183 #define SIGCHLD 20 /* to parent on child stop or exit */
184 #define SIGUSR1 30 /* user defined signal 1 */
185 #define SIGUSR2 31 /* user defined signal 2 */
188 typedef unsigned char boolean
;
189 typedef unsigned char u_char
;
190 typedef unsigned int u_int
;
193 #if defined(_MSC_VER)
199 char *pw_name
; /* user name */
200 char *pw_passwd
; /* user password */
201 uid_t pw_uid
; /* user id */
202 gid_t pw_gid
; /* group id */
203 char *pw_gecos
; /* real name */
204 char *pw_dir
; /* home directory */
205 char *pw_shell
; /* shell program */
209 char *gr_name
; /* group name */
210 char *gr_passwd
; /* group password */
211 gid_t gr_gid
; /* group id */
212 char **gr_mem
; /* group members */
217 long f_type
; /* type of filesystem (see below) */
218 long f_bsize
; /* optimal transfer block size */
219 long f_blocks
; /* total data blocks in file system */
220 long f_bfree
; /* free blocks in fs */
221 long f_bavail
; /* free blocks avail to non-superuser */
222 long f_files
; /* total file nodes in file system */
223 long f_ffree
; /* free file nodes in fs */
224 long f_fsid
; /* file system id */
225 long f_namelen
; /* maximum length of filenames */
226 long f_spare
[6]; /* spare for later */
230 #if !HAVE_GETTIMEOFDAY
232 int tz_minuteswest
; /* minutes west of Greenwich */
233 int tz_dsttime
; /* type of dst correction */
237 #define CHANGE_FD_SETSIZE 1
238 #if CHANGE_FD_SETSIZE && SQUID_MAXFD > DEFAULT_FD_SETSIZE
239 #define FD_SETSIZE SQUID_MAXFD
245 #include <winsock2.h>
252 #include <ws2tcpip.h>
255 #if (EAI_NODATA == EAI_NONAME)
257 #define EAI_NODATA WSANO_DATA
260 #if defined(_MSC_VER)
261 /* Hack to suppress compiler warnings on FD_SET() & FD_CLR() */
262 #pragma warning (push)
263 #pragma warning (disable:4142)
266 /* prevent inclusion of wingdi.h */
270 #if defined(_MSC_VER)
271 #pragma warning (pop)
276 typedef char * caddr_t
;
278 #ifndef _PATH_DEVNULL
279 #define _PATH_DEVNULL "NUL"
288 #define EISCONN WSAEISCONN
291 #define EINPROGRESS WSAEINPROGRESS
294 #define EWOULDBLOCK WSAEWOULDBLOCK
297 #define EALREADY WSAEALREADY
300 #define ETIMEDOUT WSAETIMEDOUT
303 #define ECONNREFUSED WSAECONNREFUSED
306 #define ECONNRESET WSAECONNRESET
309 #define ENOTCONN WSAENOTCONN
312 #define ERESTART WSATRY_AGAIN
315 #define EAFNOSUPPORT WSAEAFNOSUPPORT
318 #define ENETUNREACH WSAENETUNREACH
321 #define ENOTSUP WSAEOPNOTSUPP
325 #define h_errno errno /* we'll set it ourselves */
328 #define FD_CLR(fd, set) do { \
330 SOCKET __sock = _get_osfhandle(fd); \
331 for (__i = 0; __i < ((fd_set FAR *)(set))->fd_count ; __i++) { \
332 if (((fd_set FAR *)(set))->fd_array[__i] == __sock) { \
333 while (__i < ((fd_set FAR *)(set))->fd_count-1) { \
334 ((fd_set FAR *)(set))->fd_array[__i] = \
335 ((fd_set FAR *)(set))->fd_array[__i+1]; \
338 ((fd_set FAR *)(set))->fd_count--; \
345 #define FD_SET(fd, set) do { \
347 SOCKET __sock = _get_osfhandle(fd); \
348 for (__i = 0; __i < ((fd_set FAR *)(set))->fd_count; __i++) { \
349 if (((fd_set FAR *)(set))->fd_array[__i] == (__sock)) { \
353 if (__i == ((fd_set FAR *)(set))->fd_count) { \
354 if (((fd_set FAR *)(set))->fd_count < FD_SETSIZE) { \
355 ((fd_set FAR *)(set))->fd_array[__i] = (__sock); \
356 ((fd_set FAR *)(set))->fd_count++; \
362 #define FD_ISSET(fd, set) Win32__WSAFDIsSet(fd, (fd_set FAR *)(set))
364 /* internal to Microsoft CRTLIB */
366 long osfhnd
; /* underlying OS file HANDLE */
367 char osfile
; /* attributes of file (e.g., open in text mode?) */
368 char pipech
; /* one char buffer for handles opened on pipes */
371 CRITICAL_SECTION lock
;
375 #define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
376 #define _pioinfo(i) ( __pioinfo[(i) >> IOINFO_L2E] + ((i) & (IOINFO_ARRAY_ELTS - 1)) )
377 #define _osfile(i) ( _pioinfo(i)->osfile )
378 #define _osfhnd(i) ( _pioinfo(i)->osfhnd )
379 #define FOPEN 0x01 /* file handle open */
381 #if defined(_MSC_VER)
382 SQUIDCEXTERN _CRTIMP ioinfo
* __pioinfo
[];
383 SQUIDCEXTERN
int __cdecl
_free_osfhnd(int);
387 __MINGW_IMPORT ioinfo
* __pioinfo
[];
388 SQUIDCEXTERN
int _free_osfhnd(int);
391 SQUIDCEXTERN THREADLOCAL
int ws32_result
;
393 #if defined(__cplusplus)
398 char l_so_type
[sizeof(int)];
399 int l_so_type_siz
= sizeof(l_so_type
);
400 SOCKET sock
= _get_osfhandle(fd
);
402 if (::getsockopt(sock
, SOL_SOCKET
, SO_TYPE
, l_so_type
, &l_so_type_siz
) == 0) {
404 if (closesocket(sock
) == SOCKET_ERROR
) {
405 errno
= WSAGetLastError();
415 #if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
418 #define _S_IREAD 0x0100
422 #define _S_IWRITE 0x0080
426 open(const char *filename
, int oflag
, int pmode
= 0)
428 return _open(filename
, oflag
, pmode
& (_S_IREAD
| _S_IWRITE
));
433 read(int fd
, void * buf
, size_t siz
)
435 char l_so_type
[sizeof(int)];
436 int l_so_type_siz
= sizeof(l_so_type
);
437 SOCKET sock
= _get_osfhandle(fd
);
439 if (::getsockopt(sock
, SOL_SOCKET
, SO_TYPE
, l_so_type
, &l_so_type_siz
) == 0)
440 return ::recv(sock
, (char FAR
*) buf
, (int)siz
, 0);
442 return _read(fd
, buf
, (unsigned int)siz
);
446 write(int fd
, const void * buf
, size_t siz
)
448 char l_so_type
[sizeof(int)];
449 int l_so_type_siz
= sizeof(l_so_type
);
450 SOCKET sock
= _get_osfhandle(fd
);
452 if (::getsockopt(sock
, SOL_SOCKET
, SO_TYPE
, l_so_type
, &l_so_type_siz
) == 0)
453 return ::send(sock
, (char FAR
*) buf
, siz
, 0);
455 return _write(fd
, buf
, siz
);
459 index(const char *s
, int c
)
461 return (char *)strchr(s
,c
);
464 // stdlib <functional> definitions are required before std API redefinitions.
465 #include <functional>
467 /** \cond AUTODOCS-IGNORE */
473 accept(int s
, struct sockaddr
* a
, socklen_t
* l
)
476 if ((result
= ::accept(_get_osfhandle(s
), a
, l
)) == INVALID_SOCKET
) {
477 if (WSAEMFILE
== (errno
= WSAGetLastError()))
481 return _open_osfhandle(result
, 0);
483 #define accept(s,a,l) Squid::accept(s,a,l)
486 bind(int s
, const struct sockaddr
* n
, socklen_t l
)
488 if (::bind(_get_osfhandle(s
),n
,l
) == SOCKET_ERROR
) {
489 errno
= WSAGetLastError();
494 #define bind(s,n,l) Squid::bind(s,n,l)
497 connect(int s
, const struct sockaddr
* n
, socklen_t l
)
499 if (::connect(_get_osfhandle(s
),n
,l
) == SOCKET_ERROR
) {
500 if (WSAEMFILE
== (errno
= WSAGetLastError()))
506 #define connect(s,n,l) Squid::connect(s,n,l)
508 inline struct hostent
*
509 gethostbyname(const char *n
) {
510 HOSTENT FAR
* result
;
511 if ((result
= ::gethostbyname(n
)) == NULL
)
512 errno
= WSAGetLastError();
515 #define gethostbyname(n) Squid::gethostbyname(n)
518 getservbyname(const char * n
, const char * p
)
520 SERVENT FAR
* result
;
521 if ((result
= ::getservbyname(n
, p
)) == NULL
)
522 errno
= WSAGetLastError();
525 #define getservbyname(n,p) Squid::getservbyname(n,p)
528 gethostbyaddr(const void * a
, size_t l
, int t
)
530 HOSTENT FAR
* result
;
531 if ((result
= ::gethostbyaddr((const char*)a
, l
, t
)) == NULL
)
532 errno
= WSAGetLastError();
535 #define gethostbyaddr(a,l,t) Squid::gethostbyaddr(a,l,t)
538 getsockname(int s
, struct sockaddr
* n
, socklen_t
* l
)
541 if (::getsockname(_get_osfhandle(s
), n
, &i
) == SOCKET_ERROR
) {
542 errno
= WSAGetLastError();
547 #define getsockname(s,a,l) Squid::getsockname(s,a,l)
550 gethostname(char * n
, size_t l
)
552 if ((::gethostname(n
, l
)) == SOCKET_ERROR
) {
553 errno
= WSAGetLastError();
558 #define gethostname(n,l) Squid::gethostname(n,l)
561 getsockopt(int s
, int l
, int o
, void * v
, socklen_t
* n
)
564 if ((::getsockopt(_get_osfhandle(s
), l
, o
,(char *) v
, n
)) == SOCKET_ERROR
) {
565 errno
= WSAGetLastError();
570 #define getsockopt(s,l,o,v,n) Squid::getsockopt(s,l,o,v,n)
572 /* Simple ioctl() emulation */
574 ioctl(int s
, int c
, void * a
)
576 if ((::ioctlsocket(_get_osfhandle(s
), c
, (u_long FAR
*)a
)) == SOCKET_ERROR
) {
577 errno
= WSAGetLastError();
582 #define ioctl(s,c,a) Squid::ioctl(s,c,a)
585 ioctlsocket(int s
, long c
, u_long FAR
* a
)
587 if ((::ioctlsocket(_get_osfhandle(s
), c
, a
)) == SOCKET_ERROR
) {
588 errno
= WSAGetLastError();
593 #define ioctlsocket(s,c,a) Squid::ioctlsocket(s,c,a)
598 if (::listen(_get_osfhandle(s
), b
) == SOCKET_ERROR
) {
599 if (WSAEMFILE
== (errno
= WSAGetLastError()))
605 #define listen(s,b) Squid::listen(s,b)
608 recv(int s
, void * b
, size_t l
, int f
)
611 if ((result
= ::recv(_get_osfhandle(s
), (char *)b
, l
, f
)) == SOCKET_ERROR
) {
612 errno
= WSAGetLastError();
617 #define recv(s,b,l,f) Squid::recv(s,b,l,f)
620 recvfrom(int s
, void * b
, size_t l
, int f
, struct sockaddr
* fr
, socklen_t
* fl
)
624 if ((result
= ::recvfrom(_get_osfhandle(s
), (char *)b
, l
, f
, fr
, &ifl
)) == SOCKET_ERROR
) {
625 errno
= WSAGetLastError();
630 #define recvfrom(s,b,l,f,r,n) Squid::recvfrom(s,b,l,f,r,n)
633 select(int n
, fd_set
* r
, fd_set
* w
, fd_set
* e
, struct timeval
* t
)
636 if ((result
= ::select(n
,r
,w
,e
,t
)) == SOCKET_ERROR
) {
637 errno
= WSAGetLastError();
642 #define select(n,r,w,e,t) Squid::select(n,r,w,e,t)
645 send(int s
, const char * b
, size_t l
, int f
)
648 if ((result
= ::send(_get_osfhandle(s
), b
, l
, f
)) == SOCKET_ERROR
) {
649 errno
= WSAGetLastError();
654 #define send(s,b,l,f) Squid::send(s,b,l,f)
657 sendto(int s
, const void * b
, size_t l
, int f
, const struct sockaddr
* t
, socklen_t tl
)
660 if ((result
= ::sendto(_get_osfhandle(s
), (char *)b
, l
, f
, t
, tl
)) == SOCKET_ERROR
) {
661 errno
= WSAGetLastError();
666 #define sendto(a,b,l,f,t,n) Squid::sendto(a,b,l,f,t,n)
669 setsockopt(SOCKET s
, int l
, int o
, const void * v
, socklen_t n
)
673 socket
= ((s
== INVALID_SOCKET
) ? s
: (SOCKET
)_get_osfhandle((int)s
));
675 if (::setsockopt(socket
, l
, o
, (const char *)v
, n
) == SOCKET_ERROR
) {
676 errno
= WSAGetLastError();
681 #define setsockopt(s,l,o,v,n) Squid::setsockopt(s,l,o,v,n)
684 shutdown(int s
, int h
)
686 if (::shutdown(_get_osfhandle(s
),h
) == SOCKET_ERROR
) {
687 errno
= WSAGetLastError();
692 #define shutdown(s,h) Squid::shutdown(s,h)
695 socket(int f
, int t
, int p
)
698 if ((result
= ::socket(f
, t
, p
)) == INVALID_SOCKET
) {
699 if (WSAEMFILE
== (errno
= WSAGetLastError()))
703 return _open_osfhandle(result
, 0);
705 #define socket(f,t,p) Squid::socket(f,t,p)
710 return _pipe(pipefd
,4096,_O_BINARY
);
712 #define pipe(a) Squid::pipe(a)
715 WSAAsyncSelect(int s
, HWND h
, unsigned int w
, long e
)
717 if (::WSAAsyncSelect(_get_osfhandle(s
), h
, w
, e
) == SOCKET_ERROR
) {
718 errno
= WSAGetLastError();
724 #undef WSADuplicateSocket
726 WSADuplicateSocket(int s
, DWORD n
, LPWSAPROTOCOL_INFO l
)
729 if (::WSADuplicateSocketW(_get_osfhandle(s
), n
, l
) == SOCKET_ERROR
) {
731 if (::WSADuplicateSocketA(_get_osfhandle(s
), n
, l
) == SOCKET_ERROR
) {
733 errno
= WSAGetLastError();
741 WSASocket(int a
, int t
, int p
, LPWSAPROTOCOL_INFO i
, GROUP g
, DWORD f
)
745 if ((result
= ::WSASocketW(a
, t
, p
, i
, g
, f
)) == INVALID_SOCKET
) {
747 if ((result
= ::WSASocketA(a
, t
, p
, i
, g
, f
)) == INVALID_SOCKET
) {
749 if (WSAEMFILE
== (errno
= WSAGetLastError()))
753 return _open_osfhandle(result
, 0);
756 } /* namespace Squid */
758 #else /* #ifdef __cplusplus */
759 #define connect(s,n,l) \
760 (SOCKET_ERROR == connect(_get_osfhandle(s),n,l) ? \
761 (WSAEMFILE == (errno = WSAGetLastError()) ? errno = EMFILE : -1, -1) : 0)
762 #define gethostbyname(n) \
763 (NULL == ((HOSTENT FAR*)(ws32_result = (int)gethostbyname(n))) ? \
764 (errno = WSAGetLastError()), (HOSTENT FAR*)NULL : (HOSTENT FAR*)ws32_result)
765 #define gethostname(n,l) \
766 (SOCKET_ERROR == gethostname(n,l) ? \
767 (errno = WSAGetLastError()), -1 : 0)
768 #define recv(s,b,l,f) \
769 (SOCKET_ERROR == (ws32_result = recv(_get_osfhandle(s),b,l,f)) ? \
770 (errno = WSAGetLastError()), -1 : ws32_result)
771 #define sendto(s,b,l,f,t,tl) \
772 (SOCKET_ERROR == (ws32_result = sendto(_get_osfhandle(s),b,l,f,t,tl)) ? \
773 (errno = WSAGetLastError()), -1 : ws32_result)
774 #define select(n,r,w,e,t) \
775 (SOCKET_ERROR == (ws32_result = select(n,r,w,e,t)) ? \
776 (errno = WSAGetLastError()), -1 : ws32_result)
777 #define socket(f,t,p) \
778 (INVALID_SOCKET == ((SOCKET)(ws32_result = (int)socket(f,t,p))) ? \
779 ((WSAEMFILE == (errno = WSAGetLastError()) ? errno = EMFILE : -1), -1) : \
780 (SOCKET)_open_osfhandle(ws32_result,0))
781 #define write _write /* Needed in util.c */
782 #define open _open /* Needed in win32lib.c */
783 #endif /* #ifdef __cplusplus */
785 #if HAVE_SYS_RESOURCE_H
786 #include <sys/resource.h>
788 #define RUSAGE_SELF 0 /* calling process */
789 #define RUSAGE_CHILDREN -1 /* terminated child processes */
792 struct timeval ru_utime
; /* user time used */
793 struct timeval ru_stime
; /* system time used */
794 long ru_maxrss
; /* integral max resident set size */
795 long ru_ixrss
; /* integral shared text memory size */
796 long ru_idrss
; /* integral unshared data size */
797 long ru_isrss
; /* integral unshared stack size */
798 long ru_minflt
; /* page reclaims */
799 long ru_majflt
; /* page faults */
800 long ru_nswap
; /* swaps */
801 long ru_inblock
; /* block input operations */
802 long ru_oublock
; /* block output operations */
803 long ru_msgsnd
; /* messages sent */
804 long ru_msgrcv
; /* messages received */
805 long ru_nsignals
; /* signals received */
806 long ru_nvcsw
; /* voluntary context switches */
807 long ru_nivcsw
; /* involuntary context switches */
809 #endif /* HAVE_SYS_RESOURCE_H */
813 SQUIDCEXTERN
int chroot(const char *dirname
);
814 SQUIDCEXTERN
int kill(pid_t
, int);
816 SQUIDCEXTERN
int statfs(const char *, struct statfs
*);
818 SQUIDCEXTERN
struct passwd
* getpwnam(char *unused
);
819 SQUIDCEXTERN
struct group
* getgrnam(char *unused
);
862 /* for some reason autoconf misdetects getpagesize.. */
863 #if HAVE_GETPAGESIZE && _SQUID_MINGW_
864 #undef HAVE_GETPAGESIZE
867 #if !HAVE_GETPAGESIZE
868 /* And now we define a compatibility layer */
869 size_t getpagesize();
870 #define HAVE_GETPAGESIZE 2
873 SQUIDCEXTERN
void WIN32_ExceptionHandlerInit(void);
874 SQUIDCEXTERN
int Win32__WSAFDIsSet(int fd
, fd_set
* set
);
875 SQUIDCEXTERN DWORD
WIN32_IpAddrChangeMonitorInit();
877 /* gcc doesn't recognize the Windows native 64 bit formatting tags causing
878 * the compile fail, so we must disable the check on native Windows.
881 #define PRINTF_FORMAT_ARG1
882 #define PRINTF_FORMAT_ARG2
883 #define PRINTF_FORMAT_ARG3
886 /* XXX: the logic around this is a bit warped:
887 * we #define ACL unconditionally at the top of this file,
888 * then #undef ACL unconditionally hafway down,
889 * then here re-define ACL to the same value as at the top,
890 * then include windows.h and #undef ACL again.
893 #define ACL WindowsACL
894 #define _MSWIN_ACL_WAS_NOT_DEFINED 1
897 #if _MSWIN_ACL_WAS_NOT_DEFINED
899 #undef _MSWIN_ACL_WAS_NOT_DEFINED
903 /* syslog compatibility layer derives from git */
909 #define LOG_WARNING 4
913 #define LOG_DAEMON (3<<3)
915 void openlog(const char *ident
, int logopt
, int facility
);
916 void syslog(int priority
, const char *fmt
, ...);
920 /* MinGW missing bits from sys/wait.h */
921 /* A status looks like:
922 * <2 bytes info> <2 bytes code>
924 * <code> == 0, child has exited, info is the exit value
925 * <code> == 1..7e, child has exited, info is the signal number.
926 * <code> == 7f, child has stopped, info was the signal number.
927 * <code> == 80, there was a core dump.
929 #define WIFEXITED(w) (((w) & 0xff) == 0)
930 #define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f))
931 #define WIFSTOPPED(w) (((w) & 0xff) == 0x7f)
932 #define WEXITSTATUS(w) (((w) >> 8) & 0xff)
933 #define WTERMSIG(w) ((w) & 0x7f)
934 #define WSTOPSIG WEXITSTATUS
938 void WIN32_maperror(unsigned long WIN32_oserrno
);
940 #include "compat/strsep.h"
942 #endif /* _SQUID_WINDOWS_ */
943 #endif /* SQUID_OS_MSWINDOWS_H */