You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2002/01/17 14:20:52 UTC
cvs commit: apache-1.3/src/os/cygwin os.h
jim 02/01/17 05:20:51
Modified: src CHANGES Configuration.tmpl Configure
src/helpers find-dbm-lib
src/include ap_config.h
src/main buff.c http_main.c
src/modules/proxy Makefile.tmpl
src/modules/standard Makefile.Cygwin
src/os/cygwin os.h
Log:
Submitted by: Stipe Tolj <to...@wapme-systems.de>
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.
Revision Changes Path
1.1753 +8 -0 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1752
retrieving revision 1.1753
diff -u -r1.1752 -r1.1753
--- CHANGES 14 Jan 2002 04:49:44 -0000 1.1752
+++ CHANGES 17 Jan 2002 13:20:50 -0000 1.1753
@@ -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 <to...@wapme-systems.de>]
+
*) Use "httpready" accept filter rather than "dataready" on
FreeBSD after 4.1.1-RELEASE where it works correctly.
[Tony Finch]
1.128 +8 -0 apache-1.3/src/Configuration.tmpl
Index: Configuration.tmpl
===================================================================
RCS file: /home/cvs/apache-1.3/src/Configuration.tmpl,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -r1.127 -r1.128
--- Configuration.tmpl 8 Oct 2001 17:52:11 -0000 1.127
+++ Configuration.tmpl 17 Jan 2002 13:20:50 -0000 1.128
@@ -173,6 +173,13 @@
# 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 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.
1.446 +7 -1 apache-1.3/src/Configure
Index: Configure
===================================================================
RCS file: /home/cvs/apache-1.3/src/Configure,v
retrieving revision 1.445
retrieving revision 1.446
diff -u -r1.445 -r1.446
--- Configure 26 Nov 2001 08:07:17 -0000 1.445
+++ Configure 17 Jan 2002 13:20:50 -0000 1.446
@@ -235,6 +235,7 @@
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 @@
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 @@
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
1.12 +9 -0 apache-1.3/src/helpers/find-dbm-lib
Index: find-dbm-lib
===================================================================
RCS file: /home/cvs/apache-1.3/src/helpers/find-dbm-lib,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- find-dbm-lib 21 Mar 2001 03:09:45 -0000 1.11
+++ find-dbm-lib 17 Jan 2002 13:20:51 -0000 1.12
@@ -31,6 +31,15 @@
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"
1.321 +4 -0 apache-1.3/src/include/ap_config.h
Index: ap_config.h
===================================================================
RCS file: /home/cvs/apache-1.3/src/include/ap_config.h,v
retrieving revision 1.320
retrieving revision 1.321
diff -u -r1.320 -r1.321
--- ap_config.h 16 Nov 2001 01:32:20 -0000 1.320
+++ ap_config.h 17 Jan 2002 13:20:51 -0000 1.321
@@ -1012,7 +1012,11 @@
#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
1.105 +5 -5 apache-1.3/src/main/buff.c
Index: buff.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/buff.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- buff.c 28 Dec 2001 05:03:07 -0000 1.104
+++ buff.c 17 Jan 2002 13:20:51 -0000 1.105
@@ -122,7 +122,7 @@
* 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 @@
{
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 @@
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 @@
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 @@
else {
rc3 = 0;
}
-#if defined(WIN32) || defined (BEOS) || defined(NETWARE)
+#if defined(WIN32) || defined (BEOS) || defined(NETWARE) || defined(CYGWIN_WINSOCK)
}
#endif
1.570 +10 -2 apache-1.3/src/main/http_main.c
Index: http_main.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v
retrieving revision 1.569
retrieving revision 1.570
diff -u -r1.569 -r1.570
--- http_main.c 16 Jan 2002 19:36:23 -0000 1.569
+++ http_main.c 17 Jan 2002 13:20:51 -0000 1.570
@@ -662,11 +662,16 @@
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 <to...@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 @@
#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 @@
}
-#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 @@
#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
1.28 +12 -4 apache-1.3/src/modules/proxy/Makefile.tmpl
Index: Makefile.tmpl
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/proxy/Makefile.tmpl,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- Makefile.tmpl 22 Jun 2000 23:22:35 -0000 1.27
+++ Makefile.tmpl 17 Jan 2002 13:20:51 -0000 1.28
@@ -21,10 +21,18 @@
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
1.2 +17 -10 apache-1.3/src/modules/standard/Makefile.Cygwin
Index: Makefile.Cygwin
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/standard/Makefile.Cygwin,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile.Cygwin 28 Sep 2001 11:29:02 -0000 1.1
+++ Makefile.Cygwin 17 Jan 2002 13:20:51 -0000 1.2
@@ -28,23 +28,30 @@
$(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;
1.4 +19 -0 apache-1.3/src/os/cygwin/os.h
Index: os.h
===================================================================
RCS file: /home/cvs/apache-1.3/src/os/cygwin/os.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- os.h 27 Sep 2001 18:12:04 -0000 1.3
+++ os.h 17 Jan 2002 13:20:51 -0000 1.4
@@ -88,6 +88,25 @@
#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),
Re: cvs commit: apache-1.3/src/os/cygwin os.h
Posted by Jeff Trawick <tr...@attglobal.net>.
jim@apache.org writes:
> Index: http_main.c
> ===================================================================
> RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v
> retrieving revision 1.569
> retrieving revision 1.570
> diff -u -r1.569 -r1.570
> --- http_main.c 16 Jan 2002 19:36:23 -0000 1.569
> +++ http_main.c 17 Jan 2002 13:20:51 -0000 1.570
> @@ -662,11 +662,16 @@
> 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 <to...@wapme-systems.de>
> + */
> if ((errno = pthread_mutexattr_setpshared(&mattr,
> PTHREAD_PROCESS_SHARED))) {
> perror("pthread_mutexattr_setpshared");
> exit(APEXIT_INIT);
> }
> +#endif
Isn't this what I veto-ed yesterday until Stipe can answer a question
I had? (answer: "yes") I thought I made a very simple, fair request.
See the message <m3...@rdu163-40-092.nc.rr.com>.
The answer to my question needs to be clarified in the comments.
Spell-checking would be nice too, though I wouldn't consider that a
requirement for removing the veto :)
--
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
http://www.geocities.com/SiliconValley/Park/9289/
Born in Roswell... married an alien...
Re: cvs commit: apache-1.3/src/os/cygwin os.h
Posted by Jeff Trawick <tr...@attglobal.net>.
jim@apache.org writes:
> Index: http_main.c
> ===================================================================
> RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v
> retrieving revision 1.569
> retrieving revision 1.570
> diff -u -r1.569 -r1.570
> --- http_main.c 16 Jan 2002 19:36:23 -0000 1.569
> +++ http_main.c 17 Jan 2002 13:20:51 -0000 1.570
> @@ -662,11 +662,16 @@
> 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 <to...@wapme-systems.de>
> + */
> if ((errno = pthread_mutexattr_setpshared(&mattr,
> PTHREAD_PROCESS_SHARED))) {
> perror("pthread_mutexattr_setpshared");
> exit(APEXIT_INIT);
> }
> +#endif
Isn't this what I veto-ed yesterday until Stipe can answer a question
I had? (answer: "yes") I thought I made a very simple, fair request.
See the message <m3...@rdu163-40-092.nc.rr.com>.
The answer to my question needs to be clarified in the comments.
Spell-checking would be nice too, though I wouldn't consider that a
requirement for removing the veto :)
--
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
http://www.geocities.com/SiliconValley/Park/9289/
Born in Roswell... married an alien...