cvs commit: apache-2.0/src/modules/mpm/dexter acceptlock.c dexter.c scoreboard.c

1999-10-20 Thread manoj
manoj   99/10/20 12:07:51

  Modified:src/modules/mpm/dexter acceptlock.c dexter.c scoreboard.c
  Log:
  Fix dexter after adding a status code to ap_log_error broke it.
  
  Revision  ChangesPath
  1.14  +19 -14apache-2.0/src/modules/mpm/dexter/acceptlock.c
  
  Index: acceptlock.c
  ===
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/acceptlock.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -d -u -r1.13 -r1.14
  --- acceptlock.c  1999/10/14 14:36:39 1.13
  +++ acceptlock.c  1999/10/20 19:07:48 1.14
  @@ -123,7 +123,7 @@
   void intra_mutex_on(int locknum)
   {
   if ((errno = pthread_mutex_lock(&intra_mutex[locknum])) != 0) {
  -ap_log_error(APLOG_MARK, APLOG_EMERG, 
  +ap_log_error(APLOG_MARK, APLOG_EMERG, errno,  
 (const server_rec *) ap_get_server_conf(),
 "Error getting intraprocess lock. Exiting!");
   }
  @@ -132,7 +132,7 @@
   void intra_mutex_off(int locknum)
   {
   if (pthread_mutex_unlock(&intra_mutex[locknum]) != 0) {
  -ap_log_error(APLOG_MARK, APLOG_EMERG, 
  +ap_log_error(APLOG_MARK, APLOG_EMERG, errno,  
 (const server_rec *) ap_get_server_conf(),
 "Error releasing intraprocess lock. Exiting!");
   }
  @@ -531,7 +531,8 @@
   }
   
   if (ret < 0) {
  - ap_log_error(APLOG_MARK, APLOG_EMERG, (const server_rec*) 
ap_get_server_conf(),
  + ap_log_error(APLOG_MARK, APLOG_EMERG, errno,
  +(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 "
"your lock file on a local disk!");
  @@ -548,10 +549,11 @@
/* nop */
   }
   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 "
  - "your lock file on a local disk!");
  + ap_log_error(APLOG_MARK, APLOG_EMERG, errno,
  + (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 "
  +  "your lock file on a local disk!");
ap_clean_child_exit(APEXIT_CHILDFATAL);
   }
   }
  @@ -587,7 +589,7 @@
   ap_open(&tempfile, lock_fname, APR_WRITE, APR_UREAD | APR_UWRITE, p);
   ap_get_os_file(&lock_fd[i], tempfile);
   if (lock_fd[i] == -1) {
  -   ap_log_error(APLOG_MARK, APLOG_EMERG, 
  +   ap_log_error(APLOG_MARK, APLOG_EMERG, errno,
   (const server_rec *)ap_get_server_conf(),
   "Child cannot open lock file: %s", lock_fname);
  ap_clean_child_exit(APEXIT_CHILDINIT);
  @@ -614,7 +616,7 @@
   ap_open(&tempfile, lock_fname, APR_CREATE | APR_WRITE | APR_EXCL, 
APR_UREAD | APR_UWRITE, p);
   ap_get_os_file(&lock_fd[i], tempfile);
   if (lock_fd[i] == -1) {
  - ap_log_error(APLOG_MARK, APLOG_EMERG, 
  + ap_log_error(APLOG_MARK, APLOG_EMERG, errno,
 (const server_rec *) ap_get_server_conf(), 
 "Parent cannot open lock file: %s", lock_fname);
   exit(APEXIT_INIT);
  @@ -631,7 +633,7 @@
   continue;
   
   if (ret < 0) {
  -ap_log_error(APLOG_MARK, APLOG_EMERG, 
  +ap_log_error(APLOG_MARK, APLOG_EMERG, errno,
 (const server_rec *) ap_get_server_conf(),
 "flock: LOCK_EX: Error getting accept lock. Exiting!");
ap_clean_child_exit(APEXIT_CHILDFATAL);
  @@ -641,7 +643,7 @@
   void accept_mutex_off(int locknum)
   {
   if (flock(lock_fd[locknum], LOCK_UN) < 0) {
  -ap_log_error(APLOG_MARK, APLOG_EMERG, 
  +ap_log_error(APLOG_MARK, APLOG_EMERG, errno,
 (const server_rec *) ap_get_server_conf(),
 "flock: LOCK_UN: Error freeing accept lock. Exiting!");
ap_clean_child_exit(APEXIT_CHILDFATAL);
  @@ -675,7 +677,8 @@
   int rc = DosOpenMutexSem(NULL, &lock_sem[locknum]);
   
if (rc != 0) {
  - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, 
ap_get_server_conf(),
  + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, errno,
  + ap_get_server_conf(),
 "Child cannot open lock semaphore, rc=%d", rc);
ap_clean_child_exit(APEXIT_CHILDINIT);
}
  @@ -711,7 +714,8 @@
   int rc = DosRequestMutexSem(lock_sem[locknum], SEM_INDEFINITE_WAIT);
   
   if (rc != 0) {
  - ap_log_error(APLOG_MARK,

cvs commit: apache-2.0/src/modules/mpm/dexter acceptlock.c dexter.c

1999-09-08 Thread manoj
manoj   99/09/08 11:58:50

  Modified:src/modules/mpm/dexter acceptlock.c dexter.c
  Log:
  Update dexter to work with the latest APR changes
  
  Revision  ChangesPath
  1.6   +4 -2  apache-2.0/src/modules/mpm/dexter/acceptlock.c
  
  Index: acceptlock.c
  ===
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/acceptlock.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -d -u -r1.5 -r1.6
  --- acceptlock.c  1999/08/31 21:34:05 1.5
  +++ acceptlock.c  1999/09/08 18:58:46 1.6
  @@ -488,6 +488,7 @@
   {
   int i;
   char * lock_fname;
  +ap_file_t *tempfile;
   
   lock_count = number_of_locks;
   lock_fd = (int *)ap_palloc(p, lock_count * sizeof(int *));
  @@ -505,8 +506,9 @@
   init_lock_fname(p);
   for (i = 0; i < lock_count; i++) {
   lock_fname = expand_lock_fname(p, i);
  - lock_fd[i] = ap_popenf(p, lock_fname, 
  -O_CREAT | O_WRONLY | O_EXCL, 0644);
  +ap_open(p, lock_fname, APR_CREATE | APR_WRITE | APR_EXCL,
  +APR_UREAD | APR_UWRITE | APR_GREAD | APR_WREAD, &tempfile);
  +ap_get_os_file(tempfile, &lock_fd[i]);
if (lock_fd[i] == -1) {
perror("open");
fprintf(stderr, "Cannot open lock file: %s\n", lock_fname);
  
  
  
  1.36  +20 -10apache-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.35
  retrieving revision 1.36
  diff -u -d -u -r1.35 -r1.36
  --- dexter.c  1999/08/31 21:34:05 1.35
  +++ dexter.c  1999/09/08 18:58:46 1.36
  @@ -57,6 +57,7 @@

   #define CORE_PRIVATE 

  +#include "apr_portable.h"
   #include "httpd.h" 
   #include "http_main.h" 
   #include "http_log.h" 
  @@ -845,16 +846,16 @@
   static void *worker_thread(void *arg)
   {
   struct sockaddr sa_client;
  -int csd = -1;
  +ap_socket_t *csd = NULL;
   ap_context_t *tpool; /* Pool for this thread   */
   ap_context_t *ptrans;/* Pool for per-transaction stuff */
  -int sd = -1;
  +ap_socket_t *sd = NULL;
   int srv;
   int curr_pollfd, last_pollfd = 0;
  -NET_SIZE_T len = sizeof(struct sockaddr);
   int thread_just_started = 1;
   int thread_num = *((int *) arg);
   long conn_id = child_num * HARD_THREAD_LIMIT + thread_num;
  +int native_socket;
   
   pthread_mutex_lock(&thread_pool_create_mutex);
   ap_create_context(thread_pool_parent, NULL, &tpool);
  @@ -908,7 +909,7 @@
   }
   
   if (num_listenfds == 1) {
  -sd = ap_listeners->fd;
  +sd = ap_listeners->sd;
   goto got_fd;
   }
   else {
  @@ -922,7 +923,7 @@
   /* XXX: Should we check for POLLERR? */
   if (listenfds[curr_pollfd].revents & POLLIN) {
   last_pollfd = curr_pollfd;
  -sd = listenfds[curr_pollfd].fd;
  +ap_put_os_sock(tpool, &sd, 
&listenfds[curr_pollfd].fd);
   goto got_fd;
   }
   } while (curr_pollfd != last_pollfd);
  @@ -930,7 +931,7 @@
   }
   got_fd:
   if (!workers_may_exit) {
  -csd = ap_accept(sd, &sa_client, &len);
  +ap_accept(sd, &csd);
   SAFE_ACCEPT(accept_mutex_off(0));
   SAFE_ACCEPT(intra_mutex_off(0));
pthread_mutex_lock(&idle_thread_count_mutex);
  @@ -951,7 +952,8 @@
   pthread_mutex_unlock(&idle_thread_count_mutex);
break;
}
  -process_socket(ptrans, &sa_client, csd, conn_id);
  +ap_get_os_sock(csd, &native_socket);
  +process_socket(ptrans, &sa_client, native_socket, conn_id);
   ap_clear_pool(ptrans);
   requests_this_child--;
   }
  @@ -1009,7 +1011,7 @@
   listenfds[0].events = POLLIN;
   listenfds[0].revents = 0;
   for (lr = ap_listeners, i = 1; i <= num_listenfds; lr = lr->next, ++i) {
  -listenfds[i].fd = lr->fd;
  +ap_get_os_sock(lr->sd, &listenfds[i].fd);
   listenfds[i].events = POLLIN; /* should we add POLLPRI ?*/
   listenfds[i].revents = 0;
   }
  @@ -1261,6 +1263,14 @@
   }
   }
   
  +static ap_status_t cleanup_fd(void *fdptr)
  +{
  +if (close(*((int *) fdptr)) < 0) {
  +return APR_EBADF;
  +}
  +return APR_SUCCESS;
  +}
  +
   int ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec *s)
   {
   int remaining_children_to_start;
  @@ -1274,8 +1284,8 @@
"pipe: (pipe_of_death)");
   exit(1);
   }
  -ap_note_cleanups_for_fd(pconf, pipe_of_death[0]);
  -   

cvs commit: apache-2.0/src/modules/mpm/dexter acceptlock.c dexter.c

1999-08-31 Thread manoj
manoj   99/08/31 14:34:07

  Modified:src/modules/mpm/dexter acceptlock.c dexter.c
  Log:
  Fix dexter to work after Ryan's context patches.
  
  Revision  ChangesPath
  1.5   +2 -1  apache-2.0/src/modules/mpm/dexter/acceptlock.c
  
  Index: acceptlock.c
  ===
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/acceptlock.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -d -u -r1.4 -r1.5
  --- acceptlock.c  1999/08/31 05:33:19 1.4
  +++ acceptlock.c  1999/08/31 21:34:05 1.5
  @@ -95,13 +95,14 @@
   /* Intraprocess locking used by other serialization techniques */
   static pthread_mutex_t *intra_mutex = NULL;
   
  -static void intra_mutex_cleanup(void *foo)
  +static ap_status_t intra_mutex_cleanup(void *foo)
   {
   int i;
   
   for (i = 0; i < intra_lock_count; i++) {
   (void) pthread_mutex_destroy(&intra_mutex[i]);
   }
  +return APR_SUCCESS;
   }
   
   void intra_mutex_init(ap_context_t *p, int number_of_locks)
  
  
  
  1.35  +4 -4  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.34
  retrieving revision 1.35
  diff -u -d -u -r1.34 -r1.35
  --- dexter.c  1999/08/31 05:33:21 1.34
  +++ dexter.c  1999/08/31 21:34:05 1.35
  @@ -857,9 +857,9 @@
   long conn_id = child_num * HARD_THREAD_LIMIT + thread_num;
   
   pthread_mutex_lock(&thread_pool_create_mutex);
  -tpool = ap_make_sub_pool(thread_pool_parent);
  +ap_create_context(thread_pool_parent, NULL, &tpool);
   pthread_mutex_unlock(&thread_pool_create_mutex);
  -ptrans = ap_make_sub_pool(tpool);
  +ap_create_context(tpool, NULL, &ptrans);
   
   while (!workers_may_exit) {
   workers_may_exit |= (max_requests_per_child != 0) && 
(requests_this_child <= 0);
  @@ -979,7 +979,7 @@
   
   my_pid = getpid();
   child_num = child_num_arg;
  -pchild = ap_make_sub_pool(pconf);
  +ap_create_context(pconf, NULL, &pchild);
   
   /*stuff to do before we switch id's, so we have permissions.*/
   
  @@ -1024,7 +1024,7 @@
   for (i = 0; i < max_threads; i++) {
   worker_thread_free_ids[i] = i;
   }
  -thread_pool_parent = ap_make_sub_pool(pchild);
  +ap_create_context(pchild, NULL, &thread_pool_parent);
   pthread_mutex_init(&thread_pool_create_mutex, NULL);
   pthread_mutex_init(&idle_thread_count_mutex, NULL);
   pthread_mutex_init(&worker_thread_count_mutex, NULL);
  
  
  


cvs commit: apache-2.0/src/modules/mpm/dexter acceptlock.c dexter.c

1999-08-28 Thread rse
rse 99/08/28 06:00:56

  Modified:src/modules/mpm/dexter acceptlock.c dexter.c
  Log:
  get rid of two additional warnings
  
  Revision  ChangesPath
  1.3   +2 -0  apache-2.0/src/modules/mpm/dexter/acceptlock.c
  
  Index: acceptlock.c
  ===
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/acceptlock.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- acceptlock.c  1999/08/28 12:37:58 1.2
  +++ acceptlock.c  1999/08/28 13:00:55 1.3
  @@ -82,7 +82,9 @@
   
   /* TODO: all these calls have to be ap_ prefixed, right? */
   /* Number of cross-process locks we're managing */
  +#ifndef NO_SERIALIZED_ACCEPT
   static int lock_count;
  +#endif
   
   /* Filename prefix for locks */
   char *ap_lock_fname;
  
  
  
  1.33  +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.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- dexter.c  1999/08/28 12:37:58 1.32
  +++ dexter.c  1999/08/28 13:00:55 1.33
  @@ -69,6 +69,7 @@
   #include "ap_listen.h"
   #include "acceptlock.h"
   #include "mpm_default.h"
  +#include "dexter.h"
   
   #include 
   #include  
  
  
  


cvs commit: apache-2.0/src/modules/mpm/dexter acceptlock.c dexter.c dexter.h

1999-08-28 Thread rse
rse 99/08/28 05:38:00

  Modified:src/modules/mpm/dexter acceptlock.c dexter.c dexter.h
  Log:
  clean_child_exit() is really used globally inside dexter MPM,
  so rename it to ap_clean_child_exit().
  
  Revision  ChangesPath
  1.2   +19 -19apache-2.0/src/modules/mpm/dexter/acceptlock.c
  
  Index: acceptlock.c
  ===
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/acceptlock.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- acceptlock.c  1999/07/21 19:07:05 1.1
  +++ acceptlock.c  1999/08/28 12:37:58 1.2
  @@ -67,7 +67,7 @@
   #include "util_script.h" /* to force util_script.c linking */ 
   #include "util_uri.h" 
   #include "acceptlock.h"
  -#include "dexter.h"  /* For clean_child_exit */
  +#include "dexter.h"  /* For ap_clean_child_exit */
   #include "unixd.h"
   #include  
   #include  
  @@ -111,7 +111,7 @@
   for (i = 0; i < intra_lock_count; i++) {
   if (pthread_mutex_init(&intra_mutex[i], NULL) != 0) {
   perror("intra_mutex_init");
  - clean_child_exit(APEXIT_CHILDFATAL);
  + ap_clean_child_exit(APEXIT_CHILDFATAL);
   }
   }
   ap_register_cleanup(p, NULL, intra_mutex_cleanup, ap_null_cleanup);
  @@ -201,10 +201,10 @@
break;
   case 0:
fprintf(stderr, "didn't get lock\n");
  - clean_child_exit(APEXIT_CHILDFATAL);
  + ap_clean_child_exit(APEXIT_CHILDFATAL);
   case -1:
perror("ussetlock");
  - clean_child_exit(APEXIT_CHILDFATAL);
  + ap_clean_child_exit(APEXIT_CHILDFATAL);
   }
   }
   
  @@ -212,7 +212,7 @@
   {
   if (usunsetlock(uslock[locknum]) == -1) {
perror("usunsetlock");
  - clean_child_exit(APEXIT_CHILDFATAL);
  + ap_clean_child_exit(APEXIT_CHILDFATAL);
   }
   }
   
  @@ -327,13 +327,13 @@
   if (pthread_sigmask(SIG_BLOCK, &accept_block_mask,
   &accept_previous_mask[locknum])) {
perror("pthread_sigmask(SIG_BLOCK)");
  - clean_child_exit(APEXIT_CHILDFATAL);
  + ap_clean_child_exit(APEXIT_CHILDFATAL);
   }
   #endif
   if ((err = pthread_mutex_lock(&accept_mutex[locknum]))) {
errno = err;
perror("pthread_mutex_lock");
  - clean_child_exit(APEXIT_CHILDFATAL);
  + ap_clean_child_exit(APEXIT_CHILDFATAL);
   }
   have_accept_mutex[locknum] = 1;
   }
  @@ -345,7 +345,7 @@
   if ((err = pthread_mutex_unlock(&accept_mutex[locknum]))) {
errno = err;
perror("pthread_mutex_unlock");
  - clean_child_exit(APEXIT_CHILDFATAL);
  + ap_clean_child_exit(APEXIT_CHILDFATAL);
   }
   /* There is a slight race condition right here... if we were to die right
* now, we'd do another pthread_mutex_unlock.  Now, doing that would let
  @@ -364,7 +364,7 @@
   #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);
  + ap_clean_child_exit(1);
   }
   #endif
   }
  @@ -459,7 +459,7 @@
   {
   if (semop(sem_id[locknum], &op_on, 1) < 0) {
perror("accept_mutex_on");
  - clean_child_exit(APEXIT_CHILDFATAL);
  + ap_clean_child_exit(APEXIT_CHILDFATAL);
   }
   }
   
  @@ -467,7 +467,7 @@
   {
   if (semop(sem_id[locknum], &op_off, 1) < 0) {
perror("accept_mutex_off");
  - clean_child_exit(APEXIT_CHILDFATAL);
  + ap_clean_child_exit(APEXIT_CHILDFATAL);
   }
   }
   
  @@ -527,7 +527,7 @@
"fcntl: F_SETLKW: Error getting accept lock, exiting!  "
"Perhaps you need to use the LockFile directive to place "
"your lock file on a local disk!");
  - clean_child_exit(APEXIT_CHILDFATAL);
  + ap_clean_child_exit(APEXIT_CHILDFATAL);
   }
   }
   
  @@ -544,7 +544,7 @@
"fcntl: F_SETLKW: Error freeing accept lock, exiting!  "
"Perhaps you need to use the LockFile directive to place "
"your lock file on a local disk!");
  - clean_child_exit(APEXIT_CHILDFATAL);
  + ap_clean_child_exit(APEXIT_CHILDFATAL);
   }
   }
   
  @@ -579,7 +579,7 @@
  ap_log_error(APLOG_MARK, APLOG_EMERG, 
   (const server_rec *)ap_get_server_conf(),
   "Child cannot open lock file: %s", lock_fname);
  -   clean_child_exit(APEXIT_CHILDINIT);
  +   ap_clean_child_exit(APEXIT_CHILDINIT);
   }
   }
   }
  @@ -622,7 +622,7 @@
   ap_log_error(APLOG_MARK, APLOG_EMERG, 
 (const server_rec *) ap_get_server_conf(),
 "flock: LOCK_EX: Error getting accept lock. Exiting!");
  - clean_child_exit(APEXIT_CHILDFATAL);
  + ap_clean_child_exit(APEXIT_CHILDFATAL);
   }
   }
   
  @@ -632,7 +632,7 @@