cvs commit: apache-2.0/src/modules/mpm/prefork prefork.c
rbb 00/02/10 15:46:36 Modified:src/lib/apr/shmem/unix shmem.c src/modules/mpm/prefork prefork.c Log: Make the prefork MPM use APR shared memory for it's scoreboard. Revision ChangesPath 1.5 +1 -2 apache-2.0/src/lib/apr/shmem/unix/shmem.c Index: shmem.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/shmem/unix/shmem.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- shmem.c 2000/01/27 23:49:31 1.4 +++ shmem.c 2000/02/10 23:46:29 1.5 @@ -89,7 +89,6 @@ ap_status_t ap_shm_destroy(struct shmem_t *m) { mm_destroy(m-mm); -m-mm = NULL; return APR_SUCCESS; } @@ -108,7 +107,7 @@ } /* ***APRDOC - * ap_status_t ap_shm_calloc(ap_shmem_t *, ap_size_t) + * void *ap_shm_calloc(ap_shmem_t *, ap_size_t) *allocate memory from the block of shared memory and initialize it *to zero. * arg 1) The shared memory block to destroy. 1.67 +23 -444 apache-2.0/src/modules/mpm/prefork/prefork.c Index: prefork.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/prefork/prefork.c,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- prefork.c 2000/01/28 18:02:08 1.66 +++ prefork.c 2000/02/10 23:46:33 1.67 @@ -106,10 +106,6 @@ #include sys/times.h #include sys/types.h #include sys/wait.h -#ifdef USE_SHMGET_SCOREBOARD -#include sys/ipc.h -#include sys/shm.h -#endif @@ -905,479 +901,63 @@ return -1; } #endif - -/* - * - * Dealing with the scoreboard... a lot of these variables are global - * only to avoid getting clobbered by the longjmp() that happens when - * a hard timeout expires... - * - * We begin with routines which deal with the file itself... - */ -#if defined(USE_OS2_SCOREBOARD) +#if APR_HAS_SHARED_MEMORY +#include apr_shmem.h -/* The next two routines are used to access shared memory under OS/2. */ -/* This requires EMX v09c to be installed. */ +static ap_shmem_t *scoreboard_shm = NULL; -caddr_t create_shared_heap(const char *name, size_t size) +static ap_status_t cleanup_shared_mem(void *d) { -ULONG rc; -void *mem; -Heap_t h; - -rc = DosAllocSharedMem(mem, name, size, -PAG_COMMIT | PAG_READ | PAG_WRITE); -if (rc != 0) - return NULL; -h = _ucreate(mem, size, !_BLOCK_CLEAN, _HEAP_REGULAR | _HEAP_SHARED, - NULL, NULL); -if (h == NULL) - DosFreeMem(mem); -return (caddr_t) h; -} - -caddr_t get_shared_heap(const char *Name) -{ - -PVOID BaseAddress; /* Pointer to the base address of -the shared memory object */ -ULONG AttributeFlags;/* Flags describing characteristics -of the shared memory object */ -APIRET rc; /* Return code */ - -/* Request read and write access to */ -/* the shared memory object */ -AttributeFlags = PAG_WRITE | PAG_READ; - -rc = DosGetNamedSharedMem(BaseAddress, Name, AttributeFlags); - -if (rc != 0) { - printf(DosGetNamedSharedMem error: return code = %ld, rc); - return 0; -} - -return BaseAddress; +mm_free(scoreboard_shm, ap_scoreboard_image); +ap_scoreboard_image = NULL; +ap_shm_destroy(scoreboard_shm); } static void setup_shared_mem(ap_context_t *p) { -caddr_t m; - -int rc; - -m = (caddr_t) create_shared_heap(\\SHAREMEM\\SCOREBOARD, SCOREBOARD_SIZE); -if (m == 0) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - %s: Could not create OS/2 Shared memory pool., - ap_server_argv0); - exit(APEXIT_INIT); -} - -rc = _uopen((Heap_t) m); -if (rc != 0) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - %s: Could not uopen() newly created OS/2 Shared memory pool., - ap_server_argv0); -} -ap_scoreboard_image = (scoreboard *) m; -ap_scoreboard_image-global.running_generation = 0; -} - -static void reopen_scoreboard(ap_context_t *p) -{ -caddr_t m; -int rc; - -m = (caddr_t) get_shared_heap(\\SHAREMEM\\SCOREBOARD); -if (m == 0) { - ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, - %s: Could not find existing OS/2 Shared memory pool., - ap_server_argv0); - exit(APEXIT_INIT); -} -
cvs commit: apache-2.0/src/modules/mpm/prefork prefork.c
sascha 99/12/29 15:57:57 Modified:src/modules/mpm/prefork prefork.c Log: Fall back to save values for SHM_R and SHM_W, if the system does not define them. Revision ChangesPath 1.61 +13 -0 apache-2.0/src/modules/mpm/prefork/prefork.c Index: prefork.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/prefork/prefork.c,v retrieving revision 1.60 retrieving revision 1.61 diff -u -u -r1.60 -r1.61 --- prefork.c 1999/12/15 21:39:08 1.60 +++ prefork.c 1999/12/29 23:57:53 1.61 @@ -105,7 +105,20 @@ #include sys/types.h #include sys/ipc.h #include sys/shm.h + +/* some systems do not define SHM_[RW]; values are from Unix98 */ + +#ifndef SHM_R +#define SHM_R 0x400 #endif + +#ifndef SHM_W +#define SHM_W 0x200 +#endif + +#endif + + #ifdef HAVE_BSTRING_H #include bstring.h /* for IRIX, FD_SET calls bzero() */
cvs commit: apache-2.0/src/modules/mpm/prefork prefork.c scoreboard.h
rbb 99/12/15 13:39:11 Modified:src/modules/mpm/prefork prefork.c scoreboard.h Log: Getting rid of more warnings in the prefork mpm. Revision ChangesPath 1.60 +1 -6 apache-2.0/src/modules/mpm/prefork/prefork.c Index: prefork.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/prefork/prefork.c,v retrieving revision 1.59 retrieving revision 1.60 diff -u -r1.59 -r1.60 --- prefork.c 1999/12/14 20:02:50 1.59 +++ prefork.c 1999/12/15 21:39:08 1.60 @@ -90,6 +90,7 @@ #include apr_portable.h #include httpd.h #include mpm_default.h +#include mpm_status.h #include http_main.h #include http_log.h #include http_config.h @@ -1935,12 +1936,6 @@ static ap_socket_t *csd; static int requests_this_child; static fd_set main_fds; - -API_EXPORT(void) ap_child_terminate(request_rec *r) -{ -r-connection-keepalive = 0; -requests_this_child = ap_max_requests_per_child = 1; -} int ap_graceful_stop_signalled(void) { 1.4 +3 -0 apache-2.0/src/modules/mpm/prefork/scoreboard.h Index: scoreboard.h === RCS file: /home/cvs/apache-2.0/src/modules/mpm/prefork/scoreboard.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- scoreboard.h 1999/11/30 03:52:47 1.3 +++ scoreboard.h 1999/12/15 21:39:09 1.4 @@ -203,6 +203,9 @@ #define START_PREQUEST 1 #define STOP_PREQUEST 2 +int ap_update_child_status(int child_num, int status, request_rec *r); +void ap_time_process_request(int child_num, int status); + #ifdef __cplusplus } #endif
cvs commit: apache-2.0/src/modules/mpm/prefork prefork.c
rbb 99/12/14 12:02:52 Modified:src/modules/mpm/prefork prefork.c Log: Make prefork compile. Revision ChangesPath 1.59 +5 -1 apache-2.0/src/modules/mpm/prefork/prefork.c Index: prefork.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/prefork/prefork.c,v retrieving revision 1.58 retrieving revision 1.59 diff -u -r1.58 -r1.59 --- prefork.c 1999/12/03 22:11:31 1.58 +++ prefork.c 1999/12/14 20:02:50 1.59 @@ -1954,7 +1954,11 @@ static void child_main(int child_num_arg) { -NET_SIZE_T clen; +/* XXX replace int with NET_SIZE_T, this is defined in ap_config.h which + has macros we can't make visible to this file, but it is the original + type for clen. +*/ +int clen; struct sockaddr sa_server; struct sockaddr sa_client; ap_listen_rec *lr;
cvs commit: apache-2.0/src/modules/mpm/prefork prefork.c
manoj 99/12/03 14:11:34 Modified:src/modules/mpm/dexter dexter.c src/modules/mpm/mpmt_pthread mpmt_pthread.c src/modules/mpm/prefork prefork.c Log: The Unix MPMs were depending on APR for signal.h, and broke. Add an explicit #include for it back in. Revision ChangesPath 1.61 +1 -0 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -u -r1.60 -r1.61 --- dexter.c 1999/12/01 00:44:53 1.60 +++ dexter.c 1999/12/03 22:11:18 1.61 @@ -75,6 +75,7 @@ #include poll.h #include netinet/tcp.h #include pthread.h +#include signal.h /* * Actual definitions of config globals 1.51 +1 -0 apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c Index: mpmt_pthread.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -u -r1.50 -r1.51 --- mpmt_pthread.c1999/12/01 00:44:56 1.50 +++ mpmt_pthread.c1999/12/03 22:11:22 1.51 @@ -72,6 +72,7 @@ #include netinet/tcp.h #include pthread.h +#include signal.h /* * Actual definitions of config globals 1.58 +1 -0 apache-2.0/src/modules/mpm/prefork/prefork.c Index: prefork.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/prefork/prefork.c,v retrieving revision 1.57 retrieving revision 1.58 diff -u -d -u -r1.57 -r1.58 --- prefork.c 1999/12/01 00:45:00 1.57 +++ prefork.c 1999/12/03 22:11:31 1.58 @@ -109,6 +109,7 @@ #ifdef HAVE_BSTRING_H #include bstring.h /* for IRIX, FD_SET calls bzero() */ #endif +#include signal.h /* config globals */
cvs commit: apache-2.0/src/modules/mpm/prefork prefork.c
ben 99/11/09 01:33:56 Modified:src/modules/mpm/prefork prefork.c Log: Fix error logging calls (kinda). Revision ChangesPath 1.50 +11 -9 apache-2.0/src/modules/mpm/prefork/prefork.c Index: prefork.c === RCS file: /export/home/cvs/apache-2.0/src/modules/mpm/prefork/prefork.c,v retrieving revision 1.49 retrieving revision 1.50 diff -u -r1.49 -r1.50 --- prefork.c 1999/10/24 13:08:29 1.49 +++ prefork.c 1999/11/09 09:33:52 1.50 @@ -202,7 +202,7 @@ } dir = ap_server_root_relative(pconf, buf[0] ? buf : dir); if(mkdir(dir, 0755) 0 errno != EEXIST) { - ap_log_error(APLOG_MARK, APLOG_ERR, server_conf, + ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf, gprof: error creating directory %s, dir); } } @@ -603,10 +603,11 @@ static void accept_mutex_child_init(ap_context_t *p) { ap_file_t *tempfile; +ap_status_t ret; -ap_open(tempfile, ap_lock_fname, APR_WRITE, APR_UREAD|APR_UWRITE, p); -if (!tempfile) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, +ret=ap_open(tempfile, ap_lock_fname, APR_WRITE, APR_UREAD|APR_UWRITE, p); +if (ret != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_EMERG, ret, server_conf, Child cannot open lock file: %s, ap_lock_fname); clean_child_exit(APEXIT_CHILDINIT); } @@ -620,13 +621,14 @@ static void accept_mutex_init(ap_context_t *p) { ap_file_t *tempfile; +ap_status_t ret; expand_lock_fname(p); unlink(ap_lock_fname); -ap_open(tempfile, ap_lock_fname, APR_CREATE|APR_WRITE|APR_EXCL, +ret=ap_open(tempfile, ap_lock_fname, APR_CREATE|APR_WRITE|APR_EXCL, APR_UREAD|APR_UWRITE, p); -if (!tempfile) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, +if (ret != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_EMERG, ret, server_conf, Parent cannot open lock file: %s, ap_lock_fname); exit(APEXIT_INIT); } @@ -642,7 +644,7 @@ continue; if (ret 0) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, + ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf, flock: LOCK_EX: Error getting accept lock. Exiting!); clean_child_exit(APEXIT_CHILDFATAL); } @@ -651,7 +653,7 @@ static void accept_mutex_off(void) { if (flock(lock_fd, LOCK_UN) 0) { - ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, + ap_log_error(APLOG_MARK, APLOG_EMERG, errno, server_conf, flock: LOCK_UN: Error freeing accept lock. Exiting!); clean_child_exit(APEXIT_CHILDFATAL); }
cvs commit: apache-2.0/src/modules/mpm/prefork prefork.c
bhyde 99/10/13 13:36:35 Modified:src/modules/mpm/prefork prefork.c Log: Redundent and out of synch global. Revision ChangesPath 1.44 +0 -1 apache-2.0/src/modules/mpm/prefork/prefork.c Index: prefork.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/prefork/prefork.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- prefork.c 1999/10/13 18:16:45 1.43 +++ prefork.c 1999/10/13 20:36:32 1.44 @@ -116,7 +116,6 @@ static char *ap_pid_fname=NULL; static char *ap_scoreboard_fname=NULL; static char *ap_lock_fname; -static char *ap_server_argv0=NULL; static int ap_daemons_to_start=0; static int ap_daemons_min_free=0; static int ap_daemons_max_free=0;
cvs commit: apache-2.0/src/modules/mpm/prefork prefork.c
ben 99/09/11 03:26:00 Modified:src/modules/mpm/prefork prefork.c Log: Make prefork compile on FreeBSD. Revision ChangesPath 1.34 +13 -5 apache-2.0/src/modules/mpm/prefork/prefork.c Index: prefork.c === RCS file: /export/home/cvs/apache-2.0/src/modules/mpm/prefork/prefork.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- prefork.c 1999/09/08 14:15:49 1.33 +++ prefork.c 1999/09/11 10:25:59 1.34 @@ -590,9 +590,11 @@ static int lock_fd = -1; -static void accept_mutex_cleanup(void *foo) +static ap_status_t accept_mutex_cleanup(void *foo) { unlink(ap_lock_fname); + +return APR_SUCCESS; } /* @@ -601,13 +603,15 @@ */ static void accept_mutex_child_init(ap_context_t *p) { +ap_file_t *tempfile; -lock_fd = ap_popenf(p, ap_lock_fname, O_WRONLY, 0600); -if (lock_fd == -1) { +ap_open(p, ap_lock_fname, APR_WRITE, APR_UREAD|APR_UWRITE, tempfile); +if (!tempfile) { ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, Child cannot open lock file: %s, ap_lock_fname); clean_child_exit(APEXIT_CHILDINIT); } +ap_get_os_file(tempfile, lock_fd); } /* @@ -616,14 +620,18 @@ */ static void accept_mutex_init(ap_context_t *p) { +ap_file_t *tempfile; + expand_lock_fname(p); unlink(ap_lock_fname); -lock_fd = ap_popenf(p, ap_lock_fname, O_CREAT | O_WRONLY | O_EXCL, 0600); -if (lock_fd == -1) { +ap_open(p, ap_lock_fname, APR_CREATE|APR_WRITE|APR_EXCL, + APR_UREAD|APR_UWRITE, tempfile); +if (!tempfile) { ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf, Parent cannot open lock file: %s, ap_lock_fname); exit(APEXIT_INIT); } +ap_get_os_file(tempfile, lock_fd); ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup); }