cvs commit: apache-2.0/mpm/src/modules/mpm/mpmt_pthread mpmt_pthread.c
manoj 99/07/15 17:24:07 Modified:mpm/src/modules/mpm/mpmt_pthread mpmt_pthread.c Log: poll+accept without accept serialziation is dangerous, so for the moment, keep serialization on all the time and get rid of the attempts to make its usage thread-safe. Revision ChangesPath 1.7 +9 -14 apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpmt_pthread.c Index: mpmt_pthread.c === RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -u -r1.6 -r1.7 --- mpmt_pthread.c1999/07/09 20:40:22 1.6 +++ mpmt_pthread.c1999/07/16 00:24:04 1.7 @@ -91,8 +91,7 @@ static int workers_may_exit = 0; static int requests_this_child; static int num_listenfds = 0; -static struct pollfd *listenfds_child; /* The listenfds that each thread copies - for itself */ +static struct pollfd *listenfds; /* The structure used to pass unique initialization info to each thread */ typedef struct { @@ -102,7 +101,7 @@ pool *tpool; /* pthread would be confusing */ } proc_info; -#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT +#if 0 #define SAFE_ACCEPT(stmt) do {if (ap_listeners-next != NULL) {stmt;}} while (0) #else #define SAFE_ACCEPT(stmt) do {stmt;} while (0) @@ -867,7 +866,6 @@ char pipe_read_char; int curr_pollfd, last_pollfd = 0; size_t len = sizeof(struct sockaddr); -struct pollfd *listenfds; free(ti); @@ -879,9 +877,6 @@ /* TODO: Switch to a system where threads reuse the results from earlier poll calls - manoj */ -/* set up each thread's individual pollfd array */ -listenfds = ap_palloc(tpool, sizeof(struct pollfd) * (num_listenfds + 1)); -memcpy(listenfds, listenfds_child, sizeof(struct pollfd) * (num_listenfds + 1)); while (!workers_may_exit) { workers_may_exit |= (ap_max_requests_per_child != 0) (requests_this_child = 0); if (workers_may_exit) break; @@ -1017,14 +1012,14 @@ requests_this_child = ap_max_requests_per_child; /* Set up the pollfd array */ -listenfds_child = ap_palloc(pchild, sizeof(struct pollfd) * (num_listenfds + 1)); -listenfds_child[0].fd = pipe_of_death[0]; -listenfds_child[0].events = POLLIN; -listenfds_child[0].revents = 0; +listenfds = ap_palloc(pchild, sizeof(struct pollfd) * (num_listenfds + 1)); +listenfds[0].fd = pipe_of_death[0]; +listenfds[0].events = POLLIN; +listenfds[0].revents = 0; for (lr = ap_listeners, i = 1; i = num_listenfds; lr = lr-next, ++i) { -listenfds_child[i].fd = lr-fd; -listenfds_child[i].events = POLLIN; /* should we add POLLPRI ?*/ -listenfds_child[i].revents = 0; +listenfds[i].fd = lr-fd; +listenfds[i].events = POLLIN; /* should we add POLLPRI ?*/ +listenfds[i].revents = 0; } /* Setup worker threads */
cvs commit: apache-2.0/mpm/src/modules/mpm/spmt_os2 mpm_default.h Makefile.tmpl spmt_os2.c
manoj 99/07/15 22:30:36 Modified:mpm/src/include httpd.h mpm/src/modules/mpm/mpmt_pthread Makefile.tmpl acceptlock.c mpmt_pthread.h scoreboard.h mpm/src/modules/mpm/prefork Makefile.tmpl prefork.c mpm/src/modules/mpm/spmt_os2 Makefile.tmpl spmt_os2.c Added: mpm/src/modules/mpm/mpmt_pthread mpm_default.h mpm/src/modules/mpm/prefork mpm_default.h mpm/src/modules/mpm/spmt_os2 mpm_default.h Log: Move HARD_SERVER_LIMIT, HARD_THREAD_LIMIT, and other defines from httpd.h that are really mpm-specific, and move them into a header file in each MPM directory. Revision ChangesPath 1.7 +0 -47 apache-2.0/mpm/src/include/httpd.h Index: httpd.h === RCS file: /home/cvs/apache-2.0/mpm/src/include/httpd.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -u -r1.6 -r1.7 --- httpd.h 1999/07/12 22:51:09 1.6 +++ httpd.h 1999/07/16 05:30:25 1.7 @@ -277,53 +277,6 @@ /* The size of the server's internal read-write buffers */ #define IOBUFSIZE 8192 -/* Number of servers to spawn off by default --- also, if fewer than - * this free when the caretaker checks, it will spawn more. - */ -#ifndef DEFAULT_START_DAEMON -#define DEFAULT_START_DAEMON 5 -#endif - -/* Maximum number of *free* server processes --- more than this, and - * they will die off. - */ - -#ifndef DEFAULT_MAX_FREE_DAEMON -#define DEFAULT_MAX_FREE_DAEMON 10 -#endif - -/* Minimum --- fewer than this, and more will be created */ - -#ifndef DEFAULT_MIN_FREE_DAEMON -#define DEFAULT_MIN_FREE_DAEMON 5 -#endif - -/* Limit on the total --- clients will be locked out if more servers than - * this are needed. It is intended solely to keep the server from crashing - * when things get out of hand. - * - * We keep a hard maximum number of servers, for two reasons --- first off, - * in case something goes seriously wrong, we want to stop the fork bomb - * short of actually crashing the machine we're running on by filling some - * kernel table. Secondly, it keeps the size of the scoreboard file small - * enough that we can read the whole thing without worrying too much about - * the overhead. - */ -#ifndef HARD_SERVER_LIMIT -#define HARD_SERVER_LIMIT 8 -#endif - -/* Limit on the threads per process. Clients will be locked out if more than - * this * HARD_SERVER_LIMIT are needed. - * - * We keep this for one reason it keeps the size of the scoreboard file small - * enough that we can read the whole thing without worrying too much about - * the overhead. - */ -#ifndef HARD_THREAD_LIMIT -#define HARD_THREAD_LIMIT 64 -#endif - /* * Special Apache error codes. These are basically used * in http_main.c so we can keep track of various errors. 1.6 +2 -3 apache-2.0/mpm/src/modules/mpm/mpmt_pthread/Makefile.tmpl Index: Makefile.tmpl === RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/mpmt_pthread/Makefile.tmpl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -u -r1.5 -r1.6 --- Makefile.tmpl 1999/07/13 20:32:49 1.5 +++ Makefile.tmpl 1999/07/16 05:30:28 1.6 @@ -81,8 +81,7 @@ $(INCDIR)/ap_hooks.h $(INCDIR)/http_core.h \ $(INCDIR)/http_connection.h $(INCDIR)/ap_mpm.h \ $(OSDIR)/unixd.h $(OSDIR)/iol_socket.h \ - $(INCDIR)/ap_listen.h scoreboard.h \ - acceptlock.h ../../../lib/expat-lite/xmlparse.h + $(INCDIR)/ap_listen.h scoreboard.h mpm_default.h acceptlock.h scoreboard.o: scoreboard.c $(INCDIR)/httpd.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ @@ -94,4 +93,4 @@ $(INCDIR)/http_main.h $(INCDIR)/http_core.h \ $(INCDIR)/http_config.h $(INCDIR)/ap_hooks.h \ $(OSDIR)/unixd.h $(INCDIR)/http_conf_globals.h \ - mpmt_pthread.h scoreboard.h + mpmt_pthread.h scoreboard.h mpm_default.h 1.6 +1 -0 apache-2.0/mpm/src/modules/mpm/mpmt_pthread/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/mpmt_pthread/acceptlock.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -u -r1.5 -r1.6 --- acceptlock.c 1999/07/09 20:40:20 1.5 +++ acceptlock.c 1999/07/16 05:30:28 1.6 @@ -153,6 +153,7 @@ /* XXX - Don't know if we need the intraprocess locks here */ #include ulocks.h +#include mpm_default.h static ulock_t *uslock = NULL; 1.3 +5 -0 apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpmt_pthread.h Index: mpmt_pthread.h === RCS file:
cvs commit: apache-2.0/mpm/src/modules/mpm/mpmt_pthread mpmt_pthread.c
martin 99/07/16 00:15:49 Modified:mpm/src/modules/mpm/mpmt_pthread mpmt_pthread.c Log: Use new module structure Revision ChangesPath 1.8 +0 -2 apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpmt_pthread.c Index: mpmt_pthread.c === RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- mpmt_pthread.c1999/07/16 00:24:04 1.7 +++ mpmt_pthread.c1999/07/16 07:15:48 1.8 @@ -1768,8 +1768,6 @@ NULL,/* merge per-server config structures */ mpmt_pthread_cmds, /* command table */ NULL,/* handlers */ -NULL,/* translate_handler */ -NULL,/* check_user_id */ NULL,/* check auth */ NULL,/* check access */ NULL,/* type_checker */
cvs commit: apache-2.0/mpm/src/modules/standard mod_cgi.c mod_actions.c mod_include.c
martin 99/07/16 01:28:44 Modified:mpm/src/modules/standard mod_cgi.c mod_actions.c mod_include.c Log: Use new module structure Revision ChangesPath 1.3 +1 -4 apache-2.0/mpm/src/modules/standard/mod_cgi.c Index: mod_cgi.c === RCS file: /home/cvs/apache-2.0/mpm/src/modules/standard/mod_cgi.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- mod_cgi.c 1999/06/19 18:10:05 1.2 +++ mod_cgi.c 1999/07/16 08:28:40 1.3 @@ -573,13 +573,10 @@ merge_cgi_config,/* merge server config */ cgi_cmds,/* command table */ cgi_handlers,/* handlers */ -NULL,/* filename translation */ -NULL,/* check_user_id */ NULL,/* check auth */ NULL,/* check access */ NULL,/* type_checker */ NULL,/* fixups */ NULL,/* logger */ -NULL,/* header parser */ -NULL /* post read-request */ +NULL /* register hooks */ }; 1.4 +1 -3 apache-2.0/mpm/src/modules/standard/mod_actions.c Index: mod_actions.c === RCS file: /home/cvs/apache-2.0/mpm/src/modules/standard/mod_actions.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- mod_actions.c 1999/07/07 15:19:14 1.3 +++ mod_actions.c 1999/07/16 08:28:41 1.4 @@ -222,9 +222,7 @@ NULL,/* merge server config */ action_cmds, /* command table */ action_handlers, /* handlers */ -NULL,/* filename translation */ -NULL,/* check_user_id */ -NULL,/* check auth */ +NULL, /* check auth */ NULL,/* check access */ NULL,/* type_checker */ NULL,/* fixups */ 1.3 +1 -4 apache-2.0/mpm/src/modules/standard/mod_include.c Index: mod_include.c === RCS file: /home/cvs/apache-2.0/mpm/src/modules/standard/mod_include.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- mod_include.c 1999/06/19 18:10:08 1.2 +++ mod_include.c 1999/07/16 08:28:42 1.3 @@ -2478,13 +2478,10 @@ NULL, /* merge server config */ includes_cmds, /* command table */ includes_handlers, /* handlers */ -NULL, /* filename translation */ -NULL, /* check_user_id */ NULL, /* check auth */ NULL, /* check access */ NULL, /* type_checker */ NULL, /* fixups */ NULL, /* logger */ -NULL, /* header parser */ -NULL/* post read-request */ +NULL /* register hooks */ };
cvs commit: apache-2.0/mpm/src/modules/mpm/mpmt_pthread mpmt_pthread.c
rse 99/07/16 03:27:05 Modified:mpm/src/modules/mpm/mpmt_pthread mpmt_pthread.c Log: Be careful, accept_mutex_child_init() has to be done _before_ unixd_setup_child() switches the process UID, because else under platforms where the mutex is flock() based this fails... Revision ChangesPath 1.9 +3 -2 apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpmt_pthread.c Index: mpmt_pthread.c === RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- mpmt_pthread.c1999/07/16 07:15:48 1.8 +++ mpmt_pthread.c1999/07/16 10:27:03 1.9 @@ -992,12 +992,13 @@ /*stuff to do before we switch id's, so we have permissions.*/ reopen_scoreboard(pchild); +SAFE_ACCEPT(intra_mutex_init(pchild, 1)); +SAFE_ACCEPT(accept_mutex_child_init(pchild)); + if (unixd_setup_child()) { clean_child_exit(APEXIT_CHILDFATAL); } -SAFE_ACCEPT(intra_mutex_init(pchild, 1)); -SAFE_ACCEPT(accept_mutex_child_init(pchild)); ap_child_init_hook(pchild, server_conf); /*done with init critical section */
cvs commit: apache-2.0/mpm/src/modules/standard Makefile.tmpl
ben 99/07/16 11:24:27 Modified:mpm/src Configure mpm/src/main Makefile.tmpl mpm/src/modules/mpm/prefork Makefile.tmpl mpm/src/modules/standard Makefile.tmpl Log: Make dependencies work again. Revision ChangesPath 1.13 +14 -14apache-2.0/mpm/src/Configure Index: Configure === RCS file: /export/home/cvs/apache-2.0/mpm/src/Configure,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- Configure 1999/07/12 22:51:06 1.12 +++ Configure 1999/07/16 18:24:23 1.13 @@ -790,12 +790,25 @@ SUBDIRS=$OSDIR $SUBDIRS +## Now handle the MPM implementation. Default to 1.3 prefork +## +if [ x$RULE_MPM_METHOD = xdefault ]; then +if [ x$DEF_MPM_METHOD = x ]; then + RULE_MPM_METHOD=prefork +else + RULE_MPM_METHOD=$DEF_MPM_METHOD +fi +fi +## +MPM_METHOD=$RULE_MPM_METHOD + + # Continue building the stub file # Set variables as soon as possible so that TestCompile can use them ## echo Makefile.config OSDIR=\$(SRCDIR)/$OSDIR echo Makefile.config INCDIR=\$(SRCDIR)/include -echo Makefile.config INCLUDES0=-I\$(OSDIR) -I\$(INCDIR) +echo Makefile.config INCLUDES0=-I\$(OSDIR) -I\$(INCDIR) -I\$(SRCDIR)/modules/mpm/$MPM_METHOD echo Makefile.config SHELL=$SHELL @@ -808,19 +821,6 @@ RULE_WANTHSREGEX=$DEF_WANTHSREGEX fi fi - - -## Now handle the MPM implementation. Default to 1.3 prefork -## -if [ x$RULE_MPM_METHOD = xdefault ]; then -if [ x$DEF_MPM_METHOD = x ]; then - RULE_MPM_METHOD=prefork -else - RULE_MPM_METHOD=$DEF_MPM_METHOD -fi -fi -## -MPM_METHOD=$RULE_MPM_METHOD ## Now we determine the C-compiler and optimization level 1.13 +0 -8 apache-2.0/mpm/src/main/Makefile.tmpl Index: Makefile.tmpl === RCS file: /export/home/cvs/apache-2.0/mpm/src/main/Makefile.tmpl,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- Makefile.tmpl 1999/07/11 16:36:51 1.12 +++ Makefile.tmpl 1999/07/16 18:24:25 1.13 @@ -153,14 +153,6 @@ $(INCDIR)/buff.h $(INCDIR)/ap_iol.h $(INCDIR)/ap.h \ $(INCDIR)/apr.h $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \ $(INCDIR)/ap_hooks.h $(INCDIR)/ap_listen.h $(INCDIR)/http_log.h -mpm_prefork.o: mpm_prefork.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)/alloc.h \ - $(INCDIR)/buff.h $(INCDIR)/ap_iol.h $(INCDIR)/ap.h \ - $(INCDIR)/apr.h $(INCDIR)/util_uri.h $(INCDIR)/http_main.h \ - $(INCDIR)/http_log.h $(INCDIR)/http_config.h $(INCDIR)/ap_hooks.h \ - $(INCDIR)/http_core.h $(INCDIR)/http_connection.h \ - $(INCDIR)/scoreboard_prefork.h rfc1413.o: rfc1413.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)/alloc.h \ 1.8 +3 -4 apache-2.0/mpm/src/modules/mpm/prefork/Makefile.tmpl Index: Makefile.tmpl === RCS file: /export/home/cvs/apache-2.0/mpm/src/modules/mpm/prefork/Makefile.tmpl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Makefile.tmpl 1999/07/16 05:30:31 1.7 +++ Makefile.tmpl 1999/07/16 18:24:25 1.8 @@ -59,10 +59,9 @@ $(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 $(INCDIR)/alloc.h \ - $(INCDIR)/buff.h $(INCDIR)/ap_iol.h \ - $(INCDIR)/ap.h $(INCDIR)/apr.h \ - $(INCDIR)/util_uri.h mpm_default.h \ + $(INCDIR)/alloc.h $(INCDIR)/buff.h \ + $(INCDIR)/ap_iol.h $(INCDIR)/ap.h \ + $(INCDIR)/apr.h $(INCDIR)/util_uri.h mpm_default.h \ $(INCDIR)/http_main.h $(INCDIR)/http_log.h \ $(INCDIR)/http_config.h $(INCDIR)/ap_hooks.h \ $(INCDIR)/http_core.h $(INCDIR)/http_connection.h \ 1.7 +3 -2 apache-2.0/mpm/src/modules/standard/Makefile.tmpl Index: Makefile.tmpl === RCS file: /export/home/cvs/apache-2.0/mpm/src/modules/standard/Makefile.tmpl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Makefile.tmpl 1999/07/11 16:36:51
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/07/16 12:45:49 Modified:pthreads/src/main http_main.c Log: Ralf noted that accept_mutex_child_init() has to be done before changing the child's UID for platforms using the flock() mutex. Fix it in this tree. Revision ChangesPath 1.93 +2 -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.92 retrieving revision 1.93 diff -u -d -u -r1.92 -r1.93 --- http_main.c 1999/06/10 06:26:09 1.92 +++ http_main.c 1999/07/16 19:45:48 1.93 @@ -1843,13 +1843,14 @@ set_group_privs(); +accept_child_init(pchild, ap_threads_per_child); + if (!geteuid() (setuid(ap_user_id) == -1)) { ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, setuid: unable to change uid); clean_child_exit(APEXIT_CHILDFATAL); } -accept_child_init(pchild, ap_threads_per_child); ap_child_init_modules(pchild, server_conf); /*done with init critical section */