cvs commit: apache-1.3/src/os/win32 modules.c
manoj 98/07/20 17:07:00 Modified:src/os/win32 modules.c Log: Correcting misleading comment about manually editing this file Revision ChangesPath 1.9 +3 -2 apache-1.3/src/os/win32/modules.c Index: modules.c === RCS file: /export/home/cvs/apache-1.3/src/os/win32/modules.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- modules.c 1998/04/11 12:01:06 1.8 +++ modules.c 1998/07/21 00:06:59 1.9 @@ -1,5 +1,6 @@ -/* modules.c --- automatically generated by Apache - * configuration script. DO NOT HAND EDIT! +/* modules.c --- major modules compiled into Apache for Win32. + * Only insert an entry for a module if it must be compiled into + * the core server */ #include "httpd.h"
cvs commit: apache-1.3/conf mime.types
manoj 98/09/07 00:17:35 Modified:conf mime.types Log: Adding XML MIME types from RFC 2376 Revision ChangesPath 1.16 +1 -0 apache-1.3/conf/mime.types Index: mime.types === RCS file: /export/home/cvs/apache-1.3/conf/mime.types,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- mime.types1998/08/21 03:13:35 1.15 +++ mime.types1998/09/07 07:17:35 1.16 @@ -101,6 +101,7 @@ text/tab-separated-valuestsv text/x-setextetx text/x-sgml sgml sgm +text/xml xml dtd video/mpeg mpeg mpg mpe video/quicktime qt mov video/x-msvideo avi
cvs commit: apache-1.3/src/support suexec.c
manoj 98/09/16 13:51:09 Modified:src/support suexec.c Log: Fix a missing semicolon Revision ChangesPath 1.46 +1 -1 apache-1.3/src/support/suexec.c Index: suexec.c === RCS file: /export/home/cvs/apache-1.3/src/support/suexec.c,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- suexec.c 1998/09/10 09:23:59 1.45 +++ suexec.c 1998/09/16 20:51:08 1.46 @@ -211,7 +211,7 @@ sprintf(pathbuf, "PATH=%s", SAFE_PATH); cleanenv[cidx] = strdup(pathbuf); -cidx++ +cidx++; for (ep = environ; *ep && cidx < AP_ENVBUF-1; ep++) { if (!strncmp(*ep, "HTTP_", 5)) {
cvs commit: apache-1.3/src/modules/standard mod_speling.c
manoj 98/09/23 15:42:06 Modified:src CHANGES src/modules/standard mod_speling.c Log: PR: 3052 Reviewed by: Ken Coar <[EMAIL PROTECTED]> Fix mod_speling's handling of multiple matched URLs. Revision ChangesPath 1.1073+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1072 retrieving revision 1.1073 diff -u -r1.1072 -r1.1073 --- CHANGES 1998/09/22 09:19:51 1.1072 +++ CHANGES 1998/09/23 22:42:03 1.1073 @@ -1,5 +1,8 @@ Changes with Apache 1.3.3 + *) Fix mod_speling's handling of multiple matched URLs. + [Manoj Kasichainula] + *) Correct comment in mod_log_config.c about its internals. [Elf Sternberg <[EMAIL PROTECTED]>] 1.27 +4 -0 apache-1.3/src/modules/standard/mod_speling.c Index: mod_speling.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_speling.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- mod_speling.c 1998/09/19 12:16:38 1.26 +++ mod_speling.c 1998/09/23 22:42:05 1.27 @@ -506,6 +506,10 @@ : "Spelling fix: %s: %d candidates", r->uri, candidates->nelts, ref); +/* The log entry above will be sent to the client instead of the + * page we've constructed unless we take it out of error-notes */ +ap_table_unset(r->notes, "error-notes"); + return HTTP_MULTIPLE_CHOICES; } }
cvs commit: apache-1.3/src/modules/standard mod_speling.c
manoj 98/09/25 10:17:55 Modified:src CHANGES src/modules/standard mod_speling.c Log: Undo my earlier hack to override error-notes. The real fix has now been applied. Revision ChangesPath 1.1079+0 -3 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1078 retrieving revision 1.1079 diff -u -r1.1078 -r1.1079 --- CHANGES 1998/09/25 15:26:03 1.1078 +++ CHANGES 1998/09/25 17:17:52 1.1079 @@ -15,9 +15,6 @@ *) PORT: Fix sys/resource.h handling for Amdahl's UTS 2.1 [Dave Dykstra <[EMAIL PROTECTED]>] PR#3054 - *) Fix mod_speling's handling of multiple matched URLs. - [Manoj Kasichainula] - *) Correct comment in mod_log_config.c about its internals. [Elf Sternberg <[EMAIL PROTECTED]>] 1.28 +0 -4 apache-1.3/src/modules/standard/mod_speling.c Index: mod_speling.c === RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_speling.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- mod_speling.c 1998/09/23 22:42:05 1.27 +++ mod_speling.c 1998/09/25 17:17:54 1.28 @@ -506,10 +506,6 @@ : "Spelling fix: %s: %d candidates", r->uri, candidates->nelts, ref); -/* The log entry above will be sent to the client instead of the - * page we've constructed unless we take it out of error-notes */ -ap_table_unset(r->notes, "error-notes"); - return HTTP_MULTIPLE_CHOICES; } }
cvs commit: apache-1.3/conf mime.types
manoj 98/09/30 10:42:06 Modified:conf mime.types Log: PR: 3036 Submitted by: Philipp Hoschka <[EMAIL PROTECTED]> Add MIME type entry for SMIL (Synchronized Multimedia Integration Language) Revision ChangesPath 1.17 +1 -0 apache-1.3/conf/mime.types Index: mime.types === RCS file: /export/home/cvs/apache-1.3/conf/mime.types,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- mime.types1998/09/07 07:17:35 1.16 +++ mime.types1998/09/30 17:42:05 1.17 @@ -26,6 +26,7 @@ application/remote-printing application/rtf rtf application/slate +application/smil smi smil sml application/wita application/wordperfect5.1 application/x-bcpio bcpio
cvs commit: apache-1.3 STATUS
manoj 98/10/27 16:13:31 Modified:.STATUS Log: Add Win32 strftime patch, and remove old scoreboard patch which has been replaced. Revision ChangesPath 1.522 +5 -13 apache-1.3/STATUS Index: STATUS === RCS file: /export/home/cvs/apache-1.3/STATUS,v retrieving revision 1.521 retrieving revision 1.522 diff -u -u -r1.521 -r1.522 --- STATUS1998/10/27 15:19:11 1.521 +++ STATUS1998/10/28 00:13:30 1.522 @@ -69,6 +69,11 @@ Available Patches: +* Manoj and Ken Parzygnat's PATCH to support %-expandos from Unix + on Win32 +Message-ID: <[EMAIL PROTECTED]> +Status: + * Harrie Hazewinkle's PATCH scoreboard to include server_rec * Message-ID: <[EMAIL PROTECTED]> Status: Ralf +1 @@ -93,19 +98,6 @@ Mesage-ID: PR#3246, also available at <http://www.physics.mcgill.ca/~juan/mod_include.patch> Status: Ken -0 for 1.3/+0 for 2.0 - -* Harrie Hazewinkel's PATCH scoreboard - This is a patch that changes the 'vhost'-name (type char [32]) - in the scoreboard into a 'vhost'-number (type int), and then uses a - lookup table to display the server name. -Message-ID: <[EMAIL PROTECTED]> -Status: Roy (untested +1) - Dean -1: I see no need to add a new "virtual host number" to the - server guts... although I can understand why it's nice for - SNMP. However I'd be totally for a patch which places - "server_rec *" into the scoreboard in place of the name - -- because the pointers are valid across parent and - children... why waste the time doing number lookups and such. * Manoj's [PATCH] mime.types update Message-ID: <[EMAIL PROTECTED]>
cvs commit: apache-1.3/conf httpd.conf-dist
manoj 98/10/28 14:04:10 Modified:conf httpd.conf-dist Log: ExtendedStatus cannot be enabled until the status module is loaded, so move the commented directive after DSO modules are loaded. Revision ChangesPath 1.33 +7 -7 apache-1.3/conf/httpd.conf-dist Index: httpd.conf-dist === RCS file: /export/home/cvs/apache-1.3/conf/httpd.conf-dist,v retrieving revision 1.32 retrieving revision 1.33 diff -u -u -r1.32 -r1.33 --- httpd.conf-dist 1998/10/22 20:56:51 1.32 +++ httpd.conf-dist 1998/10/28 22:04:09 1.33 @@ -98,13 +98,6 @@ #AccessConfig conf/access.conf # -# ExtendedStatus controls whether Apache will generate "full" status -# information (ExtendedStatus On) or just basic information (ExtendedStatus -# Off) when the "server-status" handler is called. The default is Off. -# -#ExtendedStatus On - -# # Timeout: The number of seconds before receives and sends time out. # Timeout 300 @@ -202,6 +195,13 @@ # # Example: # LoadModule foo_module libexec/mod_foo.so + +# +# ExtendedStatus controls whether Apache will generate "full" status +# information (ExtendedStatus On) or just basic information (ExtendedStatus +# Off) when the "server-status" handler is called. The default is Off. +# +#ExtendedStatus On ### Section 2: 'Main' server configuration #
cvs commit: apache-1.3/htdocs/manual handler.html
manoj 98/10/29 12:27:14 Modified:htdocs/manual handler.html Log: PR: 2706 Changed references to "/status" to "/server-status". This isn't really necessary, but a user was confused by the difference between the docs and the configuration file, and consistency is a good thing. Revision ChangesPath 1.16 +2 -2 apache-1.3/htdocs/manual/handler.html Index: handler.html === RCS file: /export/home/cvs/apache-1.3/htdocs/manual/handler.html,v retrieving revision 1.15 retrieving revision 1.16 diff -u -u -r1.15 -r1.16 --- handler.html 1998/10/21 05:57:58 1.15 +++ handler.html 1998/10/29 20:27:13 1.16 @@ -137,10 +137,10 @@ SetHandler imap-file Another example: if you wanted to have the server display a status -report whenever a URL of http://servername/status was +report whenever a URL of http://servername/server-status was called, you might put the following into access.conf: -<Location /status> +<Location /server-status> SetHandler server-status </Location>
cvs commit: apache-1.3/src/os/tpf - New directory
manoj 98/11/03 13:50:29 apache-1.3/src/os/tpf - New directory
cvs commit: apache-1.3/src/os/tpf/samples - New directory
manoj 98/11/03 13:50:30 apache-1.3/src/os/tpf/samples - New directory
cvs commit: apache-1.3/src/os/tpf/samples linkdll.jcl loadset.jcl
manoj 98/11/03 14:06:32 Added: htdocs/manual install-tpf.html readme-tpf.html src Makefile.tpf src/main Makefile.tpf src/os/tpf Makefile.tmpl TPFExport ebcdic.c ebcdic.h os-inline.c os.c os.h test_char.h uri_delims.h src/os/tpf/samples linkdll.jcl loadset.jcl Log: Submitted by: Joe Moenich and others at IBM Newly created files from the TPF port Revision ChangesPath 1.1 apache-1.3/htdocs/manual/install-tpf.html Index: install-tpf.html === Installing Apache on TPF Installing the Apache 1.3 HTTP Server on TPF [ Setup | Compilation | Installation | VisualAge ] This document outlines the steps needed to install Apache onto a TPF system. You should first read src/os/tpf/readme.tpf.html for basic information on the port of Apache to TPF including required PUT level and supported functions & modules. Setup Due to the use of EBCDIC on MVS OS/390 Open Edition (later referred to simply as "Open Edition"), we've found that the most reliable method for loading Apache onto your system is to unzip and tar the distribution file on your PC, and then copy the extracted files to Open Edition via an NFS client capable of transferring the data in EBCDIC format. Before moving the distribution to an Open Edition environment, verify that the NFS drive will transfer the filenames with upper/lower case preserved. Since Open Edition is not the ultimate destination of the files, the only required files and subdirectories that need to be moved to Open Edition are in /src. WARNING: If you are using a product such as WinZip on your PC, verify that the "TAR File Smart CR/LF Conversion" option is NOT checked. You can find this in WinZip under Options, Configuration. Since you had to tar and unzip the file to read this document, you need to re-tar and -unzip if the CR/LF option was checked. This will save you lots of headaches later on. WARNING: Editing files on a PC before moving them to Open Edition may result in the loss/addition of unprintable characters. Files of concern include shell scripts and src/Configuration. The most common problems are with tab characters and CR/LF characters. Most editors will handle the CR/LF problem correctly but none seem to handle tab characters. If you need to edit files, edit them in a UNIX editor such as vi or emacs. Compilation Apache supports the notion of "optional modules". However, the server has to know which modules are compiled into it. In order for those modules to be effective, it is necessary to generate a short bit of code ("modules.c") which simply has a list of them. If you are using the make and Configure utility, "modules.c" will be created for you. The provided scripts assume a c89 compiler and have only been tested on an Open Edition environment. If you are using a platform other that Open Edition you may need to modify src/os/tpf/TPFExport and src/Configure to match your environment. Note that UNIX/Open Edition commands in this section are shown in bold, are case sensitive, and must be made from the "src" directory. Overlay src/Configuration with src/Configuration.tmpl: cp Configuration.tmpl Configuration Edit src/Configuration. It contains the list and settings of various "Rules" and an additional section at the bottom that determines which modules to compile: Adjust the Rules and EXTRA_CFLAGS|LIBS|LDFLAGS|INCLUDES if you feel so inclined. Comment out (by preceding the line with a "#") lines corresponding to those modules you DO NOT wish to include. At present the following modules MUST be commented out as they are not yet supported on TPF: mod_actions, mod_auth, mod_cgi, mod_env, mod_include, & mod_status. Uncomment (by removing the initial "#", if present) lines corresponding to those optional modules you wish to include or add new lines corresponding to any custom modules you have written. The src/os/tpf/readme.tpf.html document lists the modules that have been tested on TPF. Overlay src/Makefile.tmpl with src/Makefile.tpf: cp Makefile.tpf Makefile.tmpl Overlay src/main/Makefile.tmpl with src/main/Makefile.tpf: cp main/Makefile.tpf main/Makefile.tmpl Set the TPF environment variables: . os/tpf/TPFExport (The initial period and blank on the command are required to ensure the environment variables exist beyond the s
cvs commit: apache-1.3 STATUS
manoj 98/11/03 15:33:40 Modified:.STATUS Log: Add TPF port to STATUS Revision ChangesPath 1.527 +4 -0 apache-1.3/STATUS Index: STATUS === RCS file: /export/home/cvs/apache-1.3/STATUS,v retrieving revision 1.526 retrieving revision 1.527 diff -u -u -r1.526 -r1.527 --- STATUS1998/11/03 01:26:53 1.526 +++ STATUS1998/11/03 23:33:38 1.527 @@ -70,6 +70,10 @@ Available Patches: +* [PATCH] TPF port +Message-ID: <[EMAIL PROTECTED]> +Status: Jim +1 (with minor nits) + * Ralf's Build outside of source tree (take 2: alternative solution) ("overrules" Wilfredo Sanchez's [PATCH] Build outside of source tree) Message-ID: <[EMAIL PROTECTED]>
cvs commit: apache-1.3/htdocs/manual install-tpf.html readme-tpf.html
manoj 98/11/04 11:31:53 Modified:htdocs/manual install-tpf.html readme-tpf.html Log: Fix some bad links in TPF documentation Revision ChangesPath 1.2 +2 -2 apache-1.3/htdocs/manual/install-tpf.html Index: install-tpf.html === RCS file: /export/home/cvs/apache-1.3/htdocs/manual/install-tpf.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- install-tpf.html 1998/11/03 22:06:29 1.1 +++ install-tpf.html 1998/11/04 19:31:50 1.2 @@ -18,7 +18,7 @@ This document outlines the steps needed to install Apache onto a TPF system. -You should first read src/os/tpf/readme.tpf.html +You should first read htdocs/manual/readme-tpf.html for basic information on the port of Apache to TPF including required PUT level and supported functions & modules. @@ -97,7 +97,7 @@ corresponding to those optional modules you wish to include or add new lines corresponding to any custom modules you have written. -The src/os/tpf/readme.tpf.html +The htdocs/manual/readme-tpf.html document lists the modules that have been tested on TPF. 1.2 +2 -3 apache-1.3/htdocs/manual/readme-tpf.html Index: readme-tpf.html === RCS file: /export/home/cvs/apache-1.3/htdocs/manual/readme-tpf.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- readme-tpf.html 1998/11/03 22:06:29 1.1 +++ readme-tpf.html 1998/11/04 19:31:50 1.2 @@ -22,14 +22,13 @@ (Transaction Processing Facility) operating system. Unless otherwise noted TPF version 4.1 PUT08 and APAR PJ25589 are required. - Refer to src/os/tpf/install.tpf.html + Refer to htdocs/manual/install-tpf.html for step-by-step installation instructions. As this is the first cut at making Apache run on TPF, performance tuning has not been done. - This port builds upon the - http://www.apache.org/docs/ebcdic.html";>EBCDIC changes + This port builds upon the EBCDIC changes previously made to Apache.
cvs commit: apache-1.3 STATUS
manoj 98/11/04 11:43:28 Modified:.STATUS Log: Put back TPF. The whole port was not committed, just the new files. Revision ChangesPath 1.529 +4 -0 apache-1.3/STATUS Index: STATUS === RCS file: /export/home/cvs/apache-1.3/STATUS,v retrieving revision 1.528 retrieving revision 1.529 diff -u -u -r1.528 -r1.529 --- STATUS1998/11/04 09:38:22 1.528 +++ STATUS1998/11/04 19:43:27 1.529 @@ -72,6 +72,10 @@ Available Patches: +* [PATCH] TPF port +Message-ID: <[EMAIL PROTECTED]> +Status: Jim +1 (with minor nits) + * Ralf's Build outside of source tree (take 2: alternative solution) ("overrules" Wilfredo Sanchez's [PATCH] Build outside of source tree) Message-ID: <[EMAIL PROTECTED]>
cvs commit: apache-1.3/src/include ap_config.h
manoj 98/11/04 14:23:46 Modified:src CHANGES src/include ap_config.h Log: PR: 3177 Move a typedef to fix compile problems with 1.x kernels. Revision ChangesPath 1.1133+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1132 retrieving revision 1.1133 diff -u -u -r1.1132 -r1.1133 --- CHANGES 1998/11/04 12:38:32 1.1132 +++ CHANGES 1998/11/04 22:23:42 1.1133 @@ -1,5 +1,8 @@ Changes with Apache 1.3.4 + *) Move a typedef to fix compile problems on Linux with 1.x kernels. + [Manoj Kasichainula] PR#3177 + *) PORT: Add a port to the Concurrent PowerMAX OS. [Tom Horsley <[EMAIL PROTECTED]>] 1.242 +5 -5 apache-1.3/src/include/ap_config.h Index: ap_config.h === RCS file: /export/home/cvs/apache-1.3/src/include/ap_config.h,v retrieving revision 1.241 retrieving revision 1.242 diff -u -u -r1.241 -r1.242 --- ap_config.h 1998/10/19 02:16:27 1.241 +++ ap_config.h 1998/11/04 22:23:45 1.242 @@ -436,11 +436,6 @@ #define HAVE_MMAP 1 #define USE_MMAP_FILES -/* glibc 2.1 and later finally define rlim_t */ -#if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1) -typedef int rlim_t; -#endif - /* flock is faster ... but hasn't been tested on 1.x systems */ #define USE_FLOCK_SERIALIZED_ACCEPT @@ -456,6 +451,11 @@ #undef NEED_STRDUP #include #define HAVE_SYSLOG 1 + +/* glibc 2.1 and later finally define rlim_t */ +#if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1) +typedef int rlim_t; +#endif #elif defined(SCO) #undef HAVE_GMTOFF
cvs commit: apache-1.3/src/os/win32 os.h util_win32.c
manoj 98/11/05 11:20:18 Modified:src CHANGES src/include ap_config.h src/os/win32 os.h util_win32.c Log: Work around incomplete implementation of strftime on Win32. Revision ChangesPath 1.1134+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1133 retrieving revision 1.1134 diff -u -u -r1.1133 -r1.1134 --- CHANGES 1998/11/04 22:23:42 1.1133 +++ CHANGES 1998/11/05 19:20:14 1.1134 @@ -1,5 +1,8 @@ Changes with Apache 1.3.4 + *) Work around incomplete implementation of strftime on Win32. + [Manoj Kasichainula, Ken Parzygnat <[EMAIL PROTECTED]>] + *) Move a typedef to fix compile problems on Linux with 1.x kernels. [Manoj Kasichainula] PR#3177 1.243 +3 -0 apache-1.3/src/include/ap_config.h Index: ap_config.h === RCS file: /export/home/cvs/apache-1.3/src/include/ap_config.h,v retrieving revision 1.242 retrieving revision 1.243 diff -u -u -r1.242 -r1.243 --- ap_config.h 1998/11/04 22:23:45 1.242 +++ ap_config.h 1998/11/05 19:20:16 1.243 @@ -938,6 +938,9 @@ #endif /* ndef WIN32 */ #include /* for ctime */ +#ifdef WIN32 +#define strftime(s,max,format,tm) os_strftime(s,max,format,tm) +#endif #include #include #if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) 1.25 +2 -0 apache-1.3/src/os/win32/os.h Index: os.h === RCS file: /export/home/cvs/apache-1.3/src/os/win32/os.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -u -r1.24 -r1.25 --- os.h 1998/09/19 12:27:25 1.24 +++ os.h 1998/11/05 19:20:17 1.25 @@ -93,6 +93,8 @@ #define stat(f,ps) os_stat(f,ps) API_EXPORT(int) os_stat(const char *szPath,struct stat *pStat); +API_EXPORT(int) os_strftime(char *s, size_t max, const char *format, const struct tm *tm); + #define _spawnv(mode,cmdname,argv) os_spawnv(mode,cmdname,argv) #define spawnv(mode,cmdname,argv)os_spawnv(mode,cmdname,argv) API_EXPORT(int) os_spawnv(int mode,const char *cmdname,const char *const *argv); 1.27 +69 -0 apache-1.3/src/os/win32/util_win32.c Index: util_win32.c === RCS file: /export/home/cvs/apache-1.3/src/os/win32/util_win32.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -u -r1.26 -r1.27 --- util_win32.c 1998/10/01 04:52:32 1.26 +++ util_win32.c 1998/11/05 19:20:17 1.27 @@ -1,6 +1,8 @@ #include #include #include +#include +#include #include "httpd.h" #include "http_log.h" @@ -415,4 +417,71 @@ va_end(vlist); return _spawnve(mode, szCmd, aszArgs, aszEnv); +} + +#undef strftime + +/* Partial replacement for strftime. This adds certain expandos to the + * Windows version + */ + +API_EXPORT(int) os_strftime(char *s, size_t max, const char *format, +const struct tm *tm) { + /* If the new format string is bigger than max, the result string probably +* won't fit anyway. When %-expandos are added, made sure the padding below +* is enough. +*/ +char *new_format = (char *) _alloca(max + 11); +size_t i, j, format_length = strlen(format); +int return_value; +int length_written; + +for (i = 0, j = 0; (i < format_length && j < max)) { +if (format[i] != '%') { +new_format[j++] = format[i++]; +continue; +} +switch (format[i+1]) { +case 'D': +/* Is this locale dependent? Shouldn't be... + Also note the year 2000 exposure here */ +memcpy(new_format + j, "%m/%d/%y", 8); +i += 2; +j += 8; +break; +case 'r': +memcpy(new_format + j, "%I:%M:%S %p", 11); +i += 2; +j += 11; +break; +case 'T': +memcpy(new_format + j, "%H:%M:%S", 8); +i += 2; +j += 8; +break; +case 'e': +length_written = ap_snprintf(new_format + j, max - j, "%2d", +tm->tm_mday); +j = (length_written == -1) ? max : (j + length_written); +i += 2; +
cvs commit: apache-1.3/src/os/win32 util_win32.c
manoj 98/11/05 13:39:47 Modified:src/os/win32 util_win32.c Log: Get rid of "%%" handling in strftime-adapter Revision ChangesPath 1.29 +0 -5 apache-1.3/src/os/win32/util_win32.c Index: util_win32.c === RCS file: /export/home/cvs/apache-1.3/src/os/win32/util_win32.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -u -r1.28 -r1.29 --- util_win32.c 1998/11/05 20:07:53 1.28 +++ util_win32.c 1998/11/05 21:39:46 1.29 @@ -519,11 +519,6 @@ j = (length_written == -1) ? max : (j + length_written); i += 2; break; -/* Handle "%%" to avoid dying on strftime(out, 600, 1200 "%"'s) */ -case '%': -new_format[j++] = '%'; -i += 2; -break; default: /* We know we can advance two characters forward here. */ new_format[j++] = format[i++];
cvs commit: apache-1.3 STATUS
manoj 98/11/06 14:42:46 Modified:src Configure CHANGES src/helpers GuessOS src/include alloc.h ap_config.h scoreboard.h src/main buff.c http_main.c util.c .STATUS Log: Submitted by: Joe Moenich <[EMAIL PROTECTED]> and others at IBM The rest of the port to TPF, consisting of changes to existing files. Revision ChangesPath 1.305 +15 -2 apache-1.3/src/Configure Index: Configure === RCS file: /export/home/cvs/apache-1.3/src/Configure,v retrieving revision 1.304 retrieving revision 1.305 diff -u -u -r1.304 -r1.305 --- Configure 1998/11/04 12:38:32 1.304 +++ Configure 1998/11/06 22:42:37 1.305 @@ -616,6 +616,14 @@ DEF_WANTHSREGEX=yes LIBS="$LIBS -lsocket -lnsl -lc" ;; +TPF) + OS='TPF' + OSDIR='os/tpf' + CC='c89' + CFLAGS="$CFLAGS -DTPF -DCHARSET_EBCDIC -D_POSIX_SOURCE" + DEF_WANTHSREGEX=yes + LIBS="$LIBS" + ;; *-sni-sysv4*) OS='SVR4' CFLAGS="$CFLAGS -DSVR4 -D_XPG_IV -DHAS_DLFCN -DUSE_MMAP_FILES -DUSE_SYSVSEM_SERIALIZED_ACCEPT -DNEED_UNION_SEMUN" @@ -1815,10 +1823,14 @@ ## Use TestCompile to see if $(CC) is ANSI and as a "final" sanity ## check ## -echo " + doing sanity check on compiler and options" -if ./helpers/TestCompile sanity; then + +if [ "$OS" = "TPF" ] ; then : else + echo " + doing sanity check on compiler and options" + if ./helpers/TestCompile sanity; then + : + else echo "** A test compilation with your Makefile configuration" echo "** failed. This is most likely because your C compiler" echo "** is not ANSI. Apache requires an ANSI C Compiler, such" @@ -1827,6 +1839,7 @@ echo " Aborting!" exitcode=1 exit 1 + fi fi 1.1138+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1137 retrieving revision 1.1138 diff -u -u -r1.1137 -r1.1138 --- CHANGES 1998/11/06 12:24:35 1.1137 +++ CHANGES 1998/11/06 22:42:38 1.1138 @@ -1,5 +1,8 @@ Changes with Apache 1.3.4 + *) PORT: Add a port to the TPF OS. [Joe Moenich <[EMAIL PROTECTED]> and + others at IBM] + *) Fix internal handling of registered cleanups in alloc.c by making sure that NULL-specified callback functions (we don't do this in the official set of modules, but third-party modules do) for ap_register_cleanup() 1.52 +7 -0 apache-1.3/src/helpers/GuessOS Index: GuessOS === RCS file: /export/home/cvs/apache-1.3/src/helpers/GuessOS,v retrieving revision 1.51 retrieving revision 1.52 diff -u -u -r1.51 -r1.52 --- GuessOS 1998/11/04 12:38:34 1.51 +++ GuessOS 1998/11/06 22:42:40 1.52 @@ -275,6 +275,13 @@ exit 0 fi +# Apache is not compiled on the TPF platform +# therefore an environment variable is used +if [ "$TPF" = "YES" ]; then +echo "TPF" +exit 0 +fi + # Now NeXT ISNEXT=`hostinfo 2>/dev/null` case "$ISNEXT" in 1.64 +5 -0 apache-1.3/src/include/alloc.h Index: alloc.h === RCS file: /export/home/cvs/apache-1.3/src/include/alloc.h,v retrieving revision 1.63 retrieving revision 1.64 diff -u -u -r1.63 -r1.64 --- alloc.h 1998/08/14 02:49:45 1.63 +++ alloc.h 1998/11/06 22:42:41 1.64 @@ -269,8 +269,13 @@ * up with timeout handling in general... */ +#ifdef TPF +#define ap_block_alarms() (0) +#define ap_unblock_alarms() (0) +#else API_EXPORT(void) ap_block_alarms(void); API_EXPORT(void) ap_unblock_alarms(void); +#endif /* TPF */ /* Common cases which want utility support.. * the note_cleanups_for_foo routines are for 1.244 +38 -4 apache-1.3/src/include/ap_config.h Index: ap_config.h === RCS file: /export/home/cvs/apache-1.3/src/include/ap_config.h,v retrieving revision 1.243 retrieving revision 1.244 diff -u -u -r1.243 -r1.244 --- ap_config.h 1998/11/05 19:20:16 1.243 +++ ap_config.h 1998/11/06 22:42:41 1.244 @@ -92,7 +92,7 @@ #include "os.h" #endif -#if !defined(QNX) && !defined
cvs commit: apache-1.3 STATUS
manoj 98/11/10 11:24:59 Modified:.STATUS Log: Patch was committed. Revision ChangesPath 1.538 +0 -5 apache-1.3/STATUS Index: STATUS === RCS file: /export/home/cvs/apache-1.3/STATUS,v retrieving revision 1.537 retrieving revision 1.538 diff -u -u -r1.537 -r1.538 --- STATUS1998/11/10 08:02:45 1.537 +++ STATUS1998/11/10 19:24:56 1.538 @@ -85,11 +85,6 @@ Status: Marc +1, Jim +1 (concept) * Needs more in-depth review * -* Manoj and Ken Parzygnat's PATCH to support %-expandos from Unix - on Win32 -Message-ID: <[EMAIL PROTECTED]> -Status: Umm, wasn't this committed and/or reversed last week? - * Ron Record's patch to port Apache to UnixWare 7 (forwarded by Randy). Message-ID: <[EMAIL PROTECTED]>
cvs commit: apache-1.3/src/os/tpf TPFExport os.h
manoj 99/01/06 13:57:08 Modified:htdocs/manual install-tpf.html readme-tpf.html src Configure Makefile.tmpl src/os/tpf TPFExport os.h Log: Submitted by: Joe Moenich <[EMAIL PROTECTED]> Reviewed by: Manoj Kasichainula <[EMAIL PROTECTED]> Various TPF tweaks, simplifying installation, etc. Revision ChangesPath 1.3 +0 -6 apache-1.3/htdocs/manual/install-tpf.html Index: install-tpf.html === RCS file: /home/cvs/apache-1.3/htdocs/manual/install-tpf.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- install-tpf.html 1998/11/04 19:31:50 1.2 +++ install-tpf.html 1999/01/06 21:56:57 1.3 @@ -101,12 +101,6 @@ document lists the modules that have been tested on TPF. -Overlay src/Makefile.tmpl with src/Makefile.tpf: -cp Makefile.tpf Makefile.tmpl - -Overlay src/main/Makefile.tmpl with src/main/Makefile.tpf: - cp main/Makefile.tpf main/Makefile.tmpl - Set the TPF environment variables: . os/tpf/TPFExport 1.3 +0 -15 apache-1.3/htdocs/manual/readme-tpf.html Index: readme-tpf.html === RCS file: /home/cvs/apache-1.3/htdocs/manual/readme-tpf.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- readme-tpf.html 1998/11/04 19:31:50 1.2 +++ readme-tpf.html 1999/01/06 21:56:57 1.3 @@ -49,21 +49,6 @@ - -Automatically Generated Files - - Some files that are automatically generated by Makefile on other platforms - are included in the src/os/tpf directory... - - test_char.h - uri_delims.h - - - These files could not be automatically created for TPF because the - Makefile platform is not the same as the run-time platform. - (That is, you don't run Makefile on TPF itself.) - - What's Available in this Version 1.320 +1 -0 apache-1.3/src/Configure Index: Configure === RCS file: /home/cvs/apache-1.3/src/Configure,v retrieving revision 1.319 retrieving revision 1.320 diff -u -u -r1.319 -r1.320 --- Configure 1999/01/04 04:11:38 1.319 +++ Configure 1999/01/06 21:57:01 1.320 @@ -609,6 +609,7 @@ CFLAGS="$CFLAGS -DTPF -DCHARSET_EBCDIC -D_POSIX_SOURCE" DEF_WANTHSREGEX=yes LIBS="$LIBS" + SUBTARGET="target_compile_only" ;; *-sni-sysv4*) OS='SVR4' 1.108 +3 -0 apache-1.3/src/Makefile.tmpl Index: Makefile.tmpl === RCS file: /home/cvs/apache-1.3/src/Makefile.tmpl,v retrieving revision 1.107 retrieving revision 1.108 diff -u -u -r1.107 -r1.108 --- Makefile.tmpl 1998/12/01 23:59:54 1.107 +++ Makefile.tmpl 1999/01/06 21:57:02 1.108 @@ -30,6 +30,9 @@ $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SHLIB_EXPORT) \ -o $(TARGET) buildmark.o $(OBJS) $(REGLIB) $(LIBS) +target_compile_only: subdirs modules.o + $(CC) -c $(INCLUDES) $(CFLAGS) buildmark.c + target_shared: lib$(TARGET).ep $(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_SHLIB_EXPORT) \ -o $(TARGET) -DSHARED_CORE_BOOTSTRAP main/http_main.c 1.2 +3 -22 apache-1.3/src/os/tpf/TPFExport Index: TPFExport === RCS file: /home/cvs/apache-1.3/src/os/tpf/TPFExport,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- TPFExport 1998/11/03 22:06:30 1.1 +++ TPFExport 1999/01/06 21:57:04 1.2 @@ -1,26 +1,7 @@ #!/bin/sh echo " Setting TPF/c89 environment variables" -TZ=EST5EDT -PATH="$PATH:/usr/sbin:/usr/share/lib/terminfo/:.:/etc:$HOME" -NLSPATH=/usr/lpp/tcpip/usr/lib/nls/msg/%L:/usr/lib/nls/msg/%L/%N -LIBPATH=/usr/lib -LANG=C -export TZ PATH NLSPATH LANG -# Commands Reference -# umask g=rx,o=x -umask 022 -export _C89_CCMODE=1 -export _C89_CVERSION="0x2104" -export _C89_PVERSION="0x1108" -export _C89_CNAME="CBCDRVR" -export _C89_PNAME="EDCPRLK" -export _C89_PMSGS="EDCPMSGE" -export _C89_CLIB_PREFIX="TSCTEST.OSV2R4M0" -export _C89_PLIB_PREFIX="SHARE.CEE180" -export _C89_INCDIRS="/u/tpf41/currentmaint/include /u/tpf41/currentmaint/include/oco //DD:SYSLIB //'SHARE.CEE180.SCEEH.NET.H' //'SHARE.CEE180.SCEEH.H' //'SHARE.CEE180.SCEEH.NETINET.H'" -export _C89_SSYSLIB=SH
cvs commit: apache-1.3/src/os/tpf test_char.h uri_delims.h
manoj 99/01/07 10:28:38 Removed: src Makefile.tpf src/main Makefile.tpf src/os/tpf test_char.h uri_delims.h Log: Submitted by: Joe Moenich <[EMAIL PROTECTED]> Remove TPF-only files obsoleted by latest TPF patch.
cvs commit: apache-1.3/src/modules/standard mod_auth_db.c mod_auth_dbm.c
manoj 99/01/25 16:15:22 Modified:src/modules/standard mod_auth_db.c mod_auth_dbm.c Log: Minor compilation bugfix Revision ChangesPath 1.38 +1 -1 apache-1.3/src/modules/standard/mod_auth_db.c Index: mod_auth_db.c === RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_auth_db.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -u -r1.37 -r1.38 --- mod_auth_db.c 1999/01/25 22:55:38 1.37 +++ mod_auth_db.c 1999/01/26 00:15:21 1.38 @@ -96,7 +96,7 @@ #include "http_log.h" #include "http_protocol.h" #include -#include "ap_md5.h"; +#include "ap_md5.h" #if defined(HAVE_CRYPT_H) #include #endif 1.43 +1 -1 apache-1.3/src/modules/standard/mod_auth_dbm.c Index: mod_auth_dbm.c === RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_auth_dbm.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -u -r1.42 -r1.43 --- mod_auth_dbm.c1999/01/25 22:55:39 1.42 +++ mod_auth_dbm.c1999/01/26 00:15:21 1.43 @@ -75,7 +75,7 @@ #include "http_log.h" #include "http_protocol.h" #include -#include "ap_md5.h"; +#include "ap_md5.h" #if defined(HAVE_CRYPT_H) #include #endif
cvs commit: apache-apr/pthreads STATUS
manoj 99/01/26 13:37:48 Removed: pthreads STATUS Log: This STATUS file doesn't apply to this code tree; whack it.
cvs commit: apache-apr/pthreads/src/modules/standard mod_mime_magic.c
manoj 99/02/02 23:49:02 Modified:pthreads/src/modules/standard mod_mime_magic.c Log: Compilation fix. Revision ChangesPath 1.3 +1 -1 apache-apr/pthreads/src/modules/standard/mod_mime_magic.c Index: mod_mime_magic.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_mime_magic.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- mod_mime_magic.c 1999/01/27 16:15:47 1.2 +++ mod_mime_magic.c 1999/02/03 07:49:02 1.3 @@ -1,4 +1,4 @@ -2/* +/* * Copyright (c) 1995-1998 The Apache Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without
cvs commit: apache-apr/pthreads/src Configure
manoj 99/02/03 16:26:00 Modified:pthreads/src Configure Log: Make this compile out of the box on Linux. Revision ChangesPath 1.2 +1 -1 apache-apr/pthreads/src/Configure Index: Configure === RCS file: /home/cvs/apache-apr/pthreads/src/Configure,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- Configure 1999/01/21 23:08:31 1.1 +++ Configure 1999/02/04 00:25:56 1.2 @@ -430,7 +430,7 @@ DEF_WANTHSREGEX=yes OS='Linux' CFLAGS="$CFLAGS -DLINUX=2" - LIBS="$LIBS -lm" + LIBS="$LIBS -lm -lpthread" ;; *-linux1) DEF_WANTHSREGEX=yes
cvs commit: apache-apr/pthreads/src/main http_config.c http_protocol.c
manoj 99/02/03 22:52:41 Modified:pthreads/src/main http_config.c http_protocol.c Log: Temporarily fix bug where server threads would lock up after a single request under Linux. LinuxThreads uses SIGUSR1 (and SIGUSR2) so they aren't available to us. We need to find an alternate means to get graceful restarts kicked off if we want to support Linux 2.0 kernel threads. Revision ChangesPath 1.3 +5 -0 apache-apr/pthreads/src/main/http_config.c Index: http_config.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_config.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- http_config.c 1999/01/22 16:10:55 1.2 +++ http_config.c 1999/02/04 06:52:38 1.3 @@ -1503,9 +1503,14 @@ #ifdef SIGHUP signal(SIGHUP, SIG_IGN); #endif +/* XXX - LinuxThreads uses SIGUSR1, so we can't muck with it. Bummer. We + * need to find another way to do graceful restarts if we want to support + * kernel threads with Linux 2.0 (2.2 is supposed to fix this) - mvsk */ +#ifndef LINUX #ifdef SIGUSR1 signal(SIGUSR1, SIG_IGN); #endif +#endif /* ndef LINUX */ for (m = top_module; m; m = m->next) if (m->child_exit) 1.2 +6 -0 apache-apr/pthreads/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_protocol.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- http_protocol.c 1999/01/21 23:08:33 1.1 +++ http_protocol.c 1999/02/04 06:52:39 1.2 @@ -675,9 +675,15 @@ } } /* we've probably got something to do, ignore graceful restart requests */ + +/* XXX - LinuxThreads uses SIGUSR1, so we can't muck with it. Bummer. We + * need to find another way to do graceful restarts if we want to support + * kernel threads with Linux 2.0 (2.2 is supposed to fix this) - mvsk */ +#ifndef LINUX #ifdef SIGUSR1 signal(SIGUSR1, SIG_IGN); #endif +#endif /* ndef LINUX */ ap_bsetflag(conn->client, B_SAFEREAD, 0);
cvs commit: apache-apr/pthreads/src/os/win32 os.h
manoj 99/02/04 12:31:27 Modified:pthreads/src/include multithread.h pthreads/src/modules/standard mod_mime_magic.c pthreads/src/os/unix multithread.c os-inline.c os.h pthreads/src/os/win32 os.h Log: Minor cleanup of spawnvp operations. No functionality change. Revision ChangesPath 1.3 +0 -1 apache-apr/pthreads/src/include/multithread.h Index: multithread.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/multithread.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- multithread.h 1999/01/27 16:15:46 1.2 +++ multithread.h 1999/02/04 20:31:19 1.3 @@ -55,7 +55,6 @@ API_EXPORT(int) ap_acquire_mutex(mutex *mutex_id); API_EXPORT(int) ap_release_mutex(mutex *mutex_id); API_EXPORT(void) ap_destroy_mutex(mutex *mutex_id); -API_EXPORT(int) ap_spawnvp(const char *, char *const []); #endif /* ndef MULTITHREAD */ #ifdef __cplusplus 1.4 +1 -5 apache-apr/pthreads/src/modules/standard/mod_mime_magic.c Index: mod_mime_magic.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_mime_magic.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- mod_mime_magic.c 1999/02/03 07:49:02 1.3 +++ mod_mime_magic.c 1999/02/04 20:31:20 1.4 @@ -2145,12 +2145,8 @@ close(STDERR_FILENO); } -#if defined(WIN32) -child_pid = spawnvp(compr[parm->method].argv[0], +child_pid = ap_spawnvp(compr[parm->method].argv[0], compr[parm->method].argv); -#else -child_pid = ap_spawnvp(compr[parm->method].argv[0], compr[parm->method].argv); -#endif if (child_pid == -1) ap_log_rerror(APLOG_MARK, APLOG_ERR, parm->r, MODNAME ": could not execute `%s'.", 1.4 +0 -13 apache-apr/pthreads/src/os/unix/multithread.c Index: multithread.c === RCS file: /home/cvs/apache-apr/pthreads/src/os/unix/multithread.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- multithread.c 1999/02/03 17:50:14 1.3 +++ multithread.c 1999/02/04 20:31:22 1.4 @@ -30,16 +30,3 @@ pthread_mutex_destroy((pthread_mutex_t *) mutex_id); } -API_EXPORT(int) ap_spawnvp(const char *file, char *const argv[]) -{ -int pid; - -if ((pid = fork()) == -1) { -return pid; -} else if (pid == 0) { -if (execvp(file, argv) == -1) - return -1; -} else -return pid; -} - 1.2 +14 -0 apache-apr/pthreads/src/os/unix/os-inline.c Index: os-inline.c === RCS file: /home/cvs/apache-apr/pthreads/src/os/unix/os-inline.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- os-inline.c 1999/01/21 23:08:40 1.1 +++ os-inline.c 1999/02/04 20:31:23 1.2 @@ -29,3 +29,17 @@ { return file[0] == '/'; } + +INLINE int ap_spawnvp(const char *file, char *const argv[]) +{ +int pid; + +if ((pid = fork()) == -1) { +return pid; +} else if (pid == 0) { +if (execvp(file, argv) == -1) +return -1; +} else +return pid; +} + 1.2 +6 -0 apache-apr/pthreads/src/os/unix/os.h Index: os.h === RCS file: /home/cvs/apache-apr/pthreads/src/os/unix/os.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- os.h 1999/01/21 23:08:40 1.1 +++ os.h 1999/02/04 20:31:23 1.2 @@ -94,6 +94,12 @@ #endif /* + * spawn = fork + exec on unix + */ + +extern int ap_spawnvp(const char *, char *const []); + +/* * Do not use native AIX DSO support */ #ifdef AIX 1.2 +3 -0 apache-apr/pthreads/src/os/win32/os.h Index: os.h === RCS file: /home/cvs/apache-apr/pthreads/src/os/win32/os.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- os.h 1999/01/21 23:08:41 1.1 +++ os.h 1999/02/04 20:31:25 1.2 @@ -13,6 +13,9 @@ /* char *crypt(const char *pw, const char *salt); */ #define crypt(buf,salt) (buf) +/* Use the Windows built-in spawnvp */ +#define ap_spawnvp(file, argv) (spawnvp(file, argv)) + /* Although DIR_TYPE is dirent (see nt/readdir.h) we need direct.h for chdir() */ #include
cvs commit: apache-apr/pthreads/src/main http_protocol.c
manoj 99/02/04 23:55:25 Modified:pthreads/src/main http_protocol.c Log: Fix (I think) a bug where pipes could be closed even if there is still data to send, so only part of a CGI's output would sometimes be sent. Revision ChangesPath 1.3 +2 -2 apache-apr/pthreads/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_protocol.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- http_protocol.c 1999/02/04 06:52:39 1.2 +++ http_protocol.c 1999/02/05 07:55:24 1.3 @@ -1876,7 +1876,7 @@ #endif if (ap_is_aborted(r->connection)) break; -if (n < 0 /* && errno != EAGAIN ZZZ rethink for threaded impl */) +if (n < 0 && errno != EAGAIN /* ZZZ rethink for threaded impl */) break; /* we need to block, so flush the output first */ ap_bflush(r->connection->client); @@ -1909,7 +1909,7 @@ else if (w < 0) { if (ap_is_aborted(r->connection)) break; -#if 0 /*rethink for threaded impl */ +#if 1 /*rethink for threaded impl */ else if (errno == EAGAIN) continue; #endif
cvs commit: apache-apr STATUS
manoj 99/02/06 00:01:17 Modified:.STATUS Log: No Scooby-Doo on TV tonight. Revision ChangesPath 1.4 +10 -5 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- STATUS1999/02/05 14:58:46 1.3 +++ STATUS1999/02/06 08:01:16 1.4 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/02/05 14:58:46 $] +Last modified at [$Date: 1999/02/06 08:01:16 $] Release: @@ -25,13 +25,16 @@ the process when we encounter SIGPIPE, obviously bad. Modules -Ensure thread safety. Does not include mod_proxy. +Ensure thread safety. Does not include mod_proxy, yet. Scoreboard - Update the scoreboard for each thread, not per process. + Resign the scoreboard appropriately for a hybrid process web + server. This includes adding a tid field to the scoreboard. -Hybrid server - Use the updated server to determine when to launch new processes. +Process/thread management +Put (back) in the logic to manage the number of processes. + Managing threads per process other than with a configuration + constant is in doubt. Everything @@ -43,6 +46,8 @@ * What the status codes should look like * Various modules aren't pthreads-ready (mod_cgi) * Bringing in the libap stuff + * Bringing this code up-to-date with the changes in the 1.3 branch. +The trees appear to have diverged in November(?!) * Mod_proxy * Timeouts. (only soft timeouts)
cvs commit: apache-apr/pthreads/icons/small - New directory
manoj 99/02/06 22:19:44 apache-apr/pthreads/icons/small - New directory
cvs commit: apache-apr/pthreads/src/support Makefile.tmpl ab.1 ab.c apachectl apachectl.1 apxs.8 apxs.pl dbmmanage dbmmanage.1 htdigest.1 htdigest.c htpasswd.1 htpasswd.c httpd.8 httpd.exp log_server_status logresolve.8 logresolve.pl rotatelogs.8 split-logfile suexec.8 suexec.c suexec.h
manoj 99/02/06 22:30:26 Modified:pthreads Announcement INSTALL KEYS LICENSE Makefile.tmpl README.configure configure pthreads/conf httpd.conf-dist httpd.conf-dist-win mime.types pthreads/icons README pthreads/src ApacheCore.def ApacheCore.dsp BUILD.NOTES CHANGES Configuration.tmpl Configure Makefile.nt Makefile.tmpl buildmark.c pthreads/src/ap Makefile.tmpl ap.dsp ap.mak ap_cpystrn.c ap_execve.c ap_signal.c ap_slack.c ap_snprintf.c pthreads/src/helpers GuessOS PrintPath TestCompile buildinfo.sh checkheader.sh findcpp.sh fmn.sh fp2rp install.sh mkshadow.sh ppl.sh slo.sh pthreads/src/include alloc.h ap.h ap_compat.h ap_config.h ap_ctype.h ap_md5.h ap_mmn.h buff.h http_conf_globals.h http_config.h http_core.h http_log.h http_main.h http_protocol.h http_request.h http_vhost.h httpd.h rfc1413.h scoreboard.h util_date.h util_md5.h util_script.h util_uri.h pthreads/src/main Makefile.tmpl alloc.c buff.c gen_test_char.c http_config.c http_core.c http_log.c http_main.c http_protocol.c http_request.c http_vhost.c rfc1413.c util.c util_date.c util_md5.c util_script.c util_uri.c pthreads/src/modules/example mod_example.c pthreads/src/modules/experimental mod_mmap_static.c pthreads/src/modules/proxy mod_proxy.c mod_proxy.h proxy_cache.c proxy_connect.c proxy_ftp.c proxy_http.c proxy_util.c pthreads/src/modules/standard mod_access.c mod_actions.c mod_alias.c mod_asis.c mod_auth.c mod_auth_anon.c mod_auth_db.c mod_auth_dbm.c mod_autoindex.c mod_cern_meta.c mod_cgi.c mod_digest.c mod_dir.c mod_env.c mod_expires.c mod_headers.c mod_imap.c mod_include.c mod_info.c mod_log_agent.c mod_log_config.c mod_log_referer.c mod_mime.c mod_mime_magic.c mod_negotiation.c mod_rewrite.c mod_rewrite.h mod_setenvif.c mod_so.c mod_speling.c mod_status.c mod_unique_id.c mod_userdir.c mod_usertrack.c pthreads/src/modules/test mod_rndchunk.c mod_test_util_uri.c pthreads/src/os/bs2000 bs2login.c ebcdic.c os.c os.h pthreads/src/os/os2 os.h pthreads/src/os/tpf TPFExport ebcdic.c os.c os.h pthreads/src/os/unix os-aix-dso.c os.h pthreads/src/os/win32 mod_dll.c mod_isapi.c os.h registry.c util_win32.c pthreads/src/os/win32/installer apache.iwz pthreads/src/support Makefile.tmpl ab.1 ab.c apachectl apachectl.1 apxs.8 apxs.pl dbmmanage dbmmanage.1 htdigest.1 htdigest.c htpasswd.1 htpasswd.c httpd.8 httpd.exp log_server_status logresolve.8 logresolve.pl rotatelogs.8 split-logfile suexec.8 suexec.c suexec.h Added: pthreads config.layout pthreads/icons/small README.txt back.gif binary.gif binhex.gif blank.gif broken.gif burst.gif comp1.gif comp2.gif compressed.gif continued.gif dir.gif dir2.gif doc.gif forward.gif generic.gif generic2.gif generic3.gif image.gif image2.gif index.gif key.gif movie.gif patch.gif ps.gif rainbow.gif sound.gif sound2.gif tar.gif text.gif transfer.gif unknown.gif uu.gif pthreads/src Makefile_win32.txt Makefile_win32_debug.txt pthreads/src/ap ap_md5c.c pthreads/src/helpers binbuild.sh Removed: pthreads/src Makefile.tpf pthreads/src/main Makefile.tpf md5c.c pthreads/src/os/tpf test_char.h uri_delims.h Log: Update apache-apr to (almost) the current apache-1.3 state. apache-apr was previously based on an extract from early November. Revision ChangesPath 1.2 +24 -17apache-apr/pthreads/Announcement Index: Announcement === RCS file: /home/cvs/apache-apr/pthreads/Announcement,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- Announcement 1999/01/21 23:08:29 1.1 +++ Announcement 1999/02/07 06:28:58 1.2 @@ -1,26 +1,33
cvs commit: apache-apr STATUS
manoj 99/02/07 22:32:11 Modified:.STATUS Log: I want winter back. Revision ChangesPath 1.5 +5 -5 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- STATUS1999/02/06 08:01:16 1.4 +++ STATUS1999/02/08 06:32:10 1.5 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/02/06 08:01:16 $] +Last modified at [$Date: 1999/02/08 06:32:10 $] Release: @@ -46,12 +46,11 @@ * What the status codes should look like * Various modules aren't pthreads-ready (mod_cgi) * Bringing in the libap stuff - * Bringing this code up-to-date with the changes in the 1.3 branch. -The trees appear to have diverged in November(?!) * Mod_proxy * Timeouts. (only soft timeouts) - * Check misc thread safety. Make sure UNIX code path mirrors NT path. + * Check misc thread safety. Make sure UNIX code path mirrors NT path where +appropriate * Optimize Optimize Optimize FEATURE SET FOR APR @@ -65,5 +64,6 @@ put monitor process back into place. Was removed for initial port, it's time we make sure the server is running, and if not, start it again. - +Bringing this code up-to-date with the changes in the 1.3 branch. +It's now up-to-date as of the morning of Feb 6th, 1999.
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/07 22:47:43 Modified:pthreads/src/main http_main.c Log: Put back -t and -S functionality (config test and virtual host config dump) Revision ChangesPath 1.10 +9 -1 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -u -r1.9 -r1.10 --- http_main.c 1999/02/07 06:29:30 1.9 +++ http_main.c 1999/02/08 06:47:42 1.10 @@ -2144,7 +2144,7 @@ { int c; int rc; /* */ -int configtestonly; +int configtestonly = 0; char *s; MONCONTROL(0); @@ -2239,6 +2239,14 @@ ap_suexec_enabled = init_suexec(); server_conf = ap_read_config(pconf, ptemp, ap_server_confname); + +if (configtestonly) { +fprintf(stderr, "Syntax OK\n"); +exit(0); +} +if (ap_dump_settings) { +exit(0); +} if (!ap_standalone) { fprintf(stderr, "inetd mode not supported\n");
cvs commit: apache-apr/pthreads/src/main fdqueue.c
manoj 99/02/09 14:04:16 Modified:pthreads/src/main fdqueue.c Log: Optimization: don't pthread_cond_signal every time something is added to the queue, but only when there is a state change (empty -> not empty, full -> not full). Revision ChangesPath 1.2 +8 -3 apache-apr/pthreads/src/main/fdqueue.c Index: fdqueue.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/fdqueue.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- fdqueue.c 1999/02/03 17:50:09 1.1 +++ fdqueue.c 1999/02/09 22:04:14 1.2 @@ -33,12 +33,14 @@ } queue->data[queue->tail].fd = fd; queue->data[queue->tail].addr = *addr; +/* If the queue was empty, signal that it no longer is */ +if (queue->head == queue->tail) { +pthread_cond_signal(&queue->not_empty); +} queue->tail = (queue->tail + 1) % queue->bounds; if (pthread_mutex_unlock(&queue->one_big_mutex) != 0) { return FD_QUEUE_FAILURE; } -if (pthread_cond_signal(&queue->not_empty) != 0) -perror("signal didn't work :("); return FD_QUEUE_SUCCESS; } @@ -52,11 +54,14 @@ } fd = queue->data[queue->head].fd; *addr = queue->data[queue->head].addr; +/* If the queue was full, signal that it no longer is */ +if (queue->head == ((queue->tail + 1) % queue->bounds)) { +pthread_cond_signal(&queue->not_full); +} queue->head = (queue->head + 1) % queue->bounds; if (pthread_mutex_unlock(&queue->one_big_mutex) != 0) { return FD_QUEUE_FAILURE; } -pthread_cond_signal(&queue->not_full); return fd; }
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/09 23:24:34 Modified:pthreads/src/main http_main.c Log: Put back ap_sync_scoreboard_image. A no-op in most cases, but it'll be needed. Revision ChangesPath 1.13 +9 -0 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -u -r1.12 -r1.13 --- http_main.c 1999/02/09 21:39:56 1.12 +++ http_main.c 1999/02/10 07:24:34 1.13 @@ -423,7 +423,15 @@ static void reopen_scoreboard(pool *p) { } +#endif /* USE_SHMGET_SCOREBOARD */ + +void ap_sync_scoreboard_image(void) +{ +#ifdef SCOREBOARD_FILE +lseek(scoreboard_fd, 0L, 0); +force_read(scoreboard_fd, ap_scoreboard_image, sizeof(*ap_scoreboard_image)); #endif +} API_EXPORT(void) ap_add_version_component(const char *component) { @@ -1965,6 +1973,7 @@ last_non_dead = -1; total_non_dead = 0; +ap_sync_scoreboard_image(); for (i = 0; i < ap_daemons_limit; ++i) { int status; idle_thread_count = 0;
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/09 23:59:40 Modified:pthreads/src/main http_main.c Log: Two pieces that are closely intertwined (or at least seem to be at 3AM). First, there is now a means for the parent to kill off a child process at will. One thread is assigned the duty of listening to signals and responding to them. Second, the beginnings of proper signal handling. SIGTERM is mostly working. The others shouldn't be too far off, hopefully. Revision ChangesPath 1.14 +495 -18 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -u -r1.13 -r1.14 --- http_main.c 1999/02/10 07:24:34 1.13 +++ http_main.c 1999/02/10 07:59:39 1.14 @@ -487,6 +487,7 @@ ap_destroy_pool(pchild); } /*longjump(tls()->thread_exit, 1); */ +exit(code); } static void usage(char *bin) @@ -940,10 +941,342 @@ return -1; } +static void reclaim_child_processes(int terminate) +{ +int i, status; +long int waittime = 1024 * 16; /* in usecs */ +struct timeval tv; +int waitret, tries; +int not_dead_yet; +#ifndef NO_OTHER_CHILD +other_child_rec *ocr, *nocr; +#endif + +ap_sync_scoreboard_image(); + +for (tries = terminate ? 4 : 1; tries <= 9; ++tries) { + /* don't want to hold up progress any more than + * necessary, but we need to allow children a few moments to exit. + * Set delay with an exponential backoff. + */ + tv.tv_sec = waittime / 100; + tv.tv_usec = waittime % 100; + waittime = waittime * 4; + ap_select(0, NULL, NULL, NULL, &tv); + + /* now see who is done */ + not_dead_yet = 0; + for (i = 0; i < max_daemons_limit; ++i) { + int pid = ap_scoreboard_image->parent[i].pid; + + if (pid == my_pid || pid == 0) + continue; + + waitret = waitpid(pid, &status, WNOHANG); + if (waitret == pid || waitret == -1) { + ap_scoreboard_image->parent[i].pid = 0; + continue; + } + ++not_dead_yet; + switch (tries) { + case 1: /* 16ms */ + case 2: /* 82ms */ + break; + case 3: /* 344ms */ + /* perhaps it missed the SIGHUP, lets try again */ + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, + server_conf, + "child process %d did not exit, sending another SIGHUP", + pid); + kill(pid, SIGHUP); + waittime = 1024 * 16; + break; + case 4: /* 16ms */ + case 5: /* 82ms */ + case 6: /* 344ms */ + break; + case 7: /* 1.4sec */ + /* ok, now it's being annoying */ + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, + server_conf, +"child process %d still did not exit, sending a SIGTERM", + pid); + kill(pid, SIGTERM); + break; + case 8: /* 6 sec */ + /* die child scum */ + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf, +"child process %d still did not exit, sending a SIGKILL", + pid); + kill(pid, SIGKILL); + break; + case 9: /* 14 sec */ + /* gave it our best shot, but alas... If this really + * is a child we are trying to kill and it really hasn't + * exited, we will likely fail to bind to the port + * after the restart. + */ + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, server_conf, + "could not make child process %d exit, " + "attempting to continue anyway", pid); + break; + } + } +#ifndef NO_OTHER_CHILD + for (ocr = other_children; ocr; ocr = nocr) { + nocr = ocr->next; + if (ocr->pid == -1) + continue; + + waitret = waitpid(ocr->pid, &status, WNOHANG); + if (waitret == ocr->pid) { + ocr->pid = -1; + (*ocr->maintenance) (OC_REASON_DEATH, ocr->data, status); + } + else if (waitret == 0) { + (*ocr->maintenance) (OC_REASON_RESTART, ocr->data, -1); + ++not_dead_yet; + } + else if (waitret == -1) { +
cvs commit: apache-apr/pthreads/src/support apachectl
manoj 99/02/14 23:01:58 Modified:pthreads/src/main http_main.c pthreads/src/support apachectl Log: More minor fixes to go with the SIGWINCH change. Even if we switch to a different signal, making everything consistent will make a switchover easier. Revision ChangesPath 1.21 +1 -1 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -u -r1.20 -r1.21 --- http_main.c 1999/02/15 03:12:01 1.20 +++ http_main.c 1999/02/15 07:01:57 1.21 @@ -2737,7 +2737,7 @@ /* kill off the idle ones */ if (ap_killpg(pgrp, SIGWINCH) < 0) { - ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "killpg SIGHUP"); + ap_log_error(APLOG_MARK, APLOG_WARNING, server_conf, "killpg SIGWINCH"); } /* This is mostly for debugging... so that we know what is still 1.3 +2 -2 apache-apr/pthreads/src/support/apachectl Index: apachectl === RCS file: /home/cvs/apache-apr/pthreads/src/support/apachectl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- apachectl 1999/02/07 06:30:18 1.2 +++ apachectl 1999/02/15 07:01:58 1.3 @@ -122,7 +122,7 @@ fi else if $HTTPD -t >/dev/null 2>&1; then - if kill -USR1 $PID ; then + if kill -WINCH $PID ; then echo "$0 $ARG: httpd gracefully restarted" else echo "$0 $ARG: httpd could not be restarted" @@ -158,7 +158,7 @@ not running fullstatus - dump a full status screen; requires lynx and mod_status enabled status - dump a short status screen; requires lynx and mod_status enabled -graceful - do a graceful restart by sending a SIGUSR1 or start if not running +graceful - do a graceful restart by sending a SIGWINCH or start if not running configtest - do a configuration syntax test help - this screen
cvs commit: apache-apr/pthreads/src/modules/standard mod_status.c
manoj 99/02/14 23:43:58 Modified:pthreads/src/modules/standard mod_status.c Log: Started fixing up mod_status to deal with threads. All this does is add an extra nested loop for the different threads in each process. There is probably a better way to do this, but it works, and it has helped me find another bug. Revision ChangesPath 1.4 +36 -20apache-apr/pthreads/src/modules/standard/mod_status.c Index: mod_status.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_status.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- mod_status.c 1999/02/10 21:06:54 1.3 +++ mod_status.c 1999/02/15 07:43:57 1.4 @@ -227,11 +227,10 @@ static int status_handler(request_rec *r) { -#if 0 char *loc; time_t nowtime = time(NULL); time_t up_time; -int i, res; +int i, j, res; int ready = 0; int busy = 0; unsigned long count = 0; @@ -250,10 +249,11 @@ #endif int short_report = 0; int no_table_report = 0; -short_score score_record; +thread_score score_record; parent_score ps_record; -char stat_buffer[HARD_SERVER_LIMIT]; +char stat_buffer[HARD_SERVER_LIMIT][HARD_THREAD_LIMIT]; int pid_buffer[HARD_SERVER_LIMIT]; +int tid_buffer[HARD_SERVER_LIMIT][HARD_THREAD_LIMIT]; clock_t tu, ts, tcu, tcs; server_rec *vhost; @@ -306,12 +306,15 @@ if (r->header_only) return 0; +ap_sync_scoreboard_image(); for (i = 0; i < HARD_SERVER_LIMIT; ++i) { - score_record = ap_scoreboard_image->servers[i]; +for (j = 0; j < HARD_THREAD_LIMIT; ++j) { + score_record = ap_scoreboard_image->servers[i][j]; ps_record = ap_scoreboard_image->parent[i]; res = score_record.status; - stat_buffer[i] = status_flags[res]; + stat_buffer[i][j] = status_flags[res]; pid_buffer[i] = (int) ps_record.pid; + tid_buffer[i][j] = (int) score_record.tid; if (res == SERVER_READY) ready++; else if (res != SERVER_DEAD) @@ -335,9 +338,12 @@ } } } +} up_time = nowtime - ap_restart_time; +/* ap_hard_timeout("send status info", r); */ + if (!short_report) { ap_rputs("\nApache Status\n\n", r); ap_rputs("Apache Server Status for ", r); @@ -431,10 +437,12 @@ ap_rputs("Scoreboard: ", r); for (i = 0; i < HARD_SERVER_LIMIT; ++i) { - ap_rputc(stat_buffer[i], r); +for (j = 0; j < HARD_THREAD_LIMIT; ++j) { + ap_rputc(stat_buffer[i][j], r); if ((i % STATUS_MAXLINE == (STATUS_MAXLINE - 1)) && !short_report) ap_rputs("\n", r); } +} if (short_report) ap_rputs("\n", r); @@ -452,20 +460,22 @@ ap_rputs("\".\" Open slot with no current process\n", r); ap_rputs("\n", r); if (!ap_extended_status) { - int j = 0; + int k = 0; ap_rputs("PID Key: \n", r); ap_rputs("\n", r); for (i = 0; i < HARD_SERVER_LIMIT; ++i) { - if (stat_buffer[i] != '.') { + for (j = 0; j < HARD_SERVER_LIMIT; ++j) { + if (stat_buffer[i][j] != '.') { ap_rprintf(r, " %d in state: %c ", pid_buffer[i], - stat_buffer[i]); - if (++j >= 3) { + stat_buffer[i][j]); + if (++k >= 3) { ap_rputs("\n", r); - j = 0; + k = 0; } else ap_rputs(",", r); } } + } ap_rputs("\n", r); ap_rputs("\n", r); } @@ -478,14 +488,15 @@ else #ifdef NO_TIMES /* Allow for OS/2 not having CPU stats */ - ap_rputs("\n\nSrvPIDAccM\nSSReqConnChildSlotClientVHostRequest\n\n", r); + ap_rputs("\n\nSrvPIDTIDAccM\nSSReqConnChildSlotClientVHostRequest\n\n", r); #else - ap_rputs("\n\nSrvPIDAccMCPU\nSSReqConnChildSlotClientVHostRequest\n\n", r); + ap_rputs("\n\nSrvPIDTIDAccMCPU\nSSReqConnChildSlotClientVHostRequest\n\n", r); #endif } for (i = 0; i < HARD_SERVER_LIMIT; ++i) { - score_record = ap_scoreboard_image->servers[i]; + for (j = 0; j < HARD_THREAD_LIMIT; ++j) { + score_record = ap_scoreboard_image->servers[i][j]; ps_record =
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/14 23:48:37 Modified:pthreads/src/main http_main.c Log: Fix a buglet. Worker threads didn't note in the scoreboard when they were back in SERVER_READY state. Revision ChangesPath 1.22 +4 -3 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -u -r1.21 -r1.22 --- http_main.c 1999/02/15 07:01:57 1.21 +++ http_main.c 1999/02/15 07:48:36 1.22 @@ -2071,14 +2071,15 @@ int my_pid = ti->pid; int my_tid = ti->tid; struct sockaddr sa_client; +int csd; free(ti); -(void) ap_update_child_status(my_pid, my_tid, SERVER_READY, +while (0 < requests_this_child) { +(void) ap_update_child_status(my_pid, my_tid, SERVER_READY, (request_rec *) NULL); -while (0 < requests_this_child) { -int csd = queue_pop(&csd_queue, &sa_client); +csd = queue_pop(&csd_queue, &sa_client); if (csd >= 0) { process_socket(pchild, &sa_client, csd, my_pid, my_tid); }
cvs commit: apache-apr/pthreads/src/main fdqueue.c
manoj 99/02/15 13:58:59 Modified:pthreads/src/main fdqueue.c Log: Fix lockup bug in fdqueue.c. Because of the recent change to make queue_pop non-blocking, waits were happening without the corresponding signal. Revision ChangesPath 1.6 +3 -1 apache-apr/pthreads/src/main/fdqueue.c Index: fdqueue.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/fdqueue.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -u -r1.5 -r1.6 --- fdqueue.c 1999/02/12 20:36:59 1.5 +++ fdqueue.c 1999/02/15 21:58:58 1.6 @@ -49,7 +49,9 @@ if (pthread_mutex_lock(&queue->one_big_mutex) != 0) { return FD_QUEUE_FAILURE; } -pthread_cond_wait(&queue->not_empty, &queue->one_big_mutex); +if (queue->head == queue->tail) { +pthread_cond_wait(&queue->not_empty, &queue->one_big_mutex); +} fd = queue->data[queue->head].fd; *addr = queue->data[queue->head].addr;
cvs commit: apache-apr/pthreads/src/main http_config.c http_main.c
manoj 99/02/15 22:07:10 Modified:pthreads/src/main http_config.c http_main.c Log: The code used to assume that a 0 fd is an error, which is not the case. Now, -1 is used as the error state instead (as in apache-1.3). Revision ChangesPath 1.8 +1 -1 apache-apr/pthreads/src/main/http_config.c Index: http_config.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_config.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- http_config.c 1999/02/11 16:33:04 1.7 +++ http_config.c 1999/02/16 06:07:09 1.8 @@ -1449,7 +1449,7 @@ new->local_addr.sin_family = AF_INET; new->local_addr.sin_addr = ap_bind_address; new->local_addr.sin_port = htons(s->port ? s->port : DEFAULT_HTTP_PORT); -new->fd = NULL; +new->fd = -1; new->index = 0; new->next = NULL; ap_listeners = new; 1.27 +3 -3 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -u -r1.26 -r1.27 --- http_main.c 1999/02/15 21:04:21 1.26 +++ http_main.c 1999/02/16 06:07:09 1.27 @@ -1447,7 +1447,7 @@ return or->fd; } } -return 0; +return -1; } @@ -1476,13 +1476,13 @@ num_listenfds = 0; for (;;) { fd = find_listener(lr); - if (fd == 0) { + if (fd < 0) { fd = make_sock(p, &lr->local_addr); } else { ap_note_cleanups_for_fd(p, fd); } - if (fd) { + if (fd >= 0) { ++num_listenfds; } lr->fd = fd;
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/15 22:09:47 Modified:pthreads/src/main http_main.c Log: When we close the accept socket, we should also kill the cleanup that goes with it. Revision ChangesPath 1.28 +1 -1 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -u -r1.27 -r1.28 --- http_main.c 1999/02/16 06:07:09 1.27 +++ http_main.c 1999/02/16 06:09:46 1.28 @@ -393,7 +393,7 @@ lr = ap_listeners; while (lr->next != NULL) { -close(lr->fd); + ap_pclosesocket(pconf, lr->fd); lr= lr->next; } }
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/15 23:10:29 Modified:pthreads/src/main http_main.c Log: Clean up a nasty memory leak. Now apache-apr uses a per-connection pool (ptrans) just like Apache 1.3. Previously, pchild was used, and in my tests, there was anywhere from 12-24k of memory lost per request. Revision ChangesPath 1.29 +9 -5 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -u -r1.28 -r1.29 --- http_main.c 1999/02/16 06:09:46 1.28 +++ http_main.c 1999/02/16 07:10:27 1.29 @@ -290,6 +290,7 @@ static pool *pperm; /* Pool for permananent stuff */ static pool *pconf; /* Pool for config stuff */ +static pool *ptrans; /* Pool for per-transaction stuff */ static pool *ptemp; /* Pool for temporart config stuff */ static pool *pcommands; /* Pool for -C and -c switches */ @@ -1666,7 +1667,7 @@ /* ZZZ doesn't really make sense in a threaded server. */ } -static void process_socket(pool *ptrans, struct sockaddr *sa_client, int csd, int my_child_num, int my_thread_num) +static void process_socket(pool *p, struct sockaddr *sa_client, int csd, int my_child_num, int my_thread_num) { struct sockaddr sa_server; /* */ size_t len = sizeof(struct sockaddr); @@ -1674,7 +1675,7 @@ request_rec *r; conn_rec *current_conn; -ap_note_cleanups_for_fd(ptrans, csd); +ap_note_cleanups_for_fd(p, csd); /* ZZZ change to AP func */ if (getsockname(csd, &sa_server, &len) < 0) { @@ -1683,10 +1684,10 @@ } (void) ap_update_child_status(my_child_num, my_thread_num, SERVER_BUSY_READ, (request_rec *) NULL); -conn_io = ap_bcreate(ptrans, B_RDWR | B_SOCKET); +conn_io = ap_bcreate(p, B_RDWR | B_SOCKET); ap_bpushfd(conn_io, csd, csd); -current_conn = new_connection(ptrans, server_conf, conn_io, +current_conn = new_connection(p, server_conf, conn_io, (const struct sockaddr_in *) sa_client, (const struct sockaddr_in *) &sa_server, my_child_num, my_thread_num); @@ -1793,15 +1794,18 @@ free(ti); +ptrans = ap_make_sub_pool(pconf); while (0 < requests_this_child) { (void) ap_update_child_status(my_pid, my_tid, SERVER_READY, (request_rec *) NULL); csd = queue_pop(&csd_queue, &sa_client); if (csd >= 0) { - process_socket(pchild, &sa_client, csd, my_pid, my_tid); + process_socket(ptrans, &sa_client, csd, my_pid, my_tid); } + ap_clear_pool(ptrans); } +ap_destroy_pool(ptrans); ap_update_child_status(my_pid, my_tid, SERVER_DEAD, (request_rec *) NULL); pthread_once(&firstcall, graceful_killer);
cvs commit: apache-apr/pthreads/src/modules/standard mod_status.c
manoj 99/02/15 23:41:10 Modified:pthreads/src/modules/standard mod_status.c Log: Add some description of new scoreboard modes of operation. Revision ChangesPath 1.6 +2 -0 apache-apr/pthreads/src/modules/standard/mod_status.c Index: mod_status.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_status.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -u -r1.5 -r1.6 --- mod_status.c 1999/02/15 20:40:30 1.5 +++ mod_status.c 1999/02/16 07:41:09 1.6 @@ -457,6 +457,8 @@ ap_rputs("\"D\" DNS Lookup,\n", r); ap_rputs("\"L\" Logging, \n", r); ap_rputs("\"G\" Gracefully finishing, \n", r); + ap_rputs("\"A\" Accepting on port,\n", r); + ap_rputs("\"Q\" Queueing connection, \n", r); ap_rputs("\".\" Open slot with no current process\n", r); ap_rputs("\n", r); if (!ap_extended_status) {
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/16 16:01:54 Modified:pthreads/src/main http_main.c Log: Eep. ptrans existed in the process scope. Now there is one ptrans per thread, and it is sub-pooled off the correct "super-pool" now. This fixes some very confusing coredumps, which were confusing because there were still coredumps before the original ptrans patch, they were just caused by the lack of ptrans. Revision ChangesPath 1.35 +2 -2 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -u -r1.34 -r1.35 --- http_main.c 1999/02/16 21:37:32 1.34 +++ http_main.c 1999/02/17 00:01:45 1.35 @@ -288,7 +288,6 @@ static pool *pperm; /* Pool for permananent stuff */ static pool *pconf; /* Pool for config stuff */ -static pool *ptrans; /* Pool for per-transaction stuff */ static pool *ptemp; /* Pool for temporart config stuff */ static pool *pcommands; /* Pool for -C and -c switches */ @@ -2313,10 +2312,11 @@ int my_tid = ti->tid; struct sockaddr sa_client; int csd; +pool *ptrans;/* Pool for per-transaction stuff */ free(ti); -ptrans = ap_make_sub_pool(pconf); +ptrans = ap_make_sub_pool(pchild); while (0 < requests_this_child) { (void) ap_update_child_status(my_pid, my_tid, SERVER_READY, (request_rec *) NULL);
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/16 16:03:43 Modified:pthreads/src/main http_main.c Log: Get rid of some more debugging messages which were clogging the error log. Revision ChangesPath 1.36 +0 -2 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -u -r1.35 -r1.36 --- http_main.c 1999/02/17 00:01:45 1.35 +++ http_main.c 1999/02/17 00:03:41 1.36 @@ -2219,10 +2219,8 @@ while ((r = ap_read_request(current_conn)) != NULL) { (void) ap_update_child_status(my_child_num, my_thread_num, SERVER_BUSY_WRITE, r); - fprintf(stderr,"%d child_main: about to process request\n",my_child_num); if (r->status == HTTP_OK) ap_process_request(r); - fprintf(stderr,"%d child_main: request done\n",my_child_num); if (ap_extended_status) increment_counts(my_child_num, my_thread_num, r); if (!current_conn->keepalive || ap_is_aborted(current_conn))
cvs commit: apache-apr STATUS
manoj 99/02/16 17:08:19 Modified:.STATUS Log: I really have to get this song out of my head. Revision ChangesPath 1.8 +2 -4 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- STATUS1999/02/16 16:04:10 1.7 +++ STATUS1999/02/17 01:08:18 1.8 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/02/16 16:04:10 $] +Last modified at [$Date: 1999/02/17 01:08:18 $] Release: @@ -25,14 +25,12 @@ Mod_status Re-write mod_status to use updated scoreboard for hybrid server. +This is pretty close to completion. Accept Serialization across Processes Currently, we use one mutex total, we need to change this to be one mutex per socket. Possibly, we could attach the mutex to the listen_rec, and pass it down to the accept loop. - -Memory leakage - It looks like we are leaking, we need to find out why and where. Timeouts. (only soft timeouts)
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/16 21:32:02 Modified:pthreads/src/main http_main.c Log: pthread calls while handling a signal are bad voodoo. This is another way to allow cleanups to run after all threads exit. Revision ChangesPath 1.37 +11 -10apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -u -r1.36 -r1.37 --- http_main.c 1999/02/17 00:03:41 1.36 +++ http_main.c 1999/02/17 05:32:00 1.37 @@ -431,13 +431,6 @@ ap_pclosesocket(pconf, lr->fd); lr= lr->next; } - -for (i = 0; i < ss->worker_threads + ss->acceptor_threads; i++) { -if (ap_scoreboard_image->servers[index][i].status != SERVER_DEAD) { - pthread_join(ap_scoreboard_image->servers[index][i].tid, NULL); - } -} -clean_child_exit(0); } /** ZZZ this should probably be abstracted to it's own file. / @@ -2300,7 +2293,7 @@ } ap_update_child_status(my_pid, my_tid, SERVER_DEAD, (request_rec *) NULL); pthread_once(&firstcall, graceful_killer); -pthread_exit(NULL); +return NULL; } void * worker_thread(void * dummy) @@ -2328,8 +2321,7 @@ ap_destroy_pool(ptrans); ap_update_child_status(my_pid, my_tid, SERVER_DEAD, (request_rec *) NULL); pthread_once(&firstcall, graceful_killer); - -pthread_exit(NULL); +return NULL; } /* @@ -2573,6 +2565,15 @@ lr->used = 1; accept_thread(my_info); + +/* Wait for other threads to die, then clean up. Note: joining oneself is + * a bad thing, so we make sure that i < my_info->tid, not <= */ +for (i = 0; i < my_info->tid; i++) { +if (ap_scoreboard_image->servers[my_child_num][i].status != SERVER_DEAD) { + pthread_join(ap_scoreboard_image->servers[my_child_num][i].tid, NULL); + } +} +clean_child_exit(0); } static int make_child(server_rec *s, int slot, time_t now) /* ZZZ */
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/17 00:13:16 Modified:.STATUS pthreads/src/main http_main.c Log: Start to remove pthread calls from clean_child_exit to make it legal for a signal handler. There is still a pthread_cancel loop, which seems to work sometimes for killing hanging threads, but not all the time. The real solution is to fix the hanging threads, which seem to be caused by the (accidental?) usage of a cross-process alloc_mutex. The last commit message was messed up. That patch didn't undo any pthread calls during signal handling, but it is still necessary because it prevents the thread from trying to join itself. I need someone to show me how to change stupid commit messages. Revision ChangesPath 1.9 +3 -1 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.8 retrieving revision 1.9 diff -u -u -r1.8 -r1.9 --- STATUS1999/02/17 01:08:18 1.8 +++ STATUS1999/02/17 08:13:13 1.9 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/02/17 01:08:18 $] +Last modified at [$Date: 1999/02/17 08:13:13 $] Release: @@ -40,6 +40,8 @@ Everything Needs patch: + * A patch to make the alloc_mutex's scope per-process. It seems to be +causing trouble on Linux at least. Open issues: 1.38 +17 -3 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -u -r1.37 -r1.38 --- http_main.c 1999/02/17 05:32:00 1.37 +++ http_main.c 1999/02/17 08:13:15 1.38 @@ -397,14 +397,29 @@ listen_rec *lr; parent_score *ss = &ap_scoreboard_image->parent[child_num]; +/* XXX - This should be taken care of by the parent process. When it reaps + * the child, it will also update the scoreboard. We can't do this here, + * because clean_child_exit can be called from a signal handler, and + * ap_update_child_status calls pthread_self */ +#if 0 for (i = 0; i < ap_threads_per_child + ap_acceptors_per_child; i++) ap_update_child_status(child_num, i, SERVER_DEAD, (request_rec *) NULL); +#endif if (pchild) { ap_child_exit_modules(pchild, server_conf); ap_destroy_pool(pchild); } +/* XXX - This is not allowed in a signal handler either, and it shouldn't + * be needed. But it's still in here, because without it, we get hanging + * threads on linux. The symptom isn't *too* bad on Linux: a core dump in + * the exit() library call. + * + * The root cause seems to be that alloc's pthread mutex is being used + * across processes, which is not kosher on some platforms (i.e. Linux), + * and a thread whacking a pool will hit an acquire_mutex and hang */ + for (i = 0; i < ss->worker_threads + ss->acceptor_threads; i++) { if (ap_scoreboard_image->servers[child_num][i].status != SERVER_DEAD) { pthread_cancel(ap_scoreboard_image->servers[child_num][i].tid); @@ -2811,9 +2826,8 @@ if (pid >= 0) { child_slot = find_child_by_pid(0); if (child_slot >= 0) { - /*(void) ap_update_child_status(child_slot, SERVER_DEAD, - (request_rec *) NULL); - LOOK INTO THIS */ +for (i = 0; i < ap_threads_per_child + ap_acceptors_per_child; i++) +ap_update_child_status(child_slot, i, SERVER_DEAD, (request_rec *) NULL); if (remaining_children_to_start && child_slot < ap_daemons_limit) {
cvs commit: apache-apr/pthreads/src Configure
manoj 99/02/17 00:29:12 Modified:pthreads/src Configure Log: Patch for Linux 2.x. Both the LinuxThreads home page and /usr/include/features.h from glibc 2.0 say that -D_REENTRANT should be used for compiling threaded programs. gcc provides a -pthread option which gives us this for free, so let's switch to it. Doesn't fix any known bugs, but it doesn't seem to break anything and I imagine this fixed some unknown bugs. Revision ChangesPath 1.4 +2 -2 apache-apr/pthreads/src/Configure Index: Configure === RCS file: /home/cvs/apache-apr/pthreads/src/Configure,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- Configure 1999/02/07 06:29:09 1.3 +++ Configure 1999/02/17 08:29:11 1.4 @@ -414,8 +414,8 @@ *-linux2) DEF_WANTHSREGEX=yes OS='Linux' - CFLAGS="$CFLAGS -DLINUX=2" - LIBS="$LIBS -lm -lpthread" + CFLAGS="$CFLAGS -DLINUX=2 -pthread" + LIBS="$LIBS -lm" ;; *-linux1) DEF_WANTHSREGEX=yes
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/17 12:28:57 Modified:pthreads/src/main http_main.c Log: First, fix unbalanced locking and unlocking of the exit_mutex (which will hopefully go away when we switch to a single signal-handling thread). Also get rid of a malloc-free pair. Revision ChangesPath 1.42 +13 -11apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -u -r1.41 -r1.42 --- http_main.c 1999/02/17 18:42:01 1.41 +++ http_main.c 1999/02/17 20:28:56 1.42 @@ -176,7 +176,7 @@ int ap_listenbacklog; int ap_dump_settings = 0; int exiting_now = 0; -pthread_mutex_t *exit_mutex; +pthread_mutex_t exit_mutex = PTHREAD_MUTEX_INITIALIZER; API_VAR_EXPORT int ap_extended_status = 0; @@ -406,7 +406,6 @@ ap_destroy_pool(pchild); } -free(exit_mutex); exit(code); } @@ -2288,13 +2287,16 @@ } } ap_update_child_status(my_pid, my_tid, SERVER_DEAD, (request_rec *) NULL); -pthread_mutex_lock(exit_mutex); +pthread_mutex_lock(&exit_mutex); if (exiting_now == 0) { exiting_now++; - pthread_mutex_unlock(exit_mutex); + pthread_mutex_unlock(&exit_mutex); graceful_killer(); clean_child_exit(0); -} +} +else { +pthread_mutex_unlock(&exit_mutex); +} pthread_exit(NULL); } @@ -2323,13 +2325,16 @@ } ap_destroy_pool(ptrans); ap_update_child_status(my_pid, my_tid, SERVER_DEAD, (request_rec *) NULL); -pthread_mutex_lock(exit_mutex); +pthread_mutex_lock(&exit_mutex); if (exiting_now == 0) { exiting_now++; - pthread_mutex_unlock(exit_mutex); + pthread_mutex_unlock(&exit_mutex); graceful_killer(); clean_child_exit(0); -} +} +else { +pthread_mutex_unlock(&exit_mutex); +} pthread_exit(NULL); } @@ -2470,9 +2475,6 @@ requests_this_child = ap_max_requests_per_child; pchild = ap_make_sub_pool(pconf); - -exit_mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t)); -pthread_mutex_init(exit_mutex, NULL); /*stuff to do before we switch id's, so we have permissions.*/ reopen_scoreboard(pchild);
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/17 21:39:53 Modified:pthreads/src/main http_main.c Log: During graceful restart we close our listeners to kick our threads out of accept(), we seem to be missing the first file descriptor, probably because of an errant cut-and-paste. I think this bug didn't show up on Linux because in the single port case, the only thread doing the accept is the "parent" thread, which is guaranteed to be hit by a signal and interrupted. Revision ChangesPath 1.44 +2 -2 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -u -r1.43 -r1.44 --- http_main.c 1999/02/17 22:39:43 1.43 +++ http_main.c 1999/02/18 05:39:52 1.44 @@ -418,10 +418,10 @@ pthread_cond_broadcast(&(csd_queue.not_empty)); -/* Setup acceptor threads */ +/* Kick acceptor threads out of accept */ lr = ap_listeners; -while (lr->next != NULL) { +while (lr != NULL) { ap_pclosesocket(pconf, lr->fd); lr= lr->next; }
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/02/17 21:43:52 Modified:pthreads/src/main http_main.c Log: More SIGUSR1 -> SIGWINCH changes. Revision ChangesPath 1.45 +4 -4 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -u -r1.44 -r1.45 --- http_main.c 1999/02/18 05:39:52 1.44 +++ http_main.c 1999/02/18 05:43:51 1.45 @@ -182,7 +182,7 @@ /* * The max child slot ever assigned, preserved across restarts. Necessary - * to deal with MaxClients changes across SIGUSR1 restarts. We use this + * to deal with MaxClients changes across SIGWINCH restarts. We use this * value to optimize routines that have to scan the entire scoreboard. */ static int max_daemons_limit = -1; @@ -576,7 +576,7 @@ sigfillset(&accept_block_mask); sigdelset(&accept_block_mask, SIGHUP); sigdelset(&accept_block_mask, SIGTERM); -sigdelset(&accept_block_mask, SIGUSR1); +sigdelset(&accept_block_mask, SIGWINCH); ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); } @@ -1678,9 +1678,9 @@ #ifdef SIGHUP signal(SIGHUP, restart); #endif /* SIGHUP */ -#ifdef SIGUSR1 +#ifdef SIGWINCH signal(SIGWINCH, restart); -#endif /* SIGUSR1 */ +#endif /* SIGWINCH */ #endif }
cvs commit: apache-apr/pthreads/src Configure
manoj 99/02/21 23:36:00 Modified:pthreads/src Configure Log: AIX needs this flag to build the hybrid server correctly. We only enable it for 4.2 and 4.3 so far, because we haven't even tried this on a 4.1 or earlier box yet. Revision ChangesPath 1.5 +2 -2 apache-apr/pthreads/src/Configure Index: Configure === RCS file: /home/cvs/apache-apr/pthreads/src/Configure,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- Configure 1999/02/17 08:29:11 1.4 +++ Configure 1999/02/22 07:36:00 1.5 @@ -302,12 +302,12 @@ ;; *-ibm-aix4.2) OS='IBM AIX 4.2' - CFLAGS="$CFLAGS -DAIX=42 -U__STR__" + CFLAGS="$CFLAGS -DAIX=42 -U__STR__ -lpthread" LDFLAGS="$LDFLAGS -lm" ;; *-ibm-aix4.3) OS='IBM AIX 4.3' - CFLAGS="$CFLAGS -DAIX=43 -U__STR__" + CFLAGS="$CFLAGS -DAIX=43 -U__STR__ -lpthread" LDFLAGS="$LDFLAGS -lm" ;; *-ibm-aix*)
cvs commit: apache-apr/pthreads/src/main fdqueue.c http_main.c
manoj 99/02/21 23:49:34 Modified:pthreads/src/include fdqueue.h pthreads/src/main fdqueue.c http_main.c Log: Change the fdqueue's handling of blocking when there are no idle threads. Advantages: - We used to add to the queue before checking if it was full. Fixed. - The server was responding to almost no requests. I think the above is why. - The fdqueue no longer requires that the space allocated for the queue be equal to the number of worker threads. This means that if we want to change scheduling policies in the future to allow a changing number of worker threads in the future, we can do so. Revision ChangesPath 1.4 +1 -1 apache-apr/pthreads/src/include/fdqueue.h Index: fdqueue.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/fdqueue.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- fdqueue.h 1999/02/19 20:33:21 1.3 +++ fdqueue.h 1999/02/22 07:49:32 1.4 @@ -25,6 +25,7 @@ int bounds; int blanks; pthread_mutex_t one_big_mutex; +pthread_cond_t thread_is_idle; pthread_cond_t not_empty; pthread_cond_t not_full; } FDQueue; @@ -34,6 +35,5 @@ int queue_push(FDQueue *queue, int fd, struct sockaddr *addr); int queue_pop(FDQueue *queue, struct sockaddr *addr); int queue_size(FDQueue *queue); -int increase_blanks(FDQueue *queue); #endif /* FDQUEUE_H */ 1.9 +30 -19apache-apr/pthreads/src/main/fdqueue.c Index: fdqueue.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/fdqueue.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -u -r1.8 -r1.9 --- fdqueue.c 1999/02/21 03:20:05 1.8 +++ fdqueue.c 1999/02/22 07:49:33 1.9 @@ -6,12 +6,15 @@ int queue_init(FDQueue *queue, size_t bounds, pool *a) { int i; pthread_mutex_init(&queue->one_big_mutex, NULL); +pthread_cond_init(&queue->thread_is_idle, NULL); pthread_cond_init(&queue->not_empty, NULL); pthread_cond_init(&queue->not_full, NULL); queue->head = queue->tail = 0; +/* Note, bounds is being increased to account for the bookkeeping slot */ queue->data = ap_palloc(a, (++bounds) * sizeof(FDQueueElement)); queue->bounds = bounds; -queue->blanks = bounds - 1; +/* A thread isn't idle until it has asked for a connection */ +queue->blanks = 0; ap_register_cleanup(a, queue, (void (*)(void *))queue_destroy, ap_null_cleanup); for (i=0; i < bounds; ++i) queue->data[i].fd = -1; @@ -20,6 +23,7 @@ void *queue_destroy(FDQueue *queue) { /* Ignore errors here, we can't do anything about them anyway */ +pthread_cond_destroy(&queue->thread_is_idle); pthread_cond_destroy(&queue->not_empty); pthread_cond_destroy(&queue->not_full); pthread_mutex_destroy(&queue->one_big_mutex); @@ -29,17 +33,29 @@ if (pthread_mutex_lock(&queue->one_big_mutex) != 0) { return FD_QUEUE_FAILURE; } +while (queue->head == ((queue->tail + 1) % queue->bounds)) { +pthread_cond_wait(&queue->not_full, &queue->one_big_mutex); +} queue->data[queue->tail].fd = fd; queue->data[queue->tail].addr = *addr; +/* If the queue was empty, signal that it no longer is */ +/* if (queue->head == queue->tail) { */ +pthread_cond_signal(&queue->not_empty); +/* } */ queue->tail = (queue->tail + 1) % queue->bounds; queue->blanks--; -pthread_cond_signal(&queue->not_empty); -if (queue->blanks == 0) { -pthread_cond_wait(&queue->not_full, &queue->one_big_mutex); + +/* If the content in the queue is enough to satisfy all of our threads, + * then wait until this is no longer the case so that we don't accept + * connections we can't handle */ +while (queue->blanks <= 0) { +pthread_cond_wait(&queue->thread_is_idle, &queue->one_big_mutex); } + if (pthread_mutex_unlock(&queue->one_big_mutex) != 0) { return FD_QUEUE_FAILURE; } +return FD_QUEUE_SUCCESS; } int queue_pop(FDQueue *queue, struct sockaddr *addr) { @@ -47,7 +63,13 @@ if (pthread_mutex_lock(&queue->one_big_mutex) != 0) { return FD_QUEUE_FAILURE; } -if (queue->blanks >= queue->bounds - 1) { + +if (queue->blanks <= 0) { +pthread_cond_signal(&queue->thread_is_idle); +} +queue->blanks++; + +if (queue->head == queue->tail)
cvs commit: apache-apr/pthreads/src/main http_protocol.c
manoj 99/03/03 16:07:00 Modified:pthreads/src/main http_protocol.c Log: Allow the code to compile on AIX. Revision ChangesPath 1.8 +2 -2 apache-apr/pthreads/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_protocol.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- http_protocol.c 1999/02/26 16:37:20 1.7 +++ http_protocol.c 1999/03/04 00:06:58 1.8 @@ -956,8 +956,8 @@ else if (rv == -1) { ap_bclose(r->connection->client); ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Timeout hasn't occured, but something is wrong, - closing the connection."); + "Timeout hasn't occured, but something is wrong, " + "closing the connection."); } else { if (filedes->revents &= POLLIN) {
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/03/16 13:26:27 Modified:pthreads/src/main http_main.c Log: Allow the server to exit in single-process (-X) mode when we hit Ctrl-C. This involves making the server respond to SIGINT like it does with SIGTERM in the signal-handling thread. Revision ChangesPath 1.59 +4 -0 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.58 retrieving revision 1.59 diff -u -u -r1.58 -r1.59 --- http_main.c 1999/03/15 15:34:50 1.58 +++ http_main.c 1999/03/16 21:26:26 1.59 @@ -2103,6 +2103,7 @@ sigemptyset(&sig_mask); sigaddset(&sig_mask, SIGWINCH); sigaddset(&sig_mask, SIGTERM); +sigaddset(&sig_mask, SIGINT); sigwait(&sig_mask, &signal_received); /* XXX - Do the appropriate thing for each signal */ switch (signal_received) { @@ -2114,6 +2115,9 @@ case SIGTERM: just_die(SIGTERM); break; +case SIGINT: +just_die(SIGINT); +break; default: ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, "received strange signal: %d", signal_received);
cvs commit: apache-apr/pthreads/src/modules/standard mod_so.c
manoj 99/03/16 14:07:58 Modified:pthreads/src/main http_config.c http_log.c http_main.c http_protocol.c pthreads/src/modules/standard mod_so.c Log: More SIGUSR1 -> SIGWINCH fixes. This should fix every mention of USR1 for restarts except for the documentation. Revision ChangesPath 1.10 +2 -7 apache-apr/pthreads/src/main/http_config.c Index: http_config.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_config.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -u -r1.9 -r1.10 --- http_config.c 1999/02/16 16:00:48 1.9 +++ http_config.c 1999/03/16 22:07:55 1.10 @@ -1523,14 +1523,9 @@ #ifdef SIGHUP signal(SIGHUP, SIG_IGN); #endif -/* XXX - LinuxThreads uses SIGUSR1, so we can't muck with it. Bummer. We - * need to find another way to do graceful restarts if we want to support - * kernel threads with Linux 2.0 (2.2 is supposed to fix this) - mvsk */ -#ifndef LINUX -#ifdef SIGUSR1 -signal(SIGUSR1, SIG_IGN); +#ifdef SIGWINCH +signal(SIGWINCH, SIG_IGN); #endif -#endif /* ndef LINUX */ for (m = top_module; m; m = m->next) if (m->child_exit) 1.3 +1 -1 apache-apr/pthreads/src/main/http_log.c Index: http_log.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_log.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- http_log.c1999/02/07 06:29:30 1.2 +++ http_log.c1999/03/16 22:07:55 1.3 @@ -482,7 +482,7 @@ fname = ap_server_root_relative(p, fname); mypid = getpid(); if (mypid != saved_pid && stat(fname, &finfo) == 0) { - /* USR1 and HUP call this on each restart. + /* WINCH and HUP call this on each restart. * Only warn on first time through for this pid. * * XXX: Could just write first time through too, although 1.60 +0 -7 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.59 retrieving revision 1.60 diff -u -u -r1.59 -r1.60 --- http_main.c 1999/03/16 21:26:26 1.59 +++ http_main.c 1999/03/16 22:07:55 1.60 @@ -2079,13 +2079,6 @@ /* All threads should mask signals out, accoring to sigwait(2) man page */ sigemptyset(&sig_mask); -/* Linux 2.0 and its annoying use of SIGUSR{1,2} */ -#ifdef LINUX -/* -sigaddset(&sig_mask, SIGUSR1); -sigaddset(&sig_mask, SIGUSR2); -*/ -#endif if (pthread_sigmask(SIG_SETMASK, &sig_mask, NULL) != 0) { ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, "pthread_sigmask"); 1.10 +2 -7 apache-apr/pthreads/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_protocol.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -u -r1.9 -r1.10 --- http_protocol.c 1999/03/15 14:26:50 1.9 +++ http_protocol.c 1999/03/16 22:07:55 1.10 @@ -789,14 +789,9 @@ } /* we've probably got something to do, ignore graceful restart requests */ -/* XXX - LinuxThreads uses SIGUSR1, so we can't muck with it. Bummer. We - * need to find another way to do graceful restarts if we want to support - * kernel threads with Linux 2.0 (2.2 is supposed to fix this) - mvsk */ -#ifndef LINUX -#ifdef SIGUSR1 -signal(SIGUSR1, SIG_IGN); +#ifdef SIGWINCH +signal(SIGWINCH, SIG_IGN); #endif -#endif /* ndef LINUX */ ap_bsetflag(conn->client, B_SAFEREAD, 0); 1.3 +2 -2 apache-apr/pthreads/src/modules/standard/mod_so.c Index: mod_so.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_so.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- mod_so.c 1999/02/07 06:29:55 1.2 +++ mod_so.c 1999/03/16 22:07:58 1.3 @@ -58,7 +58,7 @@ /* * This module is used to load Apache modules at runtime. This means that the * server functionality can be extended without recompiling and even without - * taking the server down at all. Only a HUP or USR1 signal needs to be send + * taking the server down at all. Only a HUP or WINCH signal needs to be send * to the server to reload the dynamically loaded modules. * * To use, you'll first need to build your module as a shared libra
cvs commit: apache-apr/pthreads/src/support ab.1 ab.c apachectl apachectl.1 apxs.pl dbmmanage.1 htpasswd.c httpd.exp suexec.c
manoj 99/03/17 09:02:13 Modified:pthreads ABOUT_APACHE INSTALL Makefile.tmpl README.configure config.layout configure pthreads/conf httpd.conf-dist httpd.conf-dist-win mime.types pthreads/htdocs/manual content-negotiation.html handler.html index.html sections.html pthreads/htdocs/manual/misc API.html FAQ.html pthreads/htdocs/manual/mod core.html directives.html mod_alias.html mod_negotiation.html mod_so.html pthreads/htdocs/manual/vhosts details.html name-based.html pthreads/src ApacheCore.def CHANGES Configure Makefile.tmpl Makefile_win32.txt Makefile_win32_debug.txt pthreads/src/ap ap_execve.c pthreads/src/helpers GuessOS PrintPath TestCompile binbuild.sh buildinfo.sh find-dbm-lib install.sh slo.sh pthreads/src/include alloc.h ap_config.h ap_ctype.h ap_mmn.h http_config.h http_request.h httpd.h pthreads/src/main alloc.c buff.c gen_test_char.c http_config.c http_core.c http_log.c http_main.c http_protocol.c http_request.c scoreboard.c util.c util_date.c util_script.c pthreads/src/modules/proxy mod_proxy.c mod_proxy.h proxy_cache.c proxy_connect.c proxy_ftp.c proxy_http.c proxy_util.c pthreads/src/modules/standard mod_cgi.c mod_include.c mod_negotiation.c mod_rewrite.c mod_rewrite.h mod_so.c mod_userdir.c pthreads/src/os/bs2000 os.h pthreads/src/os/os2 os.h util_os2.c pthreads/src/os/win32 os.h util_win32.c pthreads/src/os/win32/installer/installdll install.c install.dsp install.mak pthreads/src/os/win32/installer/installdll/test resource.h test.c test.mak test.rc pthreads/src/support ab.1 ab.c apachectl apachectl.1 apxs.pl dbmmanage.1 htpasswd.c httpd.exp suexec.c Log: Update apache-pthreads to the current state of Apache 1.3 as of around 9PM PST, Mar 16. Revision ChangesPath 1.2 +17 -14apache-apr/pthreads/ABOUT_APACHE Index: ABOUT_APACHE === RCS file: /home/cvs/apache-apr/pthreads/ABOUT_APACHE,v retrieving revision 1.1 retrieving revision 1.2 diff -u -u -r1.1 -r1.2 --- ABOUT_APACHE 1999/01/21 23:08:29 1.1 +++ ABOUT_APACHE 1999/03/17 16:59:14 1.2 @@ -3,7 +3,7 @@ http://www.apache.org/ - September 1998 + February 1999 The Apache Project is a collaborative software development effort aimed at creating a robust, commercial-grade, featureful, and freely-available @@ -65,17 +65,20 @@ Less than a year after the group was formed, the Apache server passed NCSA's httpd as the #1 server on the Internet. +The survey by Netcraft (http://www.netcraft.com/survey/) shows that Apache +is today more widely used than all other web servers combined. + -Current Apache Group in alphabetical order as of 23 September 1998: +Current Apache Group in alphabetical order as of 14 February 1999: - Brian Behlendorf Organic Online, California + Brian Behlendorf O'Reilly and Associates, California Ken Coar IBM Corporation, Research Triangle Park, NC, USA Mark J. CoxC2Net Europe, UK - Lars EilebrechtKreuztal, Germany + Lars EilebrechtCable & Wireless ECRC, Munich, Germany Ralf S. EngelschallMunich, Germany. Roy T. FieldingUC Irvine, California - Dean GaudetTransmeta Corporation, California + Dean GaudetCritical Path, California Rob HartillInternet Movie DB, UK Ben Hyde Gensym, Massachusetts Jim Jagielski jaguNET ISP, Maryland @@ -85,11 +88,11 @@ Doug MacEachernFreelance Consultant, Summer Seasons, Earth Aram W. Mirzadeh Qosina Corporation, New York Sameer Parekh C2Net, California - Marc SlemkoCanada Cliff Skolnick Freelance, California + Marc SlemkoCanada Bill Stoddard IBM Corp., Research Triangle Park, NC Paul SuttonC2Net Europe, UK - Randy Terbush Zyzzyva ISP, Nebraska + Randy Terbush Covalent Technologies, Nebraska Dirk-Willem van Gulik Freela
cvs commit: apache-1.3/src/main http_main.c
manoj 99/03/17 15:05:47 Modified:src/main http_main.c Log: Small bugfix. A child process used to exit after MaxRequestsPerChild - 1 requests. This patch puts the increment of requests_this_child after the ap_max_requests_per_child check so the server will process that one last request before dying. Revision ChangesPath 1.427 +1 -1 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.426 retrieving revision 1.427 diff -u -u -r1.426 -r1.427 --- http_main.c 1999/03/10 11:06:10 1.426 +++ http_main.c 1999/03/17 23:05:43 1.427 @@ -3621,7 +3621,7 @@ #ifndef WIN32 if ((ap_max_requests_per_child > 0 - && ++requests_this_child >= ap_max_requests_per_child)) { + && requests_this_child++ >= ap_max_requests_per_child)) { clean_child_exit(0); } #else
cvs commit: apache-apr/pthreads/src/test test_find.c test_parser.c
manoj 99/03/17 21:37:51 Added: pthreads/src/test test_find.c test_parser.c Log: New files from Apache 1.3 as part of the latest sync-up. Revision ChangesPath 1.1 apache-apr/pthreads/src/test/test_find.c Index: test_find.c === /* This program tests the ap_find_list_item routine in ../main/util.c. * * The defines in this sample compile line are specific to Roy's system. * They should match whatever was used to compile Apache first. * gcc -g -O2 -I../os/unix -I../include -o test_find \ -DSOLARIS2=250 -Wall -DALLOC_DEBUG -DPOOL_DEBUG \ ../main/alloc.o ../main/buff.o ../main/util.o \ ../ap/libap.a -lsocket -lnsl test_find.c * * Roy Fielding, 1999 */ #include #include #include "httpd.h" #include "alloc.h" /* * Dummy a bunch of stuff just to get a compile */ uid_t ap_user_id; gid_t ap_group_id; void *ap_dummy_mutex = &ap_dummy_mutex; char *ap_server_argv0; API_EXPORT(void) ap_block_alarms(void) { ; } API_EXPORT(void) ap_unblock_alarms(void) { ; } API_EXPORT(void) ap_log_error(const char *file, int line, int level, const request_rec *r, const char *fmt, ...) { ; } int main (void) { ap_pool *p; char line[512]; char tok[512]; p = ap_init_alloc(); printf("Enter field value to find items within:\n"); if (!gets(line)) exit(0); printf("Enter search item:\n"); while (gets(tok)) { printf(" [%s] == %s\n", tok, ap_find_list_item(p, line, tok) ? "Yes" : "No"); printf("Enter search item:\n"); } exit(0); } 1.1 apache-apr/pthreads/src/test/test_parser.c Index: test_parser.c === /* This program tests the ap_get_list_item routine in ../main/util.c. * * The defines in this sample compile line are specific to Roy's system. * They should match whatever was used to compile Apache first. * gcc -g -O2 -I../os/unix -I../include -o test_parser \ -DSOLARIS2=250 -Wall -DALLOC_DEBUG -DPOOL_DEBUG \ ../main/alloc.o ../main/buff.o ../main/util.o \ ../ap/libap.a -lsocket -lnsl test_parser.c * * Roy Fielding, 1999 */ #include #include #include "httpd.h" #include "alloc.h" /* * Dummy a bunch of stuff just to get a compile */ uid_t ap_user_id; gid_t ap_group_id; void *ap_dummy_mutex = &ap_dummy_mutex; char *ap_server_argv0; API_EXPORT(void) ap_block_alarms(void) { ; } API_EXPORT(void) ap_unblock_alarms(void) { ; } API_EXPORT(void) ap_log_error(const char *file, int line, int level, const request_rec *r, const char *fmt, ...) { ; } int main (void) { ap_pool *p; const char *field; char *newstr; char instr[512]; p = ap_init_alloc(); while (gets(instr)) { printf(" [%s] ==\n", instr); field = instr; while ((newstr = ap_get_list_item(p, &field)) != NULL) printf(" <%s> ..\n", newstr); } exit(0); }
cvs commit: apache-apr/pthreads/src/main http_main.c http_protocol.c
manoj 99/03/21 02:42:36 Modified:pthreads/src/main http_main.c http_protocol.c Log: Make MaxRequestsPerChild work in the threaded server again (well at least it works like the process server works). This consists of a few changes: - We need to actually count requests. In the pthreads port, we do this by decrementing requests_this_child - Send a SIGWINCH when we reach the accept_thread, to alert the rest of the process to its eventual demise - Temporarily comment out a SIG_IGN setting for SIGWINCH in http_protocol.c. Otherwise, sigwait() won't see reliably see a SIGWINCH, and the SIG_IGN isn't needed in a server with a signal-handling thread anyway. Revision ChangesPath 1.63 +12 -0 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.62 retrieving revision 1.63 diff -u -u -r1.62 -r1.63 --- http_main.c 1999/03/19 14:02:03 1.62 +++ http_main.c 1999/03/21 10:42:34 1.63 @@ -1804,6 +1804,7 @@ csd = -1; } else { +requests_this_child--; csd = accept(sd, &sa_client, &len); SAFE_ACCEPT(accept_mutex_off(my_tid - ap_threads_per_child)); } @@ -1817,6 +1818,16 @@ } } } + +/* Raise SIGWINCH so that all the actions that go with a gradual, + * graceful shutdown of the process get done. + * + * The reason this thread is actually going through the trouble to + * look up its own process ID is because under Red Hat 5.2, getpid() + * actually returns the "process ID" of the thread, since threads + * are just processes that share everything. I hope this is fixed in + * glibc 2.1 & Linux 2.2. - mvsk */ +kill(ap_scoreboard_image->parent[my_pid].pid, SIGWINCH); ap_update_child_status(my_pid, my_tid, SERVER_DEAD, (request_rec *) NULL); return NULL; } @@ -2146,6 +2157,7 @@ if (one_process) { set_signals(); +ap_scoreboard_image->parent[slot].pid = getpid(); child_main(slot); } 1.13 +7 -0 apache-apr/pthreads/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_protocol.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -u -r1.12 -r1.13 --- http_protocol.c 1999/03/17 20:00:40 1.12 +++ http_protocol.c 1999/03/21 10:42:34 1.13 @@ -806,9 +806,16 @@ } /* we've probably got something to do, ignore graceful restart requests */ +/* XXX - sigwait doesn't work if the signal has been SIG_IGNed (under + * linux 2.0 w/ glibc 2.0, anyway), and this step isn't necessary when + * we're running a sigwait thread anyway. If/when unthreaded mode is put + * back in, we should make sure to ignore this signal iff a sigwait thread + * isn't used. - mvsk + #ifdef SIGWINCH signal(SIGWINCH, SIG_IGN); #endif +*/ ap_bsetflag(conn->client, B_SAFEREAD, 0);
cvs commit: apache-apr/pthreads/src/main http_main.c http_protocol.c
manoj 99/03/21 02:51:46 Modified:pthreads/src/main http_main.c http_protocol.c Log: Add a comment related to the previous patch, and rewrap another one. Revision ChangesPath 1.64 +2 -0 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -u -r1.63 -r1.64 --- http_main.c 1999/03/21 10:42:34 1.63 +++ http_main.c 1999/03/21 10:51:43 1.64 @@ -2157,6 +2157,8 @@ if (one_process) { set_signals(); + /* Needed even in the one process case because lookup of the process + * pid sometimes must go through the scoreboard */ ap_scoreboard_image->parent[slot].pid = getpid(); child_main(slot); } 1.14 +3 -3 apache-apr/pthreads/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_protocol.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -u -r1.13 -r1.14 --- http_protocol.c 1999/03/21 10:42:34 1.13 +++ http_protocol.c 1999/03/21 10:51:44 1.14 @@ -808,9 +808,9 @@ /* XXX - sigwait doesn't work if the signal has been SIG_IGNed (under * linux 2.0 w/ glibc 2.0, anyway), and this step isn't necessary when - * we're running a sigwait thread anyway. If/when unthreaded mode is put - * back in, we should make sure to ignore this signal iff a sigwait thread - * isn't used. - mvsk + * we're running a sigwait thread anyway. If/when unthreaded mode is + * put back in, we should make sure to ignore this signal iff a sigwait + * thread isn't used. - mvsk #ifdef SIGWINCH signal(SIGWINCH, SIG_IGN);
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/03/22 12:38:04 Modified:pthreads/src/main http_main.c Log: Revision ChangesPath 1.66 +22 -12apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.65 retrieving revision 1.66 diff -u -u -r1.65 -r1.66 --- http_main.c 1999/03/22 20:10:41 1.65 +++ http_main.c 1999/03/22 20:38:03 1.66 @@ -218,6 +218,10 @@ /* The queue of sockets we've accepted */ static FDQueue csd_queue; +/* Indicates that all acceptor threads are dead after SIGWINCH and the worker + * threads can now exit */ +static int workers_may_exit = 0; + /* stuff that needs thread local store in main */ typedef struct { jmp_buf thread_exit; @@ -417,7 +421,14 @@ void kill_workers(void) { +int i; +int index = find_child_by_pid(getpid()); +parent_score *ss = &ap_scoreboard_image->parent[index]; + pthread_cond_broadcast(&(csd_queue.not_empty)); +for (i = 0; i < ss->worker_threads; i++) { + pthread_join(ap_scoreboard_image->servers[index][i].tid, NULL); +} } /* Kill off any acceptor threads by kicking them out of what they are doing @@ -428,6 +439,11 @@ void kill_acceptors(void) { listen_rec *lr; +int i; +int index = find_child_by_pid(getpid()); +parent_score *ss = &ap_scoreboard_image->parent[index]; + + /* Kick acceptor threads out of accept */ lr = ap_listeners; @@ -438,23 +454,18 @@ /* Kick any acceptor out of blocking on a full queue */ pthread_cond_broadcast(&(csd_queue.not_full)); + +for (i = ss->worker_threads; i < ss->worker_threads + ss->acceptor_threads; i++) { + pthread_join(ap_scoreboard_image->servers[index][i].tid, NULL); +} } void graceful_killer(void) { -int i; -int index = find_child_by_pid(getpid()); -parent_score *ss = &ap_scoreboard_image->parent[index]; - /* The two functions to get all of our other threads to die off. */ kill_acceptors(); +workers_may_exit = 1; kill_workers(); - -for (i = 0; i < ss->worker_threads + ss->acceptor_threads; i++) { -if (ap_scoreboard_image->servers[index][i].status != SERVER_DEAD) { - pthread_join(ap_scoreboard_image->servers[index][i].tid, NULL); - } -} } int ap_get_timeout(request_rec *r) @@ -1865,8 +1876,7 @@ free(ti); ptrans = ap_make_sub_pool(pchild); -while ((ap_max_requests_per_child != 0 && requests_this_child > 0) || - (ap_max_requests_per_child == 0)) { +while (!(workers_may_exit && (queue_size(&csd_queue) == 0))) { (void) ap_update_child_status(my_pid, my_tid, SERVER_READY, (request_rec *) NULL);
cvs commit: apache-1.3/src Configure
manoj 99/03/30 00:58:34 Modified:src Configure Log: Reviewed by: Ryan Bloom Fix DSO support under AIX 4.3. With using_shlib forced to 0, many of the settings needed in the Makefile to build DSOs don't get set. Revision ChangesPath 1.337 +0 -1 apache-1.3/src/Configure Index: Configure === RCS file: /home/cvs/apache-1.3/src/Configure,v retrieving revision 1.336 retrieving revision 1.337 diff -u -u -r1.336 -r1.337 --- Configure 1999/03/30 06:19:07 1.336 +++ Configure 1999/03/30 08:58:33 1.337 @@ -311,7 +311,6 @@ LDFLAGS="$LDFLAGS -lm" RULE_SHARED_CORE=no DEF_SHARED_CORE=no - using_shlib=0 ;; *-ibm-aix*) OS='IBM AIX'
cvs commit: apache-apr/pthreads/src/modules/standard mod_status.c
manoj 99/03/31 22:24:49 Modified:pthreads/src/modules/standard mod_status.c Log: Some tweaks to mod_status. It now correctly reports the number of connections being processed, and notes that they are connections instead of requests. Revision ChangesPath 1.8 +3 -2 apache-apr/pthreads/src/modules/standard/mod_status.c Index: mod_status.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_status.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- mod_status.c 1999/03/23 22:03:20 1.7 +++ mod_status.c 1999/04/01 06:24:48 1.8 @@ -317,7 +317,8 @@ tid_buffer[i][j] = (int) score_record.tid; if (res == SERVER_READY) ready++; - else if (res != SERVER_DEAD) + else if (res != SERVER_DEAD && res != SERVER_ACCEPTING + && res != SERVER_QUEUEING && res != SERVER_STARTING) busy++; if (ap_extended_status) { lres = score_record.access_count; @@ -424,7 +425,7 @@ }/* ap_extended_status */ if (!short_report) - ap_rprintf(r, "\n%d requests currently being processed, %d idle servers\n" + ap_rprintf(r, "\n%d connections currently being processed, %d idle servers\n" ,busy, ready); else ap_rprintf(r, "BusyServers: %d\nIdleServers: %d\n", busy, ready);
cvs commit: apache-apr STATUS
manoj 99/04/08 01:53:47 Modified:.STATUS Log: Nasty hot weather is here. It's late this year. Revision ChangesPath 1.18 +13 -1 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.17 retrieving revision 1.18 diff -u -u -r1.17 -r1.18 --- STATUS1999/03/23 22:06:30 1.17 +++ STATUS1999/04/08 08:53:46 1.18 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/03/23 22:06:30 $] +Last modified at [$Date: 1999/04/08 08:53:46 $] Release: @@ -36,9 +36,21 @@ mod_log_referer.c -- mod_log_config changes. If yes, I'll test -- them later. +Warning scrubbing +Get rid of all reasonable warnings with the strictest compiler flags, +to help weed out bugs + Everything Needs patch: + +On Red Hat 5.2, with a very low MaxRequestsPerChild (e.g. 10), when the +server is banged on with ApacheBench, occasionally, the main thread of a +process hangs around in pthread_exit_process. The size of that process is +always around 11M. This bug is also exhibited by sending lots of SIGHUPs +to the parent process rapidly (but not SIGWINCHes). The suspicion is that +this is either an error in how pthread calls are used in the server, or a +libc bug (the last refuge of a desperate programer). Open issues:
cvs commit: apache-apr/pthreads/src/modules/standard mod_info.c
manoj 99/04/08 19:07:55 Modified:pthreads/src/modules/standard mod_info.c Log: Submitted by: James Morris <[EMAIL PROTECTED]> mod_info fix. It actually seems to work now. Revision ChangesPath 1.3 +2 -1 apache-apr/pthreads/src/modules/standard/mod_info.c Index: mod_info.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_info.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- mod_info.c1999/02/07 06:29:53 1.2 +++ mod_info.c1999/04/09 02:07:55 1.3 @@ -425,7 +425,8 @@ ap_rprintf(r, "Max Requests: " "per child: %d " "keep alive: %s " -"max per connection: \n", +"max per connection: %d\n", +ap_max_requests_per_child, (serv->keep_alive ? "on" : "off"), serv->keep_alive_max); ap_rprintf(r, "Threads: "
cvs commit: apache-apr/pthreads/src/modules/standard mod_info.c
manoj 99/04/08 19:14:25 Modified:pthreads/src/modules/standard mod_info.c Log: Undo my stupid messed up commit temporarily. Revision ChangesPath 1.4 +1 -2 apache-apr/pthreads/src/modules/standard/mod_info.c Index: mod_info.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_info.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- mod_info.c1999/04/09 02:07:55 1.3 +++ mod_info.c1999/04/09 02:14:23 1.4 @@ -425,8 +425,7 @@ ap_rprintf(r, "Max Requests: " "per child: %d " "keep alive: %s " -"max per connection: %d\n", -ap_max_requests_per_child, +"max per connection: \n", (serv->keep_alive ? "on" : "off"), serv->keep_alive_max); ap_rprintf(r, "Threads: "
cvs commit: apache-apr/pthreads/src/modules/standard mod_info.c
manoj 99/04/08 19:31:24 Modified:.STATUS pthreads/src CHANGES pthreads/src/modules/standard mod_info.c Log: Submitted by: James Morris <[EMAIL PROTECTED]> Fix to ap_rprintf call that allows mod_info to work properly Revision ChangesPath 1.19 +1 -2 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.18 retrieving revision 1.19 diff -u -u -r1.18 -r1.19 --- STATUS1999/04/08 08:53:46 1.18 +++ STATUS1999/04/09 02:31:21 1.19 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/04/08 08:53:46 $] +Last modified at [$Date: 1999/04/09 02:31:21 $] Release: @@ -29,7 +29,6 @@ Modules that don't work: mod_digest.c --Anybody have a client that can transmit Digest Auth? - mod_info.c --DOES NOT WORK AT ALL! Questionable modules: (Not tested.) mod_log_agent.c -- Are we keeping these in 2.0 after Ken's 1.5 +3 -0 apache-apr/pthreads/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-apr/pthreads/src/CHANGES,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- CHANGES 1999/04/08 14:37:15 1.4 +++ CHANGES 1999/04/09 02:31:22 1.5 @@ -1,5 +1,8 @@ Changes with Apache apr + *) Fix to ap_rprintf call that allows mod_info to work properly [James + Morris <[EMAIL PROTECTED]>] + *) user and ap_auth_type fields were moved from connection_rec to request_rec. [Ryan Bloom [EMAIL PROTECTED] 1.5 +2 -1 apache-apr/pthreads/src/modules/standard/mod_info.c Index: mod_info.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_info.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- mod_info.c1999/04/09 02:14:23 1.4 +++ mod_info.c1999/04/09 02:31:24 1.5 @@ -425,7 +425,8 @@ ap_rprintf(r, "Max Requests: " "per child: %d " "keep alive: %s " -"max per connection: \n", +"max per connection: %d\n", +ap_max_requests_per_child, (serv->keep_alive ? "on" : "off"), serv->keep_alive_max); ap_rprintf(r, "Threads: "
cvs commit: apache-apr/pthreads/src/main acceptlock.c
manoj 99/04/08 20:15:40 Modified:pthreads/src/main acceptlock.c Log: Fix acceptlock bugs found during warning scrubbing. expand_lock_fname is now static. Also, the psprintf in that function had an extra argument (the parent process pid), which wasn't used, and can't be used in child processes, but which is useful. So, we use it by create a new init_lock_fname which is used only in the parent process so that the getpid() call returns the expected result. Revision ChangesPath 1.3 +10 -5 apache-apr/pthreads/src/main/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- acceptlock.c 1999/03/07 00:47:49 1.2 +++ acceptlock.c 1999/04/09 03:15:40 1.3 @@ -81,14 +81,17 @@ #if defined(USE_FCNTL_SERIALIZED_ACCEPT) || defined(USE_FLOCK_SERIALIZED_ACCEPT) -char * expand_lock_fname(pool *p, int i) +static void init_lock_fname(pool *p) { -char *fname; /* possibly bogus cast */ -fname = ap_psprintf(p, "%s.%d", - ap_server_root_relative(p, ap_lock_fname), i, (unsigned long)getpid()); -return fname; +ap_lock_fname = ap_psprintf(p, "%s.%lu", +ap_server_root_relative(p, ap_lock_fname), (unsigned long)getpid()); } + +static char * expand_lock_fname(pool *p, int i) +{ +return ap_psprintf(p, "%s.%d", ap_lock_fname, i); +} #endif #if defined (USE_USLOCK_SERIALIZED_ACCEPT) @@ -423,6 +426,7 @@ unlock_it.l_type = F_UNLCK; /* set exclusive/write lock */ unlock_it.l_pid = 0; /* pid not actually interesting */ +init_lock_fname(p); for (i = 0; i < ap_acceptors_per_child; i++) { lock_fname = expand_lock_fname(p, i); lock_fd[i] = ap_popenf(p, lock_fname, @@ -517,6 +521,7 @@ char *lock_fname; lock_fd = (int *)ap_palloc(p, ap_acceptors_per_child * sizeof(int *)); +init_lock_fname(p); for (i = 0; i < ap_acceptors_per_child; i++) { lock_fname = expand_lock_fname(p, i); unlink(lock_fname);
cvs commit: apache-apr/pthreads/src/os/unix os.h
manoj 99/04/08 20:33:40 Modified:pthreads/src/os/unix os.h Log: Remove extra ap_spawnvp declaration. Revision ChangesPath 1.5 +1 -6 apache-apr/pthreads/src/os/unix/os.h Index: os.h === RCS file: /home/cvs/apache-apr/pthreads/src/os/unix/os.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- os.h 1999/04/08 22:42:20 1.4 +++ os.h 1999/04/09 03:33:39 1.5 @@ -75,6 +75,7 @@ #define INLINE extern ap_inline INLINE int ap_os_is_path_absolute(const char *file); +/* spawn = fork + exec on unix */ INLINE int ap_spawnvp(const char *file, char *const argv[]); #include "os-inline.c" @@ -101,12 +102,6 @@ #ifdef HAVE_DL_H #include #endif - -/* - * spawn = fork + exec on unix - */ - -extern int ap_spawnvp(const char *, char *const []); /* * Do not use native AIX DSO support
cvs commit: apache-apr/pthreads/src/main alloc.c
manoj 99/04/08 20:43:28 Modified:pthreads/src/main alloc.c Log: An attempt to fix Roy's problems with ALLOC_DEBUG. The server will also compile with POOL_DEBUG now. Revision ChangesPath 1.5 +14 -4 apache-apr/pthreads/src/main/alloc.c Index: alloc.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/alloc.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- alloc.c 1999/03/17 17:01:16 1.4 +++ alloc.c 1999/04/09 03:43:28 1.5 @@ -159,6 +159,10 @@ union block_hdr *global_next; struct pool *owning_pool; #endif +#if defined(ALLOC_DEBUG) && !defined(ALLOC_USE_MALLOC) +unsigned is_free; +#endif + } h; }; @@ -284,14 +288,14 @@ #define reset_block(b) do { \ test_is_free(b); \ (b)->h.first_avail = (char *) ((b) + 1);\ -debug_fill((b)->h.first_avail, b(b)->h.endp - (b)->h.first_avail); \ +debug_fill((b)->h.first_avail, (b)->h.endp - (b)->h.first_avail); \ (b)->h.owning_pool = FREE_POOL; \ } while(0) #else #define reset_block(b) do { \ test_is_free(b); \ (b)->h.first_avail = (char *) ((b) + 1);\ -debug_fill((b)->h.first_avail, b(b)->h.endp - (b)->h.first_avail); \ +debug_fill((b)->h.first_avail, (b)->h.endp - (b)->h.first_avail); \ } while(0) #endif @@ -359,6 +363,9 @@ blok->h.next = NULL; debug_verify_filled(blok->h.first_avail, blok->h.endp, "Ouch! Someone trounced a block on the free list!\n"); +#if defined(ALLOC_DEBUG) && !defined(ALLOC_USE_MALLOC) +blok->h.is_free = 0; +#endif return blok; } else { @@ -371,6 +378,9 @@ min_size += BLOCK_MINFREE; blok = malloc_block((min_size > BLOCK_MINALLOC) ? min_size : BLOCK_MINALLOC); +#if defined(ALLOC_DEBUG) && !defined(ALLOC_USE_MALLOC) +blok->h.is_free = 0; +#endif return blok; } @@ -431,7 +441,7 @@ new_pool = (root_pool *) blok->h.first_avail; blok->h.first_avail += ROOT_HDR_BYTES; #ifdef POOL_DEBUG -blok->h.owning_pool = new_pool; +blok->h.owning_pool = &(new_pool->p); #endif memset(new_pool, 0, sizeof(*new_pool)); @@ -931,7 +941,7 @@ ps.blok->h.owning_pool = p; #endif #if defined(ALLOC_DEBUG) && !defined(ALLOC_USE_MALLOC) - ps.blok->is_free = 0; + ps.blok->h.is_free = 0; #endif }
cvs commit: apache-apr/pthreads/src/modules/standard mod_auth.c mod_auth_anon.c mod_auth_db.c mod_auth_dbm.c mod_digest.c
manoj 99/04/08 21:10:41 Modified:pthreads/src/include alloc.h buff.h http_main.h scoreboard.h pthreads/src/main buff.c fdqueue.c http_accept.c http_main.c http_protocol.c scoreboard.c pthreads/src/modules/standard mod_auth.c mod_auth_anon.c mod_auth_db.c mod_auth_dbm.c mod_digest.c Log: Lots of minor changes that mostly eliminate warnings during a compile with whininess settings turned on. Revision ChangesPath 1.5 +2 -1 apache-apr/pthreads/src/include/alloc.h Index: alloc.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/alloc.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- alloc.h 1999/03/17 17:01:06 1.4 +++ alloc.h 1999/04/09 04:10:34 1.5 @@ -93,7 +93,8 @@ pool * ap_init_alloc(void); /* Set up everything */ void ap_child_init_alloc(void); /* Set up everything */ -API_EXPORT(pool *) ap_make_sub_pool(pool *); /* All pools are subpools of permanent_pool */ +API_EXPORT(pool *) ap_make_sub_pool(pool *); +API_EXPORT(pool *) ap_make_root_pool(void); API_EXPORT(void) ap_destroy_pool(pool *); /* used to guarantee to the pool debugging code that the sub pool will not be 1.4 +4 -0 apache-apr/pthreads/src/include/buff.h Index: buff.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/buff.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- buff.h1999/03/15 14:26:48 1.3 +++ buff.h1999/04/09 04:10:35 1.4 @@ -145,6 +145,10 @@ /* Stream creation and modification */ API_EXPORT(BUFF *) ap_bcreate(pool *p, int flags); API_EXPORT(void) ap_bpushfd(BUFF *fb, int fd_in, int fd_out); + +/* XXX - unused right now - mvsk */ +API_EXPORT(BUFF *) ap_bopenf(pool *a, const char *name, int flg, int mode); + #ifdef WIN32 API_EXPORT(void) ap_bpushh(BUFF *fb, HANDLE hFH); #endif 1.5 +2 -0 apache-apr/pthreads/src/include/http_main.h Index: http_main.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/http_main.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- http_main.h 1999/02/24 20:30:14 1.4 +++ http_main.h 1999/04/09 04:10:35 1.5 @@ -62,6 +62,8 @@ extern "C" { #endif +void clean_child_exit(int code); + /* * Routines in http_main.c which other code --- in particular modules --- * may want to call. Right now, that's limited to timeout handling. 1.7 +1 -8 apache-apr/pthreads/src/include/scoreboard.h Index: scoreboard.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/scoreboard.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -u -r1.6 -r1.7 --- scoreboard.h 1999/02/15 20:38:57 1.6 +++ scoreboard.h 1999/04/09 04:10:35 1.7 @@ -200,21 +200,14 @@ #elif defined(USE_POSIX_SCOREBOARD) static void cleanup_shared_mem(void *d); #else -static int force_write(int fd, void *buffer, int bufsz); -static int force_read(int fd, void *buffer, int bufsz); -static void cleanup_scoreboard_file(void *foo); void reinit_scoreboard(pool *p); #endif API_EXPORT(void) reopen_scoreboard(pool *p); -static void setup_shared_mem(pool *p); - ap_inline void ap_sync_scoreboard_image(void); -static ap_inline void put_scoreboard_info(int child_num, -thread_score *new_score_rec); -static void update_scoreboard_global(void); void increment_counts(int child_num, int thread_num, request_rec *r); +void update_scoreboard_global(void); API_EXPORT(int) find_child_by_pid(int pid); int ap_update_child_status(int child_num, int thread_num, int status, request_rec *r); void ap_time_process_request(int child_num, int thread_num, int status); 1.7 +4 -4 apache-apr/pthreads/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/buff.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -u -r1.6 -r1.7 --- buff.c1999/03/17 17:01:16 1.6 +++ buff.c1999/04/09 04:10:36 1.7 @@ -125,7 +125,7 @@ select() sometimes returns 1 even though the write will block. We must work around this. */ -int sendwithtimeout(int sock, const char *buf, int len, int flags, int sec) +static int sendwithtimeout(int sock, const char *buf, int len, int flags, int sec) { int iostate = 1; fd_set fdset; @
cvs commit: apache-apr/pthreads/src/main http_accept.c
manoj 99/04/12 16:47:27 Modified:pthreads/src/main http_accept.c Log: Ryan was right. We should only decrement requests_this_child after a connection is accepted; otherwise, we will accept too few connections (and once the child death code works properly, too few could mean zero). Revision ChangesPath 1.3 +1 -1 apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- http_accept.c 1999/04/09 04:10:37 1.2 +++ http_accept.c 1999/04/12 23:47:25 1.3 @@ -106,8 +106,8 @@ csd = -1; } else { -requests_this_child--; csd = accept(sd, &sa_client, &len); +requests_this_child--; SAFE_ACCEPT(accept_mutex_off(my_tid - ap_threads_per_child)); } (void) ap_update_child_status(my_pid, my_tid, SERVER_QUEUEING,
cvs commit: apache-apr/pthreads/src/main acceptlock.c
manoj 99/04/13 23:26:12 Modified:pthreads/src/main acceptlock.c Log: Make USE_PTHREAD_SERIALIZED_ACCEPT functional. A few bugs are fixed, and mmap usage is optimized (I hope). Revision ChangesPath 1.4 +48 -44apache-apr/pthreads/src/main/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- acceptlock.c 1999/04/09 03:15:40 1.3 +++ acceptlock.c 1999/04/14 06:26:12 1.4 @@ -170,7 +170,7 @@ #include -static pthread_mutex_t **accept_mutex = (void *)(caddr_t) -1; +static pthread_mutex_t *accept_mutex = (void *)(caddr_t) -1; static int *have_accept_mutex; static sigset_t accept_block_mask; static sigset_t accept_previous_mask; @@ -179,10 +179,11 @@ { int i; -for (i = 0; i < ap_acceptors_per_child; i++) { -if (accept_mutex[i] != (void *)(caddr_t)-1 - && have_accept_mutex[i]) { - pthread_mutex_unlock(accept_mutex[i]); +if (accept_mutex != (void *)(caddr_t)-1) { +for (i = 0; i < ap_acceptors_per_child; i++) { + if (have_accept_mutex[i]) { + pthread_mutex_unlock(&accept_mutex[i]); +} } } } @@ -195,13 +196,12 @@ { int i; -for (i = 0; i < ap_acceptors_per_child; i++) { -if (accept_mutex[i] != (void *)(caddr_t)-1 - && munmap((caddr_t) accept_mutex[i], sizeof(pthread_mutex_t))) { - perror("munmap"); - } - accept_mutex[i] = (void *)(caddr_t)-1; +if (accept_mutex != (void *)(caddr_t)-1 +&& munmap((caddr_t) accept_mutex, + sizeof(pthread_mutex_t) * ap_acceptors_per_child)) { + perror("munmap"); } +accept_mutex = (void *)(caddr_t)-1; } void accept_mutex_init(pool *p) @@ -210,56 +210,60 @@ int fd; int i; -accept_mutex = (pthread_mutex_t *)ap_palloc(p, - ap_acceptors_per_child * sizeof(pthread_mutex_t *)); have_accept_mutex = (int *)ap_palloc(p, ap_acceptors_per_child * sizeof(int)); - +fd = open("/dev/zero", O_RDWR); +if (fd == -1) { +perror("open(/dev/zero)"); +exit(APEXIT_INIT); +} +accept_mutex = (pthread_mutex_t *) mmap((caddr_t) 0, + sizeof(pthread_mutex_t) * ap_acceptors_per_child, +PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); +if (accept_mutex == (void *) (caddr_t) - 1) { +perror("mmap"); +exit(APEXIT_INIT); +} +close(fd); +if ((errno = pthread_mutexattr_init(&mattr))) { +perror("pthread_mutexattr_init"); +exit(APEXIT_INIT); +} +if ((errno = pthread_mutexattr_setpshared(&mattr, + PTHREAD_PROCESS_SHARED))) { +perror("pthread_mutexattr_setpshared"); +exit(APEXIT_INIT); +} for (i = 0; i < ap_acceptors_per_child; i++) { -fd = open("/dev/zero", O_RDWR); - if (fd == -1) { - perror("open(/dev/zero)"); - exit(APEXIT_INIT); - } - accept_mutex[i] = (pthread_mutex_t *) mmap((caddr_t) 0, -sizeof(*accept_mutex), -PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if (accept_mutex[i] == (void *) (caddr_t) - 1) { - perror("mmap"); - exit(APEXIT_INIT); - } - close(fd); - if ((errno = pthread_mutexattr_init(&mattr))) { - perror("pthread_mutexattr_init"); - exit(APEXIT_INIT); - } - if ((errno = pthread_mutexattr_setpshared(&mattr, - PTHREAD_PROCESS_SHARED))) { - perror("pthread_mutexattr_setpshared"); - exit(APEXIT_INIT); - } - if ((errno = pthread_mutex_init(accept_mutex, &mattr))) { + if ((errno = pthread_mutex_init(&accept_mutex[i], &mattr))) { perror("pthread_mutex_init"); exit(APEXIT_INIT); } - sigfillset(&accept_block_mask); - sigdelset(&accept_block_mask, SIGHUP); - sigdelset(&accept_block_mask, SIGTERM); - sigdelset(&accept_block_mask, SIGWINCH); - ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); } +if ((errno = pthread_mutexattr_destroy(&mattr))) { +perror("pthread_mutexattr_destroy"); +exit(APEXIT_INIT); +} +s
cvs commit: apache-apr/pthreads/src/include ap_config.h
manoj 99/04/13 23:30:35 Modified:pthreads/src/include ap_config.h Log: Allow AIX versions that support cross-process pthread mutexes to use them for accept serialization. This should be applicable for apache 1.3, and since this #define is specified by POSIX, it should theoretically be applicable for all platforms. Revision ChangesPath 1.4 +5 -0 apache-apr/pthreads/src/include/ap_config.h Index: ap_config.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/ap_config.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- ap_config.h 1999/03/17 17:01:07 1.3 +++ ap_config.h 1999/04/14 06:30:35 1.4 @@ -272,7 +272,12 @@ #ifdef NEED_RLIM_T typedef int rlim_t; #endif +/* Some versions of AIX support cross-process pthread mutexes; some don't. */ +#if _POSIX_THREAD_PROCESS_SHARED #define USE_FCNTL_SERIALIZED_ACCEPT +#else +#define USE_PTHREAD_SERIALIZED_ACCEPT +#endif #ifdef USEBCOPY #define memmove(a,b,c) bcopy(b,a,c) #endif
cvs commit: apache-apr/pthreads/src/include ap_config.h
manoj 99/04/14 00:32:45 Modified:pthreads/src/include ap_config.h Log: The last patch was messed up in many ways. Now, really enable pthread accept mutexes for AIX versions that support it. Revision ChangesPath 1.5 +7 -7 apache-apr/pthreads/src/include/ap_config.h Index: ap_config.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/ap_config.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- ap_config.h 1999/04/14 06:30:35 1.4 +++ ap_config.h 1999/04/14 07:32:45 1.5 @@ -84,6 +84,10 @@ #include #include +#ifdef HAVE_UNISTD_H +#include +#endif + /* So that we can use inline on some critical functions, and use * GNUC attributes (such as to get -Wall warnings for printf-like * functions). Only do this in gcc 2.7 or later ... it may work @@ -273,10 +277,10 @@ typedef int rlim_t; #endif /* Some versions of AIX support cross-process pthread mutexes; some don't. */ -#if _POSIX_THREAD_PROCESS_SHARED -#define USE_FCNTL_SERIALIZED_ACCEPT -#else +#ifdef _POSIX_THREAD_PROCESS_SHARED #define USE_PTHREAD_SERIALIZED_ACCEPT +#else +#define USE_FCNTL_SERIALIZED_ACCEPT #endif #ifdef USEBCOPY #define memmove(a,b,c) bcopy(b,a,c) @@ -1049,10 +1053,6 @@ #ifndef LOGNAME_MAX #define LOGNAME_MAX 25 -#endif - -#ifdef HAVE_UNISTD_H -#include #endif #ifdef ultrix
cvs commit: apache-apr/pthreads/src/main http_accept.c http_main.c
manoj 99/04/14 14:38:30 Modified:pthreads/src/include http_accept.h pthreads/src/main http_accept.c http_main.c Log: Some tweaking of our http_accept modularization. A call is added to perform any initialization needed in the parent. With this, we can take all knowledge about accept serialization out of http_main.c. Also, the function names were changed as a result of this addition and to keep the difference between "request" and "connection" straight. accept_parent_init (NEW) init_accept -> accept_child_init start_accepting_requests -> start_accepting_connections get_request -> get_connection stop_accepting_requests -> stop_accepting_connections Revision ChangesPath 1.3 +5 -13 apache-apr/pthreads/src/include/http_accept.h Index: http_accept.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/http_accept.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- http_accept.h 1999/04/14 21:03:18 1.2 +++ http_accept.h 1999/04/14 21:38:28 1.3 @@ -79,19 +79,11 @@ #define USE_ACCEPT_QUEUE /*#define USE_MULTI_ACCEPT*/ -#if defined (USE_ACCEPT_QUEUE) -void init_accept(pool*, int, int); -void start_accepting_requests(int); -int get_request(struct sockaddr *); -void stop_accepting_requests(pool*); - -#elif defined (USE_MULTI_ACCEPT) -void init_accept(pool*,int, int); -void start_accepting_requests(int); -int get_request(struct sockaddr *); -void stop_accepting_requests(pool *); -#endif - +void accept_parent_init(pool*); +void accept_child_init(pool*, int, int); +void start_accepting_connections(int); +int get_connection(struct sockaddr *); +void stop_accepting_connections(pool*); #ifdef __cplusplus } 1.5 +17 -8 apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- http_accept.c 1999/04/14 21:03:26 1.4 +++ http_accept.c 1999/04/14 21:38:28 1.5 @@ -181,6 +181,11 @@ } } +void accept_parent_init(pool *pconf) +{ +SAFE_ACCEPT(accept_mutex_init(pconf)); +} + /* * Description: * Do any setup or initialization required before worker threads begin @@ -191,7 +196,7 @@ * 3. Pass in server_conf? * 4. Simply access the globals (yech...) */ -void init_accept(pool* pchild, +void accept_child_init(pool* pchild, int worker_threads_per_child, int acceptor_threads_per_child) { @@ -202,7 +207,7 @@ } -void start_accepting_requests(int my_child_num) +void start_accepting_connections(int my_child_num) { proc_info *my_info; pthread_t thread; @@ -275,7 +280,7 @@ accept_thread(my_info); } -int get_request(struct sockaddr *sa_client) +int get_connection(struct sockaddr *sa_client) { int csd = -1; int block_if_empty = 1; @@ -295,7 +300,7 @@ return csd; } -void stop_accepting_requests(pool* pconf) +void stop_accepting_connections(pool* pconf) { requests_this_child = 0; /* The two functions to get all of our other threads to die off. */ @@ -313,8 +318,12 @@ static int num_listenfds; static struct pollfd *listenfds; +void accept_parent_init(pool *pconf) +{ +SAFE_ACCEPT(accept_mutex_init(pconf)); +} -void init_accept(pool* pchild, +void accept_child_init(pool* pchild, int worker_threads_per_child, int acceptors_per_child) { @@ -336,10 +345,10 @@ } } -void start_accepting_requests(int my_child_num) +void start_accepting_connections(int my_child_num) { } -int get_request(struct sockaddr *sa_client) +int get_connection(struct sockaddr *sa_client) { int csd = -1; int sd; @@ -446,7 +455,7 @@ return -1; } -void stop_accepting_requests(pool* pconf) +void stop_accepting_connections(pool* pconf) { listen_rec *lr; 1.70 +5 -9 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.69 retrieving revision 1.70 diff -u -u -r1.69 -r1.70 --- http_main.c 1999/04/14 21:03:29 1.69 +++ http_main.c 1999/04/14 21:38:29 1.70 @@ -92,9 +92,6 @@ #include "util_script.h" /* to force util_script.c linking */ #include "util_uri.h" #include "scoreboard.h" -/* XXX - the accept_mute
cvs commit: apache-apr/pthreads/src/main acceptlock.c http_accept.c http_main.c
manoj 99/04/14 15:44:58 Modified:pthreads/src/include acceptlock.h http_accept.h pthreads/src/main acceptlock.c http_accept.c http_main.c Log: Cleanup and bug fixes. This patch removes the link between ap_acceptors_per_child and the number of listen fds, to support the new poll-accept model. As a result, we don't create a bunch of accept mutexes we don't need, and there isn't a pile of phantom threads that we attempt to count and operate on. Revision ChangesPath 1.3 +7 -7 apache-apr/pthreads/src/include/acceptlock.h Index: acceptlock.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/acceptlock.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- acceptlock.h 1999/03/07 00:47:43 1.2 +++ acceptlock.h 1999/04/14 22:44:55 1.3 @@ -65,7 +65,7 @@ /* Prototyps for the accept mutex functions. */ #if defined (USE_USLOCK_SERIALIZED_ACCEPT) #define accept_mutex_child_init(x) -void accept_mutex_init(pool *); +void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); @@ -73,33 +73,33 @@ void accept_mutex_child_cleanup(void *); void accept_mutex_child_init(pool *); void accept_mutex_cleanup(void *); -void accept_mutex_init(pool *); +void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); #elif defined (USE_SYSVSEM_SERIALIZED_ACCEPT) void accept_mutex_cleanup(void *); -void accept_mutex_init(pool *); +void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); #elif defined(USE_FCNTL_SERIALIZED_ACCEPT) #define accept_mutex_child_init(x) -void accept_mutex_init(pool *); +void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); #elif defined(USE_FLOCK_SERIALIZED_ACCEPT) void accept_mutex_cleanup(void *); void accept_mutex_child_init(pool *); -void accept_mutex_init(pool *); +void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); #elif defined(USE_OS2SEM_SERIALIZED_ACCEPT) void accept_mutex_cleanup(void *); void accept_mutex_child_init(pool *); -void accept_mutex_init(pool *); +void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); @@ -109,7 +109,7 @@ * the sockets. */ #define NO_SERIALIZED_ACCEPT #define accept_mutex_child_init(x) -#define accept_mutex_init(x) +#define accept_mutex_init(x, y) #define accept_mutex_on(x) #define accept_mutex_off(x) #endif 1.4 +2 -2 apache-apr/pthreads/src/include/http_accept.h Index: http_accept.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/http_accept.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- http_accept.h 1999/04/14 21:38:28 1.3 +++ http_accept.h 1999/04/14 22:44:55 1.4 @@ -79,8 +79,8 @@ #define USE_ACCEPT_QUEUE /*#define USE_MULTI_ACCEPT*/ -void accept_parent_init(pool*); -void accept_child_init(pool*, int, int); +void accept_parent_init(pool*, int); +void accept_child_init(pool*, int); void start_accepting_connections(int); int get_connection(struct sockaddr *); void stop_accepting_connections(pool*); 1.5 +34 -26apache-apr/pthreads/src/main/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- acceptlock.c 1999/04/14 06:26:12 1.4 +++ acceptlock.c 1999/04/14 22:44:56 1.5 @@ -79,6 +79,8 @@ #include "pthread.h" +/* Number of cross-process locks we're managing */ +static int lock_count; #if defined(USE_FCNTL_SERIALIZED_ACCEPT) || defined(USE_FLOCK_SERIALIZED_ACCEPT) static void init_lock_fname(pool *p) @@ -102,15 +104,16 @@ -void accept_mutex_init(pool *p) +void accept_mutex_init(pool *p, int number_of_locks) { ptrdiff_t old; usptr_t *us; int i; -uslock = (ulock_t *)ap_palloc(p, ap_acceptors_per_child * sizeof(ulock_t)); +lock_count = number_of_locks; +uslock = (ulock_t *)ap_palloc(p, lock_count * sizeof(ulock_t)); -for (i = 0; i < ap_acceptors_per_child; i++) { +for (i = 0; i < lock_count; i++) { /* default is 8, allocate enough for all the children plus the parent */ if ((old = usconfig(CONF_INITUSERS, HARD_SERVER_LIMIT + 1)) == -1) { perror("usconfig(CONF_INITUSERS)"); @@ -180,7 +183,7 @@ int i;
cvs commit: apache-apr/pthreads/src/main http_main.c http_accept.c
manoj 99/04/15 13:01:43 Modified:pthreads/src/main http_main.c http_accept.c Log: Enable graceful restart and MaxRequestsPerChild for the multiaccept model, using a pipe watched by poll() to wake up the server at the child's graceful shutdown time. Revision ChangesPath 1.72 +1 -0 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.71 retrieving revision 1.72 diff -u -u -r1.71 -r1.72 --- http_main.c 1999/04/14 22:44:57 1.71 +++ http_main.c 1999/04/15 20:01:40 1.72 @@ -1762,6 +1762,7 @@ } ap_destroy_pool(ptrans); +kill(ap_scoreboard_image->parent[process_slot].pid, SIGWINCH); ap_update_child_status(process_slot, thread_slot, SERVER_DEAD, (request_rec *) NULL); return NULL; 1.7 +29 -24apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -u -r1.6 -r1.7 --- http_accept.c 1999/04/14 22:44:57 1.6 +++ http_accept.c 1999/04/15 20:01:40 1.7 @@ -317,6 +317,7 @@ */ static listen_rec *head_listener; static struct pollfd *listenfds; +static int pipe_of_death; void accept_parent_init(pool *pconf, int listener_count) { @@ -329,15 +330,26 @@ int worker_threads_per_child) { int i; +int pipe_pair_of_death[2]; listen_rec *lr; SAFE_ACCEPT(accept_mutex_child_init(pchild)); requests_this_child = ap_max_requests_per_child; head_listener = ap_listeners; -listenfds = ap_palloc(pchild, sizeof(struct pollfd) * num_listenfds); +listenfds = ap_palloc(pchild, sizeof(struct pollfd) * (num_listenfds + 1)); -for (lr = ap_listeners, i = 0; i < num_listenfds; lr = lr->next, ++i) { +if (pipe(pipe_pair_of_death) == -1) { +ap_log_error(APLOG_MARK, APLOG_ERR, + (const server_rec*) ap_get_server_conf(), + "pipe: (pipe_of_death)"); + clean_child_exit(1); +} +pipe_of_death = pipe_pair_of_death[0]; +listenfds[0].fd = pipe_pair_of_death[1]; +listenfds[0].events = POLLIN; +listenfds[0].revents = 0; +for (lr = ap_listeners, i = 1; i <= num_listenfds; lr = lr->next, ++i) { lr->index = i; listenfds[i].fd = lr->fd; listenfds[i].events = POLLIN; /* should we add POLLPRI ?*/ @@ -368,12 +380,19 @@ if (workers_may_exit) break; -if (num_listenfds > 1) { +/* XXX - Yes, we always go through the poll, at least for now. + * - mvsk + */ +if (1) { /* more than one socket */ -srv = poll(listenfds, num_listenfds, -1); +srv = poll(listenfds, num_listenfds + 1, -1); if (workers_may_exit) break; if (srv < 0) { +/* XXX - h, poll can return EINTR. - mvsk */ +if (errno == EINTR) { +continue; +} SAFE_ACCEPT(accept_mutex_off(0)); /* Single Unix documents select as returning errnos * EBADF, EINTR, and EINVAL... and in none of those @@ -427,6 +446,7 @@ } csd = accept(sd, sa_client, &len); +requests_this_child--; if (csd >= 0) break; /* We have a socket ready for reading */ @@ -442,39 +462,24 @@ break; } } - -/* If the workers have not already been signaled to die, SIGWINCH the parent to - * kick-off the restart - */ -if (!workers_may_exit) { -index = find_child_by_pid(getpid()); -kill(ap_scoreboard_image->parent[index].pid, SIGWINCH); -} - - return -1; - } + void stop_accepting_connections(pool* pconf) { - -listen_rec *lr; int i; int index = find_child_by_pid(getpid()); +char char_of_death = '!'; parent_score *ss = &ap_scoreboard_image->parent[index]; requests_this_child = 0; workers_may_exit = 1; -/* Kick threads out of poll/accept */ -lr = ap_listeners; -while (lr != NULL) { - ap_pclosesocket(pconf, lr->fd); - lr= lr->next; -} +/* Kick threads out of poll */ +(void) write(pipe_of_de
cvs commit: apache-apr/pthreads/src/main acceptlock.c
manoj 99/04/15 21:43:02 Modified:pthreads/src/main acceptlock.c Log: For pthread serialization: ifdef out an added signal mask call that isn't needed in the current server architecture, and fix up that same code so it can be turned on again if need be. Revision ChangesPath 1.6 +19 -7 apache-apr/pthreads/src/main/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -u -r1.5 -r1.6 --- acceptlock.c 1999/04/14 22:44:56 1.5 +++ acceptlock.c 1999/04/16 04:43:01 1.6 @@ -175,8 +175,13 @@ static pthread_mutex_t *accept_mutex = (void *)(caddr_t) -1; static int *have_accept_mutex; +/* The sections surrounded with this ifdef are not needed because of the + * sigwait thread. They may be turned back on, though, depending on how the + * port to nonthreaded mode goes */ +#ifdef NEED_TO_BLOCK_SIGNALS_AROUND_PTHREAD_CALLS static sigset_t accept_block_mask; -static sigset_t accept_previous_mask; +static sigset_t *accept_previous_masks = NULL; +#endif void accept_mutex_child_cleanup(void *foo) { @@ -193,6 +198,9 @@ void accept_mutex_child_init(pool *p) { ap_register_cleanup(p, NULL, accept_mutex_child_cleanup, ap_null_cleanup); +#ifdef NEED_TO_BLOCK_SIGNALS_AROUND_PTHREAD_CALLS +accept_previous_masks = ap_palloc(p, lock_count * sizeof(sigset_t)); +#endif } void accept_mutex_cleanup(void *foo) @@ -249,10 +257,12 @@ perror("pthread_mutexattr_destroy"); exit(APEXIT_INIT); } +#ifdef NEED_TO_BLOCK_SIGNALS_AROUND_PTHREAD_CALLS sigfillset(&accept_block_mask); sigdelset(&accept_block_mask, SIGHUP); sigdelset(&accept_block_mask, SIGTERM); sigdelset(&accept_block_mask, SIGWINCH); +#endif ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); } @@ -260,10 +270,10 @@ { int err; -/* Already blocking out all signals in worker threads. */ -#if 0 -if (sigprocmask(SIG_BLOCK, &accept_block_mask, &accept_previous_mask)) { - perror("sigprocmask(SIG_BLOCK)"); +#ifdef NEED_TO_BLOCK_SIGNALS_AROUND_PTHREAD_CALLS +if (pthread_sigmask(SIG_BLOCK, &accept_block_mask, +&accept_previous_mask[locknum])) { + perror("pthread_sigmask(SIG_BLOCK)"); clean_child_exit(APEXIT_CHILDFATAL); } #endif @@ -298,10 +308,12 @@ * hits. */ have_accept_mutex[locknum] = 0; -if (sigprocmask(SIG_SETMASK, &accept_previous_mask, NULL)) { - perror("sigprocmask(SIG_SETMASK)"); +#ifdef NEED_TO_BLOCK_SIGNALS_AROUND_PTHREAD_CALLS +if (pthread_sigmask(SIG_SETMASK, &accept_previous_mask[locknum], NULL)) { + perror("pthread_sigmask(SIG_SETMASK)"); clean_child_exit(1); } +#endif } #elif defined (USE_SYSVSEM_SERIALIZED_ACCEPT)
cvs commit: apache-apr/pthreads/src/main http_accept.c
manoj 99/04/16 18:58:58 Modified:pthreads/src/main http_accept.c Log: Next time I'll read the whole man page. filedes[0] is for reading, filedes[1] is for writing. Revision ChangesPath 1.8 +2 -2 apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- http_accept.c 1999/04/15 20:01:40 1.7 +++ http_accept.c 1999/04/17 01:58:58 1.8 @@ -345,8 +345,8 @@ "pipe: (pipe_of_death)"); clean_child_exit(1); } -pipe_of_death = pipe_pair_of_death[0]; -listenfds[0].fd = pipe_pair_of_death[1]; +pipe_of_death = pipe_pair_of_death[1]; +listenfds[0].fd = pipe_pair_of_death[0]; listenfds[0].events = POLLIN; listenfds[0].revents = 0; for (lr = ap_listeners, i = 1; i <= num_listenfds; lr = lr->next, ++i) {
cvs commit: apache-apr/pthreads/src/main util.c
manoj 99/04/16 20:06:39 Modified:pthreads/src/main util.c Log: Optimize ap_gm_timestr_822, ap_make_dirstr_prefix, and ap_unescape_url. Revision ChangesPath 1.4 +60 -15apache-apr/pthreads/src/main/util.c Index: util.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/util.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- util.c1999/03/17 17:01:23 1.3 +++ util.c1999/04/17 03:06:38 1.4 @@ -173,14 +173,56 @@ API_EXPORT(char *) ap_gm_timestr_822(pool *p, time_t sec) { struct tm *tms; +char *date_str = ap_palloc(p, 48 * sizeof(char)); +char *date_str_ptr = date_str; +int real_year; tms = gmtime(&sec);/* ZZZ replace with AP time routine */ +/* Assumption: this is always 3 */ +/* i = strlen(ap_day_snames[tms->tm_wday]); */ +memcpy(date_str_ptr, ap_day_snames[tms->tm_wday], 3); +date_str_ptr += 3; +*date_str_ptr++ = ','; +*date_str_ptr++ = ' '; +*date_str_ptr++ = tms->tm_mday / 10 + '0'; +*date_str_ptr++ = tms->tm_mday % 10 + '0'; +*date_str_ptr++ = ' '; +/* Assumption: this is also always 3 */ +/* i = strlen(ap_month_snames[tms->tm_mon]); */ +memcpy(date_str_ptr, ap_month_snames[tms->tm_mon], 3); +date_str_ptr += 3; +*date_str_ptr++ = ' '; +real_year = 1900 + tms->tm_year; +/* This routine isn't y10k ready. */ +*date_str_ptr++ = real_year / 1000 + '0'; +*date_str_ptr++ = real_year % 1000 / 100 + '0'; +*date_str_ptr++ = real_year % 100 / 10 + '0'; +*date_str_ptr++ = real_year % 10 + '0'; +*date_str_ptr++ = ' '; +*date_str_ptr++ = tms->tm_hour / 10 + '0'; +*date_str_ptr++ = tms->tm_hour % 10 + '0'; +*date_str_ptr++ = ':'; +*date_str_ptr++ = tms->tm_min / 10 + '0'; +*date_str_ptr++ = tms->tm_min % 10 + '0'; +*date_str_ptr++ = ':'; +*date_str_ptr++ = tms->tm_sec / 10 + '0'; +*date_str_ptr++ = tms->tm_sec % 10 + '0'; +*date_str_ptr++ = ' '; +*date_str_ptr++ = 'G'; +*date_str_ptr++ = 'M'; +*date_str_ptr++ = 'T'; +*date_str_ptr = '\0'; + +return date_str; /* RFC date format; as strftime '%a, %d %b %Y %T GMT' */ + +/* The equivalent using sprintf. Use this for more legible but slower code return ap_psprintf(p, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", ap_day_snames[tms->tm_wday], tms->tm_mday, ap_month_snames[tms->tm_mon], tms->tm_year + 1900, tms->tm_hour, tms->tm_min, tms->tm_sec); +*/ } /* What a pain in the ass. */ @@ -472,15 +514,11 @@ API_EXPORT(char *) ap_make_dirstr_prefix(char *d, const char *s, int n) { for (;;) { - *d = *s; - if (*d == '\0') { + if (*s == '\0' || (*s == '/' && (--n) == 0)) { *d = '/'; break; } - if (*d == '/' && (--n) == 0) - break; - ++d; - ++s; + *d++ = *s++; } *++d = 0; return (d); @@ -1395,27 +1433,34 @@ */ API_EXPORT(int) ap_unescape_url(char *url) { -register int x, y, badesc, badpath; +register int badesc, badpath; +char *x, *y; badesc = 0; badpath = 0; -for (x = 0, y = 0; url[y]; ++x, ++y) { - if (url[y] != '%') - url[x] = url[y]; +/* Initial scan for first '%'. Don't bother writing values before + * seeing a '%' */ +y = strchr(url, '%'); +if (y == NULL) { +return OK; +} +for (x = y; *y; ++x, ++y) { + if (*y != '%') + *x = *y; else { - if (!ap_isxdigit(url[y + 1]) || !ap_isxdigit(url[y + 2])) { + if (!ap_isxdigit(*(y + 1)) || !ap_isxdigit(*(y + 2))) { badesc = 1; - url[x] = '%'; + *x = '%'; } else { - url[x] = x2c(&url[y + 1]); + *x = x2c(y + 1); y += 2; - if (url[x] == '/' || url[x] == '\0') + if (*x == '/' || *x == '\0') badpath = 1; } } } -url[x] = '\0'; +*x = '\0'; if (badesc) return BAD_REQUEST; else if (badpath)
cvs commit: apache-apr/pthreads/src/main Makefile.tmpl acceptlock.c
manoj 99/04/16 20:35:55 Modified:pthreads/src/include acceptlock.h http_accept.h pthreads/src/main Makefile.tmpl acceptlock.c Log: Add intraprocess support to the accept mutexes. This is needed by the USE_MULTI_ACCEPT model since threads within a process can compete with each other for the lock. Revision ChangesPath 1.4 +2 -1 apache-apr/pthreads/src/include/acceptlock.h Index: acceptlock.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/acceptlock.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- acceptlock.h 1999/04/14 22:44:55 1.3 +++ acceptlock.h 1999/04/17 03:35:53 1.4 @@ -79,12 +79,13 @@ #elif defined (USE_SYSVSEM_SERIALIZED_ACCEPT) void accept_mutex_cleanup(void *); +void accept_mutex_child_init(pool *); void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); #elif defined(USE_FCNTL_SERIALIZED_ACCEPT) -#define accept_mutex_child_init(x) +void accept_mutex_child_init(pool *); void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); 1.5 +4 -0 apache-apr/pthreads/src/include/http_accept.h Index: http_accept.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/http_accept.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- http_accept.h 1999/04/14 22:44:55 1.4 +++ http_accept.h 1999/04/17 03:35:53 1.5 @@ -85,6 +85,10 @@ int get_connection(struct sockaddr *); void stop_accepting_connections(pool*); +#ifdef USE_MULTI_ACCEPT +#define NEED_INTRAPROCESS_SERIALIZED_ACCEPT +#endif + #ifdef __cplusplus } #endif 1.8 +2 -1 apache-apr/pthreads/src/main/Makefile.tmpl Index: Makefile.tmpl === RCS file: /home/cvs/apache-apr/pthreads/src/main/Makefile.tmpl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- Makefile.tmpl 1999/04/07 22:52:17 1.7 +++ Makefile.tmpl 1999/04/17 03:35:54 1.8 @@ -66,7 +66,8 @@ $(INCDIR)/http_config.h $(INCDIR)/http_protocol.h \ $(INCDIR)/http_request.h $(INCDIR)/http_conf_globals.h \ $(INCDIR)/http_core.h $(INCDIR)/http_vhost.h \ - $(INCDIR)/util_script.h $(INCDIR)/fdqueue.h $(INCDIR)/acceptlock.h + $(INCDIR)/util_script.h $(INCDIR)/fdqueue.h $(INCDIR)/acceptlock.h \ + $(INCDIR)/http_accept.h alloc.o: alloc.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ 1.7 +69 -2 apache-apr/pthreads/src/main/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -u -r1.6 -r1.7 --- acceptlock.c 1999/04/16 04:43:01 1.6 +++ acceptlock.c 1999/04/17 03:35:54 1.7 @@ -68,6 +68,7 @@ #include "util_uri.h" #include "fdqueue.h" #include "acceptlock.h" +#include "http_accept.h" #include #include @@ -82,6 +83,56 @@ /* Number of cross-process locks we're managing */ static int lock_count; +/* Intraprocess locking used by other serialization techniques */ +#ifdef NEED_INTRAPROCESS_SERIALIZED_ACCEPT +static pthread_mutex_t *intra_mutex = NULL; + +static void intra_mutex_cleanup(void *foo) +{ +int i; + +for (i = 0; i < lock_count; i++) { +(void) pthread_mutex_destroy(&intra_mutex[i]); +} +} + +static void intra_mutex_init(pool *p) +{ +int i; + +intra_mutex = (pthread_mutex_t *)ap_palloc(p, lock_count * sizeof(pthread_mutex_t )); +for (i = 0; i < lock_count; i++) { +if (pthread_mutex_init(&intra_mutex[i], NULL) != 0) { +perror("intra_mutex_init"); + clean_child_exit(APEXIT_CHILDFATAL); +} +} +ap_register_cleanup(p, NULL, intra_mutex_cleanup, ap_null_cleanup); +} + +static void intra_mutex_on(int locknum) +{ +if ((errno = pthread_mutex_lock(&intra_mutex[locknum])) != 0) { +ap_log_error(APLOG_MARK, APLOG_EMERG, + (const server_rec *) ap_get_server_conf(), + "Error getting intraprocess lock. Exiting!"); +} +} + +static void intra_mutex_off(int locknum) +{ +if (pthread_mutex_unlock(&intra_mutex[locknum]) != 0) { +ap_log_error(APLOG_MARK, APLOG_EMERG, + (const serv
cvs commit: apache-apr/pthreads/src/main http_accept.c http_main.c
manoj 99/04/16 21:25:57 Modified:pthreads/src/include http_accept.h pthreads/src/main http_accept.c http_main.c Log: An attempt to put SINGLE_LISTEN_UNSERIALIZED_ACCEPT support back in. This also moves the SAFE_ACCEPT definition from http_accept.h to http_accept.c since it isn't (and shouldn't be) used in other files anymore. Revision ChangesPath 1.6 +0 -2 apache-apr/pthreads/src/include/http_accept.h Index: http_accept.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/http_accept.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -u -r1.5 -r1.6 --- http_accept.h 1999/04/17 03:35:53 1.5 +++ http_accept.h 1999/04/17 04:25:55 1.6 @@ -65,8 +65,6 @@ #include "httpd.h" #include "ap_config.h" -#define SAFE_ACCEPT(stmt) do {stmt;} while(0) - /* The info each server thread needs to start correctly. */ typedef struct { 1.9 +16 -0 apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -u -r1.8 -r1.9 --- http_accept.c 1999/04/17 01:58:58 1.8 +++ http_accept.c 1999/04/17 04:25:56 1.9 @@ -72,6 +72,15 @@ static int num_listenfds; #if defined (USE_ACCEPT_QUEUE) + +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT +/* Each thread only listens to one socket in this model, so the starvation + * problem described in manual/misc/perf-tuning.html can't occur here */ +#define SAFE_ACCEPT(stmt) +#else +#define SAFE_ACCEPT(stmt) do {stmt;} while(0) +#endif + /* The queue of sockets we've accepted */ static FDQueue csd_queue; @@ -311,6 +320,13 @@ } #elif defined(USE_MULTI_ACCEPT) + +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT +#define SAFE_ACCEPT(stmt) do {if(ap_listeners->next != NULL) {stmt;}} while(0) +#else +#define SAFE_ACCEPT(stmt) do {stmt;} while(0) +#endif + /* * USE_MULTI_ACCEPT * Worker threads do the accept and process the request. 1.73 +0 -7 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.72 retrieving revision 1.73 diff -u -u -r1.72 -r1.73 --- http_main.c 1999/04/15 20:01:40 1.72 +++ http_main.c 1999/04/17 04:25:56 1.73 @@ -416,13 +416,6 @@ } } -/* On some architectures it's safe to do unserialized accept()s in the single - * Listen case. But it's never safe to do it in the case where there's - * multiple Listen statements. Define SINGLE_LISTEN_UNSERIALIZED_ACCEPT - * when it's safe in the single Listen case. We haven't defined this yet - * for the hybrid server. ZZZ - */ - static void usage(char *bin) { char pad[MAX_STRING_LEN];
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/04/16 22:10:19 Modified:pthreads/src/main http_main.c Log: Note in the scoreboard when a child process dies abnormally, so that a substitute can be started. Revision ChangesPath 1.74 +3 -3 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.73 retrieving revision 1.74 diff -u -u -r1.73 -r1.74 --- http_main.c 1999/04/17 04:25:56 1.73 +++ http_main.c 1999/04/17 05:10:18 1.74 @@ -2227,6 +2227,7 @@ int child_slot; ap_wait_t status; int pid; +int i; while (!restart_pending && !shutdown_pending) { pid = wait_or_timeout(&status); @@ -2234,9 +2235,8 @@ if (pid >= 0) { child_slot = find_child_by_pid(pid); if (child_slot >= 0) { -/*(void) ap_update_child_status(child_slot, SERVER_DEAD, - (request_rec *) NULL); - LOOK INTO THIS */ +for (i = 0; i < ap_threads_per_child + ap_acceptors_per_child; i++) +ap_update_child_status(child_slot, i, SERVER_DEAD, (request_rec *) NULL); if (remaining_children_to_start && child_slot < ap_daemons_limit) {
cvs commit: apache-apr STATUS
manoj 99/04/18 21:49:16 Modified:.STATUS Log: I like playing Alpha Centauri. Revision ChangesPath 1.20 +7 -1 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.19 retrieving revision 1.20 diff -u -u -r1.19 -r1.20 --- STATUS1999/04/09 02:31:21 1.19 +++ STATUS1999/04/19 04:49:15 1.20 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/04/09 02:31:21 $] +Last modified at [$Date: 1999/04/19 04:49:15 $] Release: @@ -50,6 +50,12 @@ to the parent process rapidly (but not SIGWINCHes). The suspicion is that this is either an error in how pthread calls are used in the server, or a libc bug (the last refuge of a desperate programer). + +When the server runs at a high load, and the load later drops off, +the server tries to kill off some children. The problem is that the +children selected may have threads blocked on the accept lock, so +they will never exit. This wasn't a problem with 1.3, because each +process got kicked out of the lock with a signal. Open issues:
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/04/19 18:31:04 Modified:pthreads/src/main http_main.c Log: Bug fix for scoreboard handling. Before, if only a single child thread was dead, we assumed that the whole child was dead and reused its slot, even if there are other threads still running in that process slot. Now, we actually check two conditions: any_dying_threads and all_dead_threads. If any_dying_threads, we make sure not to count this as a non-dead process that can be told to die. If all_dead_threads, we can reuse the process slot. Revision ChangesPath 1.75 +38 -29apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.74 retrieving revision 1.75 diff -u -u -r1.74 -r1.75 --- http_main.c 1999/04/17 05:10:18 1.74 +++ http_main.c 1999/04/20 01:31:03 1.75 @@ -1934,6 +1934,7 @@ sigset_t sig_mask; int signal_received; pthread_t thread; +int j; my_pid = getpid(); @@ -1982,6 +1983,13 @@ switch (signal_received) { case SIGWINCH: graceful_sig_handler(SIGWINCH); + for (j = 0; j < ap_threads_per_child + ap_acceptors_per_child; + j++) { +/* Useful for debugging */ +if (ap_scoreboard_image->servers[child_num_arg][j].status != SERVER_DEAD) { +ap_scoreboard_image->servers[child_num_arg][j].status = SERVER_GRACEFUL; +} + } graceful_killer(); clean_child_exit(0); break; @@ -2121,47 +2129,48 @@ /* Initialization to satisfy the compiler. It doesn't know * that ap_threads_per_child is always > 0 */ int status = SERVER_DEAD; - idle_thread_count = 0; + int any_dying_threads = 0; + int all_dead_threads = 1; + idle_thread_count = 0; if (i >= max_daemons_limit && free_length == idle_spawn_rate) break; for (j = 0; j < ap_threads_per_child; j++) { ss = &ap_scoreboard_image->servers[i][j]; status = ss->status; - if (status == SERVER_DEAD) { - /* try to keep children numbers as low as possible */ - if (free_length < idle_spawn_rate) { - free_slots[free_length] = i; - ++free_length; - /* We are killing this process, let's leave the loop */ - break; - } - } - else { - /* We consider a starting server as idle because we started it - * at least a cycle ago, and if it still hasn't finished starting - * then we're just going to swamp things worse by forking more. - * So we hopefully won't need to fork more if we count it. - * This depends on the ordering of SERVER_READY and SERVER_STARTING. + + any_dying_threads = any_dying_threads || (status == SERVER_DEAD) +|| (status == SERVER_GRACEFUL); + all_dead_threads = all_dead_threads && (status == SERVER_DEAD); + + /* We consider a starting server as idle because we started it + * at least a cycle ago, and if it still hasn't finished starting + * then we're just going to swamp things worse by forking more. + * So we hopefully won't need to fork more if we count it. + * This depends on the ordering of SERVER_READY and SERVER_STARTING. + */ + if (status <= SERVER_READY) { + ++ idle_thread_count; + /* always kill the highest numbered child if we have to... + * no really well thought out reason ... other than observing + * the server behaviour under linux where lower numbered children + * tend to service more hits (and hence are more likely to have + * their data in cpu caches). */ - if (status <= SERVER_READY) { - ++ idle_thread_count; - /* always kill the highest numbered child if we have to... - * no really well thought out reason ... other than observing - * the server behaviour under linux where lower numbered children - * tend to service more hits (and hence are more likely to have - * their data in cpu caches). - */ - } } } - if (idle_thread_count > ap_idle_thread_threshold) { - idle_count++; - to_kill = i; + if (all_dead_threads && free_length < idle_spawn_
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/04/19 18:43:05 Modified:pthreads/src/main http_main.c Log: Fix comment wrapping. Revision ChangesPath 1.76 +5 -5 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.75 retrieving revision 1.76 diff -u -u -r1.75 -r1.76 --- http_main.c 1999/04/20 01:31:03 1.75 +++ http_main.c 1999/04/20 01:43:04 1.76 @@ -2151,11 +2151,11 @@ */ if (status <= SERVER_READY) { ++ idle_thread_count; - /* always kill the highest numbered child if we have to... - * no really well thought out reason ... other than observing - * the server behaviour under linux where lower numbered children - * tend to service more hits (and hence are more likely to have - * their data in cpu caches). +/* always kill the highest numbered child if we have to... + * no really well thought out reason ... other than observing + * the server behaviour under linux where lower numbered + * children tend to service more hits (and hence are more + * likely to have their data in cpu caches). */ } }
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/04/21 21:14:41 Modified:pthreads/src/main http_main.c Log: We were setting max_daemons_limit based on the last fully living children. Instead, we should set it based on the last non-dead child. Revision ChangesPath 1.77 +3 -1 apache-apr/pthreads/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.76 retrieving revision 1.77 diff -u -u -r1.76 -r1.77 --- http_main.c 1999/04/20 01:43:04 1.76 +++ http_main.c 1999/04/22 04:14:40 1.77 @@ -2163,6 +2163,9 @@ free_slots[free_length] = i; ++free_length; } + if (!all_dead_threads) { + max_daemons_limit = i + 1; + } if (!any_dying_threads) { ++total_non_dead; last_non_dead = i; @@ -2173,7 +2176,6 @@ } } } -max_daemons_limit = last_non_dead + 1; if (idle_count > ap_daemons_max_free) { /* kill off one child... we use SIGWINCH because that'll cause it to * shut down gracefully, in case it happened to pick up a request
cvs commit: apache-apr/pthreads/src/modules/standard mod_info.c
manoj 99/04/21 22:13:42 Modified:pthreads/src/modules/standard mod_info.c Log: Remove ap_excess_requests_per_child reference that broke compilation, for now anyway. Revision ChangesPath 1.6 +0 -3 apache-apr/pthreads/src/modules/standard/mod_info.c Index: mod_info.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_info.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -u -r1.5 -r1.6 --- mod_info.c1999/04/09 02:31:24 1.5 +++ mod_info.c1999/04/22 05:13:41 1.6 @@ -432,9 +432,6 @@ ap_rprintf(r, "Threads: " "per child: %d \n", ap_threads_per_child); -ap_rprintf(r, "Excess requests: " -"per child: %d \n", -ap_excess_requests_per_child); ap_rprintf(r, "Timeouts: " "connection: %d " "keep-alive: %d",
cvs commit: apache-apr/pthreads/src/main http_accept.c
manoj 99/04/21 22:46:54 Modified:pthreads/src/main http_accept.c Log: Delete unused variable to eliminate a warning. Revision ChangesPath 1.10 +0 -1 apache-apr/pthreads/src/main/http_accept.c Index: http_accept.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -u -r1.9 -r1.10 --- http_accept.c 1999/04/17 04:25:56 1.9 +++ http_accept.c 1999/04/22 05:46:53 1.10 @@ -382,7 +382,6 @@ int sd; int srv; listen_rec *lr; -int index; size_t len = sizeof(struct sockaddr);
cvs commit: apache-apr STATUS
manoj 99/04/22 00:02:52 Modified:.STATUS Log: saladfork.com is taken. Oh well. Revision ChangesPath 1.21 +14 -2 apache-apr/STATUS Index: STATUS === RCS file: /home/cvs/apache-apr/STATUS,v retrieving revision 1.20 retrieving revision 1.21 diff -u -u -r1.20 -r1.21 --- STATUS1999/04/19 04:49:15 1.20 +++ STATUS1999/04/22 07:02:52 1.21 @@ -1,5 +1,5 @@ Apache Portable Runtime STATUS: -Last modified at [$Date: 1999/04/19 04:49:15 $] +Last modified at [$Date: 1999/04/22 07:02:52 $] Release: @@ -55,7 +55,19 @@ the server tries to kill off some children. The problem is that the children selected may have threads blocked on the accept lock, so they will never exit. This wasn't a problem with 1.3, because each -process got kicked out of the lock with a signal. +process got kicked out of the lock with a signal. This could be solved +(Thanks, Dean) with a server-wide pipe that replaces the SIGWINCH signal. +This would wake up every thread when a single child death signal is sent +over the pipe. + +Related to the above: On Red Hat 5.2, when we SIGTERM the server and +the server is in this state, the children waiting on fcntl will not +die, even though nobody else is holding the lock, verified with lsof. +The children eventually will be SIGKILLed by the parent. This only +happens in USE_MULTI_ACCEPT mode, and the problem goes away when +USE_INTRAPROCESS_SERIALIZED_ACCEPT is undefined. Dean has a couple of +suggestions for tracing down this problem in +<[EMAIL PROTECTED]> Open issues:
cvs commit: apache-apr/pthreads/src/main acceptlock.c
manoj 99/04/22 12:09:02 Modified:pthreads/src/main acceptlock.c Log: Go back to old behavior of retrying flock and fcntl when EINTR is received. Our worker and acceptor threads don't receive signals anyway, and the old code would make us retry fcntl if we got any error besides EINTR. Revision ChangesPath 1.8 +7 -7 apache-apr/pthreads/src/main/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- acceptlock.c 1999/04/17 03:35:54 1.7 +++ acceptlock.c 1999/04/22 19:09:01 1.8 @@ -530,11 +530,11 @@ intra_mutex_on(locknum); while ((ret = fcntl(lock_fd[locknum], F_SETLKW, &lock_it)) < 0 && -errno != EINTR) { +errno == EINTR) { /* nop */ } -if (ret < 0 && errno != EINTR) { +if (ret < 0) { ap_log_error(APLOG_MARK, APLOG_EMERG, (const server_rec*) ap_get_server_conf(), "fcntl: F_SETLKW: Error getting accept lock, exiting! " "Perhaps you need to use the LockFile directive to place " @@ -548,10 +548,10 @@ int ret; while ((ret = fcntl(lock_fd[locknum], F_SETLKW, &unlock_it)) < 0 -&& errno != EINTR) { +&& errno == EINTR) { /* nop */ } -if (ret < 0 && errno != EINTR) { +if (ret < 0) { ap_log_error(APLOG_MARK, APLOG_EMERG, (const server_rec*) ap_get_server_conf(), "fcntl: F_SETLKW: Error freeing accept lock, exiting! " "Perhaps you need to use the LockFile directive to place " @@ -630,10 +630,10 @@ int ret; intra_mutex_on(locknum); -while ((ret = flock(lock_fd[locknum], LOCK_EX)) < 0 && errno != EINTR) +while ((ret = flock(lock_fd[locknum], LOCK_EX)) < 0 && errno == EINTR) continue; -if (ret < 0 && errno != EINTR) { +if (ret < 0) { ap_log_error(APLOG_MARK, APLOG_EMERG, (const server_rec *) ap_get_server_conf(), "flock: LOCK_EX: Error getting accept lock. Exiting!"); @@ -643,7 +643,7 @@ void accept_mutex_off(int locknum) { -if (flock(lock_fd[locknum], LOCK_UN) < 0 && errno != EINTR) { +if (flock(lock_fd[locknum], LOCK_UN) < 0) { ap_log_error(APLOG_MARK, APLOG_EMERG, (const server_rec *) ap_get_server_conf(), "flock: LOCK_UN: Error freeing accept lock. Exiting!");
cvs commit: apache-apr/pthreads/src/modules/standard mod_status.c
manoj 99/04/26 15:31:10 Modified:pthreads/src/modules/standard mod_status.c Log: Fix the display when ExtendedStatus is off to show thread and process IDs. Revision ChangesPath 1.9 +2 -2 apache-apr/pthreads/src/modules/standard/mod_status.c Index: mod_status.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_status.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -u -r1.8 -r1.9 --- mod_status.c 1999/04/01 06:24:48 1.8 +++ mod_status.c 1999/04/26 22:31:04 1.9 @@ -470,8 +470,8 @@ for (i = 0; i < HARD_SERVER_LIMIT; ++i) { for (j = 0; j < HARD_SERVER_LIMIT; ++j) { if (stat_buffer[i][j] != '.') { - ap_rprintf(r, " %d in state: %c ", pid_buffer[i], - stat_buffer[i][j]); + ap_rprintf(r, " %d,%d in state: %c ", pid_buffer[i], +tid_buffer[i][j], stat_buffer[i][j]); if (++k >= 3) { ap_rputs("\n", r); k = 0;
cvs commit: apache-apr/pthreads/src/modules/standard mod_status.c
manoj 99/04/26 15:36:36 Modified:pthreads/src/modules/standard mod_status.c Log: Blah, another mod_status bug I missed. Revision ChangesPath 1.10 +1 -1 apache-apr/pthreads/src/modules/standard/mod_status.c Index: mod_status.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_status.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -u -r1.9 -r1.10 --- mod_status.c 1999/04/26 22:31:04 1.9 +++ mod_status.c 1999/04/26 22:36:35 1.10 @@ -468,7 +468,7 @@ ap_rputs("PID Key: \n", r); ap_rputs("\n", r); for (i = 0; i < HARD_SERVER_LIMIT; ++i) { - for (j = 0; j < HARD_SERVER_LIMIT; ++j) { + for (j = 0; j < HARD_THREAD_LIMIT; ++j) { if (stat_buffer[i][j] != '.') { ap_rprintf(r, " %d,%d in state: %c ", pid_buffer[i], tid_buffer[i][j], stat_buffer[i][j]);
cvs commit: apache-apr/pthreads/src/modules/standard mod_status.c
manoj 99/04/26 15:46:54 Modified:pthreads/src/modules/standard mod_status.c Log: pthread_t is not necessarily an integer, yet it was treated as one in mod_status. For now, just use the index of the thread in the scoreboard instead. Revision ChangesPath 1.11 +4 -6 apache-apr/pthreads/src/modules/standard/mod_status.c Index: mod_status.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_status.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -u -r1.10 -r1.11 --- mod_status.c 1999/04/26 22:36:35 1.10 +++ mod_status.c 1999/04/26 22:46:53 1.11 @@ -253,7 +253,6 @@ parent_score ps_record; char stat_buffer[HARD_SERVER_LIMIT][HARD_THREAD_LIMIT]; int pid_buffer[HARD_SERVER_LIMIT]; -int tid_buffer[HARD_SERVER_LIMIT][HARD_THREAD_LIMIT]; clock_t tu, ts, tcu, tcs; server_rec *vhost; @@ -314,7 +313,6 @@ res = score_record.status; stat_buffer[i][j] = status_flags[res]; pid_buffer[i] = (int) ps_record.pid; - tid_buffer[i][j] = (int) score_record.tid; if (res == SERVER_READY) ready++; else if (res != SERVER_DEAD && res != SERVER_ACCEPTING @@ -470,8 +468,8 @@ for (i = 0; i < HARD_SERVER_LIMIT; ++i) { for (j = 0; j < HARD_THREAD_LIMIT; ++j) { if (stat_buffer[i][j] != '.') { - ap_rprintf(r, " %d,%d in state: %c ", pid_buffer[i], -tid_buffer[i][j], stat_buffer[i][j]); + ap_rprintf(r, " %d,%d in state: %c ", pid_buffer[i], j, +stat_buffer[i][j]); if (++k >= 3) { ap_rputs("\n", r); k = 0; @@ -550,7 +548,7 @@ "Server %d-%d (pid: %d, tid: %d): %d|%lu|%lu [", i, (int) ps_record.generation, (int) ps_record.pid, - (int) score_record.tid, + (int) j, (int) conn_lres, my_lres, lres); switch (score_record.status) { @@ -623,7 +621,7 @@ ap_rprintf(r, "%d-%d%d%d%d/%lu/%lu", i, (int) ps_record.generation, - (int) ps_record.pid, (int) score_record.tid, (int) conn_lres, + (int) ps_record.pid, (int) j, (int) conn_lres, my_lres, lres); switch (score_record.status) {
cvs commit: apache-apr/pthreads/src/modules/experimental mod_mmap_static.c
manoj 99/04/26 23:20:04 Modified:pthreads/src/modules/experimental mod_mmap_static.c Log: mod_mmap_static works out of the box. Boosted results of an unscientific benchmark by 19%. Revision ChangesPath 1.3 +6 -0 apache-apr/pthreads/src/modules/experimental/mod_mmap_static.c Index: mod_mmap_static.c === RCS file: /home/cvs/apache-apr/pthreads/src/modules/experimental/mod_mmap_static.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- mod_mmap_static.c 1999/02/07 06:29:46 1.2 +++ mod_mmap_static.c 1999/04/27 06:20:01 1.3 @@ -122,6 +122,12 @@ #include "http_request.h" #include "http_core.h" +/* XXX - ap_{block,unblock}_alarms aren't used right now, but they could + * be, so just #define them away for now */ + +#define ap_block_alarms() +#define ap_unblock_alarms() + module MODULE_VAR_EXPORT mmap_static_module; typedef struct {