]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
PR:
authorJim Jagielski <jim@apache.org>
Thu, 17 Jan 2002 13:20:51 +0000 (13:20 +0000)
committerJim Jagielski <jim@apache.org>
Thu, 17 Jan 2002 13:20:51 +0000 (13:20 +0000)
Obtained from:
Submitted by: Stipe Tolj <tolj@wapme-systems.de>
Reviewed by:
Add in Stipe's Cygwin changes.... Have not folded in the Cygwin
timeout kill signaling patch yet... waiting for feedback.

Here are the changes:

  * src/include/ap_config.h: adding HAVE_PTHREAD_SERIALIZED_ACCEPT to
Cygwin block and defaulting to it.

  * src/main/http_main.c: exluding pthread_mutexattr_setpshared() call
for Cygwin platform. This calls seems yet not fully functional on this
platform. Forwarding problem to Cygwin core developers.

  * src/Configure: changed OS_MODULE_INCLUDE var for the Cygwin
platform block to refer to the (absolute) relative path for the
Makefile.Cygwin file.

  * src/modules/proxy/Makefile.tmpl: target libproxy.dll is hardcoded
for OS/2. That's not good. We have the same target on Cygwin, but use
other calls for it, so if construct here.

  * src/modules/standard/Makefile.Cygwin: adding a dummy target %.def
: %.c to satisfy OS/2 related dependacies on Cygwin too. Changed the
"run make twice" screen slightly.

  * src/Configuration.tmpl: added rule CYGWIN_WINSOCK=no

  * src/Configure: added loading of rule CYGWIN_WINSOCK and Cygwin
platform block specific if statement to include libwsock32.a lib for
Cygwin.

  * src/main/buff.c: added a couple of #define add-ons for
CYGWIN_WINSOCK

  * src/main/http_main.c: added two #defines for CYGWIN_WINSOCK and
compilation flag information output if set at configure time.

  * src/os/cygwin/os.h: added required #defines for CYGWIN_WINSOCK and
declarations for Win32 native calls.

Also a patch against current 1.3 cvs tree to fix the detection
of the gdbm library for the Cygwin platform to support dbm-enabled
mod_rewrite.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@92888 13f79535-47bb-0310-9956-ffa450edef68

src/CHANGES
src/Configuration.tmpl
src/Configure
src/helpers/find-dbm-lib
src/include/ap_config.h
src/main/buff.c
src/main/http_main.c
src/modules/proxy/Makefile.tmpl
src/modules/standard/Makefile.Cygwin
src/os/cygwin/os.h

index 188dc086006908cde2c9cddf9a22a9f9ebd0a5ec..5659c6bcb5ca46542fd8c4337fb3f0a07ccfc9c8 100644 (file)
@@ -1,5 +1,13 @@
 Changes with Apache 1.3.23
 
+  *) PORT: Numerous additions to Cygwin, including: defaulting
+     to Posix thread accept mutex, excluding the call to
+     pthread_mutexattr_setpshared(), better proxy and DBM support, and
+     allowing the use of native Win32 socket ops instead of
+     Cygwin's Posix wrapper (for better performance). The last
+     item required the addition of a new Configure Rule: CYGWIN_WINSOCK.
+     [Stipe Tolj <tolj@wapme-systems.de>]
+
   *) Use "httpready" accept filter rather than "dataready" on
      FreeBSD after 4.1.1-RELEASE where it works correctly.
      [Tony Finch]
index 9ee79f94b3623b3b19032041538b581ea5b2f36f..7ec60b640d0d819e1a2d165a08990a57ed88efd8 100644 (file)
@@ -173,6 +173,13 @@ Rule SHARED_CHAIN=default
 #  Rule EXPAT=default   : If Expat can be found at the system or
 #                         in lib/expat-lite, use it; otherwise
 #                         skip it
+# 
+# CYGWIN_WINSOCK: 
+#  Use Win32 API system calls for socket communication instead 
+#  of Cygwin's POSIX.1 wrappers. This avoids the Cygwin specific
+#  implementation and uses the Win32 native calls. Should be faster
+#  and more reliable for high-load systems.  
+# 
 
 Rule SOCKS4=no
 Rule SOCKS5=no
@@ -180,6 +187,7 @@ Rule IRIXNIS=no
 Rule IRIXN32=yes
 Rule PARANOID=no
 Rule EXPAT=default
+Rule CYGWIN_WINSOCK=no 
 
 # DEV_RANDOM:
 #  Note: this rule is only used when compiling mod_auth_digest.
index 94289ce44f0b861d9ed976bc33e1cd766b8c2432..11c4e941e835bfb85a1cc8ca92ef7158880cb6cc 100755 (executable)
@@ -235,6 +235,7 @@ RULE_IRIXNIS=`./helpers/CutRule IRIXNIS $file`
 RULE_IRIXN32=`./helpers/CutRule IRIXN32 $file`
 RULE_PARANOID=`./helpers/CutRule PARANOID $file`
 RULE_EXPAT=`./helpers/CutRule EXPAT $file`
+RULE_CYGWIN_WINSOCK=`./helpers/CutRule CYGWIN_WINSOCK $file` 
 RULE_SHARED_CORE=`./helpers/CutRule SHARED_CORE $file`
 RULE_SHARED_CHAIN=`./helpers/CutRule SHARED_CHAIN $file`
 
@@ -849,6 +850,11 @@ case "$PLAT" in
        DEF_WANTHSREGEX=yes
        DBM_LIB="-lgdbm"
        LIBS="$LIBS -lcrypt $DBM_LIB"
+       if [ "x$RULE_CYGWIN_WINSOCK" = "xyes" ]; then 
+           CFLAGS="$CFLAGS -DCYGWIN_WINSOCK" 
+           LIBS="$LIBS -lwsock32" 
+       fi 
+
        ;;
     *atheos*)
        DEF_WANTSREGEX=yes
@@ -1419,7 +1425,7 @@ if [ "x$using_shlib" = "x1" ] ; then
            LIBS_SHLIB='$(EXTRA_LIBS)'
            SHARED_CORE_EP='lib$(TARGET).ep'
            SHCORE_IMPLIB='lib$(TARGET).dll'
-           OS_MODULE_INCLUDE='Makefile.Cygwin'
+           OS_MODULE_INCLUDE='$(SRCDIR)/modules/standard/Makefile.Cygwin'
            ;;
        *)
            ##  ok, no known explict support for shared objects
index 4ec265b326c46c4fa3d641e0e2c53b08f16f79ee..5f66b4aba3217eafe3353fcdfc57283d76d87eaa 100644 (file)
@@ -31,6 +31,15 @@ if [ "x$found_dbm" = "x" ]; then
                    found_dbm=1
                fi
                ;;
+        *-cygwin*)
+        # we use the shared DLL version of gdbm if available
+        DBM_LIB=""
+        if ./helpers/TestCompile lib gdbm dbm_open; then
+            DBM_LIB="-lgdbm"
+            LIBS="$LIBS $DBM_LIB"
+            found_dbm=1
+        fi
+        ;;
            *)
                if [ "x$DBM_LIB" != "x" ]; then
                    oldLIBS="$LIBS"
index daeccae76570da8a265b261148bb060490e93ff0..0a956b1a636814411a641e3c4746d023b1eab554 100644 (file)
@@ -1012,7 +1012,11 @@ typedef int rlim_t;
 #define USE_MMAP_FILES
 #define HAVE_SYSLOG 1
 #define HAVE_FCNTL_SERIALIZED_ACCEPT
+#define HAVE_PTHREAD_SERIALIZED_ACCEPT
 #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
+#if !defined(USE_FNCTL_SERIALIZED_ACCEPT)
+#define USE_PTHREAD_SERIALIZED_ACCEPT
+#endif
 
 
 #else
index b2bb81f37f810aea5b5c1b9addceecff9366c67f..55346597c68f32109af7ce619263fd6be5c4ca3a 100644 (file)
  * futher I/O will be done
  */
 
-#if defined(WIN32) || defined(NETWARE)
+#if defined(WIN32) || defined(NETWARE) || defined(CYGWIN_WINSOCK) 
 
 /*
   select() sometimes returns 1 even though the write will block. We must work around this.
@@ -282,7 +282,7 @@ static ap_inline int buff_read(BUFF *fb, void *buf, int nbyte)
 {
     int rv;
 
-#if defined (WIN32) || defined(NETWARE)
+#if defined (WIN32) || defined(NETWARE) || defined(CYGWIN_WINSOCK) 
     if (fb->flags & B_SOCKET) {
        rv = recvwithtimeout(fb->fd_in, buf, nbyte, 0);
        if (rv == SOCKET_ERROR)
@@ -1477,7 +1477,7 @@ API_EXPORT(int) ap_bclose(BUFF *fb)
        rc1 = ap_bflush(fb);
     else
        rc1 = 0;
-#if defined(WIN32) || defined(NETWARE)
+#if defined(WIN32) || defined(NETWARE) || defined(CYGWIN_WINSOCK) 
     if (fb->flags & B_SOCKET) {
        rc2 = ap_pclosesocket(fb->pool, fb->fd);
        if (fb->fd_in != fb->fd) {
@@ -1487,7 +1487,7 @@ API_EXPORT(int) ap_bclose(BUFF *fb)
            rc3 = 0;
        }
     }
-#ifndef NETWARE
+#if !defined(NETWARE) && !defined(CYGWIN_WINSOCK) 
     else if (fb->hFH != INVALID_HANDLE_VALUE) {
         rc2 = ap_pcloseh(fb->pool, fb->hFH);
         rc3 = 0;
@@ -1512,7 +1512,7 @@ API_EXPORT(int) ap_bclose(BUFF *fb)
        else {
            rc3 = 0;
        }
-#if defined(WIN32) || defined (BEOS) || defined(NETWARE)
+#if defined(WIN32) || defined (BEOS) || defined(NETWARE) || defined(CYGWIN_WINSOCK) 
     }
 #endif
 
index 14ed577e58b5fbb14574bee9f19318c2da370162..debb1fb752a3853c7e366cd0cc16a410be81f3a1 100644 (file)
@@ -662,11 +662,16 @@ static void accept_mutex_init_pthread(pool *p)
        perror("pthread_mutexattr_init");
        exit(APEXIT_INIT);
     }
+#if !defined(CYGWIN)
+    /* Cygwin has problems with this pthread call claiming that these 
+     * are "Invalid arguements", Stipe Tolj <tolj@wapme-systems.de>
+     */
     if ((errno = pthread_mutexattr_setpshared(&mattr,
                                                PTHREAD_PROCESS_SHARED))) {
        perror("pthread_mutexattr_setpshared");
        exit(APEXIT_INIT);
     }
+#endif
     if ((errno = pthread_mutex_init(accept_mutex, &mattr))) {
        perror("pthread_mutex_init");
        exit(APEXIT_INIT);
@@ -1564,7 +1569,7 @@ API_EXPORT(void) ap_unblock_alarms(void)
 #ifndef NETWARE
 static APACHE_TLS void (*volatile alarm_fn) (int) = NULL;
 #endif
-#ifdef WIN32
+#if defined(WIN32) || defined(CYGWIN_WINSOCK) 
 static APACHE_TLS unsigned int alarm_expiry_time = 0;
 #endif /* WIN32 */
 
@@ -1624,7 +1629,7 @@ API_EXPORT_NONSTD(unsigned int) ap_set_callback_and_alarm(void (*fn) (int), int
 }
 
 
-#if defined(WIN32) || defined(NETWARE)
+#if defined(WIN32) || defined(NETWARE) || defined(CYGWIN_WINSOCK) 
 API_EXPORT(int) ap_check_alarm(void)
 {
 #ifdef NETWARE
@@ -4067,6 +4072,9 @@ static void show_compile_settings(void)
 #ifdef AP_ACCEPTFILTER_OFF
     printf(" -D AP_ACCEPTFILTER_OFF\n");
 #endif
+#ifdef CYGWIN_WINSOCK 
+    printf(" -D CYGWIN_WINSOCK\n"); 
+#endif 
 
 /* This list displays the compiled-in default paths: */
 #ifdef HTTPD_ROOT
index 07dfb7eedf6ff1c1e2b2bbbdbcc9ff7300240e51..f721914b57c112ddcd8eb1203747b280d2341a93 100644 (file)
@@ -21,10 +21,18 @@ libproxy.so: $(OBJS_PIC)
        rm -f $@
        $(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(OBJS_PIC) $(LIBS_SHLIB)
 
-libproxy.dll: $(OBJS_PIC) mod_proxy.def
-       $(LD_SHLIB) $(LDFLAGS_SHLIB) -o $* $(OBJS_PIC) $(LIBS_SHLIB)
-       emxbind -b -q -s -h0 -dmod_proxy.def $* && \
-       rm $*
+libproxy.dll: $(OBJS_PIC) mod_proxy.def 
+       if [ "x$(OS)" = "xCygwin" ]; then \
+           rm -f $@; \
+           if [ -f "$(SRCDIR)/$(SHCORE_IMPLIB)" ]; then \
+           $(LD_SHLIB) $(LDFLAGS_SHLIB) -o $*.dll $(OBJS_PIC) $(LIBS_SHLIB) \
+           $(SRCDIR)/$(SHCORE_IMPLIB) $(LIBS1); \
+           fi \
+       else \
+           $(LD_SHLIB) $(LDFLAGS_SHLIB) -o $* $(OBJS_PIC) $(LIBS_SHLIB); \
+           emxbind -b -q -s -h0 -dmod_proxy.def $* && \
+           rm $*; \
+       fi
 
 .SUFFIXES: .o .lo .dll
 
index af4d5e275421b805a7d82f67e8bdea73d08fe5e1..61ac32af916c3421c4eabe45e37fc0ebeed1cbec 100644 (file)
@@ -28,23 +28,30 @@ define shared_dll
         $(SRCDIR)/$(SHCORE_IMPLIB) $(LIBS1)
 endef
 
+%.def : %.c
+       touch $*.def
+
 %.lo : %.c
        $(CC) -c $(INCLUDES) $(CFLAGS) $(CFLAGS_SHLIB) $< && mv $*.o $*.lo
 
 %.dll : %.lo
        @if [ -f "$(SRCDIR)/$(SHCORE_IMPLIB)" ]; then \
+        rm -f $(SRCDIR)/$(SHCORE_IMPLIB).$$; \
         echo $(shared_dll); \
                $(shared_dll); \
        else \
-           echo "+--------------------------------------------------------+"; \
-               echo "| There is no shared core 'libhttpd.dll' available!      |"; \
-               echo "|                                                        |"; \
-               echo "| This is obviously your first 'make' run with configure |"; \
-               echo "| flag SHARED_CORE enabled and shared modules.           |"; \
-               echo "|                                                        |"; \
-               echo "| You will have to re-run 'make' after this run builds   |"; \
-               echo "| the required shared import library!                    |"; \
-           echo "+--------------------------------------------------------+"; \
-        sleep 10; \
+        if [ ! -f "$(SRCDIR)/$(SHCORE_IMPLIB).$$" ]; then \
+             echo "+--------------------------------------------------------+"; \
+                 echo "| There is no shared core 'libhttpd.dll' available!      |"; \
+                 echo "|                                                        |"; \
+                 echo "| This is obviously your first 'make' run with configure |"; \
+                 echo "| flag SHARED_CORE enabled and shared modules.           |"; \
+                 echo "|                                                        |"; \
+                 echo "| You will have to re-run 'make' after this run builds   |"; \
+                 echo "| the required shared import library!                    |"; \
+                 echo "+--------------------------------------------------------+"; \
+                 sleep 10; \
+          touch $(SRCDIR)/$(SHCORE_IMPLIB).$$; \
+        fi; \
        fi;
 
index 133d9244e53cc1e15dd1ca070fec1d0545449e96..3a0d7e01bb324696c2a49316a2af24d6e04bf69c 100644 (file)
 #define PLATFORM "Cygwin"
 #endif
 
+/* 
+ * Define winsock.h and winsock2.h stuff taken from Win32 API in case we  
+ * want to do socket communication in Win32 native way rather then using 
+ * Cygwin's POSIX wrapper to the native ones. These are needed for 
+ * main/buff.c and main/http_main.c. They are linked against libwsock32.a 
+ * for the import declarations of the corresponding Win32 native DLLs. 
+ */ 
+#ifdef CYGWIN_WINSOCK 
+#define WSAEWOULDBLOCK (10035) 
+#define SOCKET_ERROR (-1) 
+#define WIN32API_IMPORT(type)  __declspec(dllimport) type __stdcall 
+WIN32API_IMPORT(int) WSAGetLastError(void); 
+WIN32API_IMPORT(int) WSASetLastError(int); 
+WIN32API_IMPORT(int) ioctlsocket(unsigned int, long, unsigned long *); 
+WIN32API_IMPORT(void) Sleep(unsigned int); 
+#endif /* CYGWIN_WINSOCK */ 
+
 /*
  * This file in included in all Apache source code. It contains definitions
  * of facilities available on _this_ operating system (HAVE_* macros),