Ryan Bloom [Sat, 29 Jul 2000 07:29:48 +0000 (07:29 +0000)]
Associate virtual hosts with a specific child process. This doesn't
work quite yet. The problem right now is that the thread doesn't really
have the logic required to pass the request to the next child process.
Jeff Trawick [Sat, 29 Jul 2000 03:08:13 +0000 (03:08 +0000)]
Change the storage allocation mechanism for ap_proc_t structures
passed to ap_note_subprocess() by mod_rewrite and mod_include. The
storage needs to last as long as the pool passed to
ap_note_subprocess(), so autodata won't work.
The mod_rewrite change wasn't tested. A normal build with mod_rewrite
on Linux currently results in the link failing due to unresolved
references to dbm_*.
Ryan Bloom [Fri, 28 Jul 2000 20:31:02 +0000 (20:31 +0000)]
Add the ability to register filters. This commit introduces a warning
into the build. This warning will be removed automatically, as soon as
we decide on a prototype for the function causing the warning. That
decision is tied to which filtering mechanism we decide on.
Submitted by: Ryan Bloom and Greg Stein
Ryan Bloom [Fri, 28 Jul 2000 19:34:39 +0000 (19:34 +0000)]
Cleanup the perchild MPM. What I am doing so far in this MPM does not
require hashes. This makes it much easier to now associate the child
process with a virtual host.
Jeff Trawick [Fri, 28 Jul 2000 18:15:21 +0000 (18:15 +0000)]
Use ap_note_subprocess() to register the mod_cgid daemon process for cleanup
so that it is killed at termination if it does not die when the parent gets
SIGTERM. This change is to fix occasional problems where the process stays
around.
Ryan Bloom [Fri, 28 Jul 2000 17:45:13 +0000 (17:45 +0000)]
Update the perchild MPM. At this point, it is possible to specify that
a child process runs as a specified user. That child process is not
currently tied to a virtual host. Using this MPM, I can launch Apache
and have it serve as both nobody and rbb.
Bill Stoddard [Thu, 27 Jul 2000 18:42:39 +0000 (18:42 +0000)]
Win32: Revamp NT shutdown code. I think this shutdown code is pretty close
to production ready. Introduce a two-phase shutdown. First phase is
shutdown_pending which prevents new contexts from being queued to the
AcceptEx completion port. The server runs for a period (~1 second)
in this state to enable threads to drain the completion port of active
connections by handling the connections. This works very well on a busy
server as the contexts are consumed quickly and completely (leaving non
to cancel in the next phase).
The next phase is the workers_may exit phase, which prevents threads
from blocking on the completion port (especially important to prevent
threads unblocking off of keep-alive connections from calling
GetQueuedCompletionStatus). One we enter this phase, all threads blocked on the
port (we track the number carefully) are unblocked and allowed to exit.
Then we cancel any pending i/o completion contexts on the listeners (those which
were not consumed naturally in the shutdown phase). Then we reap the ABORTED
completion packets off the port. (Possible to reap a few good "accepted"
connections here also. Oh well...). Once we are done reaping completion packets,
we release the start mutex which allows the new child (in a restart) to
begin accepting connections.
It is really REALLY important to not let multiple processes call
GetQueuedCompletionStatus at the same time. Results are unpredictable.
Another day's progress... little changes, but just establishing the
baseline for fully implementing extensions. Filters... that's still
a little way away. This demonstrates the HSE_STATUS_PENDING result
wait event trap, so we let another thread keep working till we get
the HSE_REQ_DONE_WITH_SESSION request. Cleaned up callback names
and tossed bunches of stuff in the isapi_cid (connection/request) and
the isapi_loaded (dll details) for future caching optimizations.
Ryan Bloom [Thu, 27 Jul 2000 00:16:32 +0000 (00:16 +0000)]
Add a new MPM. Currently this is almost an exact copy of the dexter MPM.
In time, this will be the MPM that allows each child process to have a
unique user id. I need a place to work and keep track of my changes.
Don't expect this to work until next week sometime.
Ryan Bloom [Thu, 27 Jul 2000 00:04:11 +0000 (00:04 +0000)]
Cleanup the MPM #defines. Each MPM #defines a unique name that identifies
it to the system. That name should be of the format NAME_MPM where name
is something like DEXTER, MPMT_PTHREAD, SPMT_OS2, etc.
Jeff Trawick [Wed, 26 Jul 2000 18:07:34 +0000 (18:07 +0000)]
Fix some build issues for dexter:
. dexter/scoreboard.c needed apr_strings.h to get the right
function prototypes
. main/mpm_common.c needed to recognize that we were building
for dexter; otherwise, no ap_reclaim_child_processes() was
compiled and linking failed
(It would be nice to standardize on which preprocessor symbols
are checked for... mpmname_MPM seems nice enough. Didn't the
check for symbol mpmname (no "_MPM") come with mpmt.c?)
Ryan Bloom [Wed, 26 Jul 2000 15:31:30 +0000 (15:31 +0000)]
Remove all of the ap_is* functions from Apache. They were already in APR,
and we all hate duplicate code. :-) This also required adding ap_isascii
to APR.
Jeff Trawick [Wed, 26 Jul 2000 14:29:34 +0000 (14:29 +0000)]
packet minimization when doing sendfile...
When preparing to call iol_sendfile(), don't call ap_bflush() first.
Instead, pass the data ap_bflush() would have written (if any) to
iol_sendfile() as a header. In practice, this prevents sending headers
separately from the first part of the file.
Submitted by: Greg Ames
Reviewed by: Jeff Trawick
Ryan Bloom [Wed, 26 Jul 2000 13:48:17 +0000 (13:48 +0000)]
Fix an error in service.c, where we were returning APR_NOTFOUND and
should have been return APR_ENOFILE
Submitted by: Gregory Nicholls <gnicholls@level8.com>
Reviewed by: Ryan Bloom
Ryan Bloom [Wed, 26 Jul 2000 13:45:01 +0000 (13:45 +0000)]
The Windows MPM was sometimes returning APR_NOTFOUND when it should
have been returning APR_ENOFILE. This fixes that problem.
Submitted by: Gregory Nicholls <gnicholls@level8.com>
Reviewed by: Ryan Bloom
- fix POOL_DEBUG ... restored the ap_pool_joins that dreid removed.
- removed the apr_abort foo since every caller was passing it NULL anyway;
and this is debugging code, so i don't have any qualms about using
stderr or abort().
Ryan Bloom [Tue, 25 Jul 2000 23:48:21 +0000 (23:48 +0000)]
REmove the mpmt MPM. This also removes all of the config logic required
to get this MPM to compile. I may try to combine the two threading MPMs
a bit more, or I may not.
Ryan Bloom [Tue, 25 Jul 2000 20:08:12 +0000 (20:08 +0000)]
Change --enable-shared that Apache defines to --enable-mods-shared. The
original name was conflicting with an option for ./configure that libtool
defines automatically.
Ryan Bloom [Tue, 25 Jul 2000 05:35:34 +0000 (05:35 +0000)]
Remove EXEC_ON_READ from ClearModuleList and AddModule. Having these
as EXEC_ON_READ was causing a seg fault, and it was unnecessary. Neither
of these directives changes how the server interprets the config file,
they only change how the server responds to the configuration.
PR: 6318
This should be clean... ap_snprintf already holds a byte for the
null terminator, and this patch sets aside whatever space is needed
for the newline termination.
Add APR_EOL_STR for a platform specific text delimiter, provided by
apr.h (defined in apr.h.in and apr.hw). This is needed -only- in APR
created files (true raw files) such as logs. It is not required in any
splat to screen (stderr/stdout) formatting, nor any html markup.
Some other modules slipped through in the prior apr_strings.h commit.
Sorry 'bout that.
Changes to get Win32 compiling again, including substituting
apr_string.h for apr_lib.h, fix some bad linkage declarations,
and some more comments on threadproc/win32/proc.c
Ryan Bloom [Mon, 24 Jul 2000 20:48:24 +0000 (20:48 +0000)]
Fix some issues with mod_mime_magic. Basically, we need to include
apr_strings.h, the command table needed to be fixed to use the new
format, and we had vestiges of stat left around.
The top two issues are simple, we include apr_strings and fix the command
recs.
The last issue required using APR enums instead of the stat.h macros. This
also allows us to remove some ugly #ifdefs. :-)
Submitted by: Shaun Savage <shaun@igel.de>
Reviewed by: Ryan Bloom
Clean up rules.mk and add support for building C++ source files.
If your module uses C++, you need to add APACHE_REQUIRE_CXX to your
module's config.m4.
Unfortunately, we cannot use any sophisticated pattern matching in make,
so instead of adding the C++ source files to LTLIBRARY_SOURCES, you need
to write for foo.cpp and bar.cpp:
Ryan Bloom [Sun, 23 Jul 2000 17:31:08 +0000 (17:31 +0000)]
Remove apr_strnatcmp.h. All of the functions prototyped in this file
have been moved to apr_strings.h. This also modifes Apache to include
apr_strings.h instead of apr_strnatcmp.h
Ryan Bloom [Fri, 21 Jul 2000 19:50:58 +0000 (19:50 +0000)]
Move all APR functions related to strings to their own directory, and
create a new header for those functions. This is the first step to
removing the apr/lib directory completely, and moving those files/functions
to descriptive directories.
Ryan Bloom [Thu, 20 Jul 2000 21:31:19 +0000 (21:31 +0000)]
Remove a filtering patch from the STATUS file. This was the second patch
I posted, and it was more or less a proof-of-concept for changing the
filter registration method. Everybody agrees the patch was a bad idea, but
it did prove that the filtering registration code could be completely
re-written in very little time.
Jeff Trawick [Wed, 19 Jul 2000 17:42:56 +0000 (17:42 +0000)]
Make ap_child_init_lock() work properly... It didn't
call ap_unix_child_init_lock() at the right time, so any
lock mechanism which had interesting work to do (only flock())
was broken.
Fix the flock() flavor of ap_unix_child_init_lock(). It expected
to create the lock file when it should in fact open the existing
one. It also neglected to return the new ap_lock_t structure to
the caller.
Improve logging of lock init errors in prefork (I know, prefork is
a lame duck, but I used the improved logging in prefork to help
debug the problem).
add ap_full_read() and ap_full_write(). they guarantee to read/write the
full buffer unless an error occurs.
use the new functions in SDBM and DAV. [and Subversion]
Win32 and OS/2 can directly include/use file_io/unix/fullrw.c since it is
written in terms of other APR functions.
ap_dso_init() isn't needed. if/when a platform needs it, then
ap_initialize() can be used to init DSO support. or set up a lazy
initialization for it.
solves the questions, "when do I call it? can I call it more than once?"
Submitted by: Ben Collins-Sussman <sussman@red-bean.com>
Replace this unknown hash function someone contributed with the classical DJB
times 33 hash (using XOR instead of ADD). This hash is better understood and
is faster. Also because in the old function the "& 0xff" was not necessary and
just slowed down processing.
Brian Havard [Fri, 14 Jul 2000 14:45:33 +0000 (14:45 +0000)]
Get smpt_os2 working again after recent reorganization.
- globalize & namespace protects server_conf as ap_server_conf
- puts setup_listeners back in under a more appropriate name
(setup_listen_poll()) as it's quite different to ap_setup_listeners in
mpm_common.c.
- fake a suitable parameter to ap_process_child_status() as it assumes a child
refers to a process when, in the context of spmt_os2, it's a thread.
Bill Stoddard [Wed, 12 Jul 2000 18:40:26 +0000 (18:40 +0000)]
Fix a nasty stack corruption. ap_proc_t should be allocated out of the same
pool passed to ap_create_process. A little further down the road to getting
reliable piped logs working on Win32.
Ryan Bloom [Tue, 11 Jul 2000 19:00:16 +0000 (19:00 +0000)]
Remove all pthreads calls from the mpmt MPM prefork emulation. This makes
the mpmt MPM look almost exactly like the original prefork MPM. Basically,
all that's left is re-naming the defined directives so they work with 1.3
config files. That will come later.
make sure this is defined, so that mpm_common.c compiles with the right
values, functions, whatever. specifically, ap_reclaim_child_processes()
was not getting compiled into mpm_common.
this appears to keep mpmt_pthread running properly. dunno whether a similar
issue exists for prefork or dexter. (until all are torched)
Advisory: This patch is still anywhere but complete. However, it
resolves most of the big bugs of the services to mpm relocation.
I apologize that it's taken this long to get back on this.
Brought across; Keep console open (needs a bit of cleanup and could
be done better now for 2.0), service error event logging, and some
other minor threading cleanup.
Big issues remain: logged errors (even APLOG_STARTUP) drop into the
logfile in spite of our interest in getting them to the user's console.
Some threading sequences may yet be out of sorts, and those will be
cleaned up by the end of the week.
Bill Stoddard [Mon, 10 Jul 2000 21:49:22 +0000 (21:49 +0000)]
Reimplement ap_send_fd. Eliminate ap_send_fd_length. If APR_HAS_SENDFILE is
defined but ap_sendfile fails with APR_ENOTIMPL, the BUFF implementation
of ap_send_fd will get a shot at serving the request. This fix is
required to get Apache working on 95/98 again and can also be useful on
Unix systems where sendfile is available via a servicepack/fixpack/PTF
on a particular level of the OS (e.g., AIX 4.3.2 base does not include
sendfile but is is available with a PTF).
This fix also reimplements the mod_file_cache sendfile_handler using
ap_send_fd and sets the connection aborted flag if the sendfile fails.
Future modification... Add code to ap_send_fd to hijack any data in the
client BUFF structure and send it along with the sendfile.
Ryan Bloom [Mon, 10 Jul 2000 21:37:23 +0000 (21:37 +0000)]
Move setup_listeners to listen.c. This renames it to ap_setup_listeners,
and removes the duplicated code from all effected MPMs. The only this
doesn't touch, is Windows. That MPM was using a different setup_listeners.
If one of the Windows guys would like to modify the WinNT MPM to use the
same setup_lsiteners, that would be VERY cool.
Ryan Bloom [Mon, 10 Jul 2000 18:21:24 +0000 (18:21 +0000)]
Move process_child_status to mpm_common.c. This requires re-naming it
to ap_process_child_status and opening up ap_coredump_dir. I have
modified all of the MPMs that I saw using this function to work with this
patch. Sorry if I broke anybody.
Ryan Bloom [Mon, 10 Jul 2000 15:07:40 +0000 (15:07 +0000)]
Stop doing the find for make clean. This was causing us to clean every
directory twice. We should still clean those directories that weren't
configured in the current configuration, but this wasn't the right
solution.
complete the removal of the old dav_dyn crap. dav plugins are now
implemented entirely through standard Apache modules, hooks, and some
additional registration.
new liveprop namespace registration and lookup. modules register each
namespace they will use, which then receives a process-wide index.
get rid of old dav_liveprop_uris global (and minor cleaning in dav_dyn);
encapsulate liveprop handling in liveprop.c.
do not build/use an ns_map; use dav_get_liveprop_ns_index().
Ryan Bloom [Sun, 9 Jul 2000 23:12:44 +0000 (23:12 +0000)]
Fix mpm_common for use with the real prefork MPM. This was broken when
mpmt was added. This change can be removed when the MPM stuff calms down
a bit and either mpmt or three separate MPMs are chosen.
Ryan Bloom [Sun, 9 Jul 2000 18:54:08 +0000 (18:54 +0000)]
Fix building the mpmt MPM. The problem was that IfModule uses the name of
the C file to determine if a module is present. mpmt emulates three
different MPMs though. If the default config file we have sane defaults
for each of the three MPMs that mpmt emulates.
To fix this, the build process creates a soft link to the original MPM name
during the configure process, and the build process actually compiles that
file, instead of the original mpmt.c. This allow the mpmt MPM to work
just as well as mpmt_pthread.