From: Francesco Chemolli Date: Sun, 29 Jan 2012 22:30:16 +0000 (+0100) Subject: Fixed more windows emulation stuff. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b73b74927387d1a3d9cf3760a2a4e0c5c17e26d3;p=thirdparty%2Fsquid.git Fixed more windows emulation stuff. Unfortunately the availability of som eAPI require targeting WinXP or later. --- diff --git a/acinclude/os-deps.m4 b/acinclude/os-deps.m4 index 3c8ace52d9..1b4e606aae 100644 --- a/acinclude/os-deps.m4 +++ b/acinclude/os-deps.m4 @@ -242,11 +242,10 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #if HAVE_SYS_TYPES_H #include #endif -#if HAVE_WINSOCK_H -#include -#endif #if HAVE_WINSOCK2_H #include +#elif HAVE_WINSOCK_H +#include #endif int main(int argc, char **argv) { FILE *fp = fopen("conftestval", "w"); @@ -422,11 +421,10 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #if HAVE_NETINET_IN_H #include #endif -#if HAVE_WINSOCK_H -#include -#endif #if HAVE_WINSOCK2_H #include +#elif HAVE_WINSOCK_H +#include #endif int main(int argc, char **argv) { @@ -473,11 +471,10 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #if HAVE_NETINET_IN_H #include #endif -#if HAVE_WINSOCK_H -#include -#endif #if HAVE_WINSOCK2_H #include +#elif HAVE_WINSOCK_H +#include #endif int main(int argc, char **argv) { @@ -524,11 +521,10 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #if HAVE_NETINET_IN_H #include #endif -#if HAVE_WINSOCK_H -#include -#endif #if HAVE_WINSOCK2_H #include +#elif HAVE_WINSOCK_H +#include #endif int main(int argc, char **argv) { @@ -579,11 +575,10 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #if HAVE_NETINET_IN_H #include #endif -#if HAVE_WINSOCK_H -#include -#endif #if HAVE_WINSOCK2_H #include +#elif HAVE_WINSOCK_H +#include #endif int main(int argc, char **argv) { @@ -885,8 +880,7 @@ AC_DEFUN([SQUID_CHECK_RECV_ARG_TYPE],[ #endif #if HAVE_WINSOCK2_H #include -#endif -#if HAVE_WINSOCK_H +#elif HAVE_WINSOCK_H #include #endif int main (int argc, char ** argv) { diff --git a/compat/os/mswin.h b/compat/os/mswin.h index a3ff36daad..3a94b307be 100644 --- a/compat/os/mswin.h +++ b/compat/os/mswin.h @@ -36,6 +36,16 @@ #if _SQUID_WINDOWS_ +/* we target Windows XP and later - some API are missing otherwise */ +#if _SQUID_MINGW_ +#if WINVER < 0x0501 +#undef WINVER +#define WINVER 0x0501 +#undef _WIN32_WINNT +#define _WIN32_WINNT WINVER +#endif +#endif /* _SQUID_MINGW_ */ + #if HAVE_FCNTL_H #include #endif /* HAVE_FCNTL_H */ @@ -794,14 +804,46 @@ SQUIDCEXTERN int statfs(const char *, struct statfs *); SQUIDCEXTERN struct passwd * getpwnam(char *unused); SQUIDCEXTERN struct group * getgrnam(char *unused); -#define geteuid(X) static_cast(100) -#define seteuid(X) (void)0 -#define getuid(X) static_cast(100) -#define setuid(X) (void)0 -#define getegid(X) static_cast(100) -#define setegid(X) (void)0 -#define getgid(X) static_cast(100) -#define setgid(X) (void)0 +static inline uid_t +geteuid(void) +{ + return 100; +} +static inline int +seteuid (uid_t euid) +{ + return 0; +} +static inline uid_t +getuid(void) +{ + return 100; +} +static inline int +setuid (uid_t uid) +{ + return 0; +} +static inline gid_t +getegid(void) +{ + return 100; +} +static inline int +setegid (gid_t egid) +{ + return 0; +} +static inline int +getgid(void) +{ + return 100; +} +static inline int +setgid (gid_t gid) +{ + return 0; +} /* for some reason autoconf misdetects getpagesize.. */ #if HAVE_GETPAGESIZE diff --git a/src/ip/Address.h b/src/ip/Address.h index eb4f3eb9cc..fdffd54002 100644 --- a/src/ip/Address.h +++ b/src/ip/Address.h @@ -48,8 +48,7 @@ #endif #if HAVE_WINSOCK2_H #include -#endif -#if HAVE_WINSOCK_H +#elif HAVE_WINSOCK_H #include #endif #if HAVE_NETDB_H diff --git a/src/tools.cc b/src/tools.cc index 1341167810..cad86adf52 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -34,6 +34,7 @@ #include "squid-old.h" #include "base/Subscription.h" +#include "compat/initgroups.h" #include "fde.h" #include "ICP.h" #include "ip/Intercept.h" diff --git a/tools/purge/convert.hh b/tools/purge/convert.hh index 05e59b3783..7725a88376 100644 --- a/tools/purge/convert.hh +++ b/tools/purge/convert.hh @@ -60,8 +60,7 @@ typedef char bool; #endif #if HAVE_WINSOCK2_H #include -#endif -#if HAVE_WINSOCK_H +#elif HAVE_WINSOCK_H #include #endif