cvs commit: apache-apr/include apr_file_io.h apr_lock.h apr_network_io.h apr_thread_proc.h apr_time.h

1999-05-24 Thread rbb
rbb 99/05/23 19:04:25

  Modified:apr/file_io/beos dir.c fileacc.c filedup.c filestat.c open.c
pipe.c readwrite.c seek.c
   apr/file_io/unix dir.c fileacc.c filedup.c filestat.c open.c
readwrite.c seek.c
   apr/locks/unix crossproc.c intraproc.c locks.c
   apr/network_io/beos poll.c sockets.c sockopt.c
   apr/network_io/unix poll.c sendrecv.c sockets.c sockopt.c
   apr/test ab_apr.c client.c server.c testfile.c testproc.c
testsock.c testthread.c testtime.c
   apr/threadproc/beos proc.c thread.c threadcancel.c
threadpriv.c
   apr/threadproc/unix proc.c signals.c thread.c threadcancel.c
threadpriv.c
   apr/time/unix access.c time.c
   include  apr_file_io.h apr_lock.h apr_network_io.h
apr_thread_proc.h apr_time.h
  Log:
  All functions now have access to context types either directly, or indirectly,
  but not both.  I removed the context parameter for functions that are taking
  an apr type.  Threads don't work, but everything else does.  I'm still
  debugging the thread logic.  I changed all the current platforms, but
  everything except unix needs to be tried and fixed.
  
  Revision  ChangesPath
  1.4   +3 -3  apache-apr/apr/file_io/beos/dir.c
  
  Index: dir.c
  ===
  RCS file: /home/cvs/apache-apr/apr/file_io/beos/dir.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- dir.c 1999/05/17 18:31:27 1.3
  +++ dir.c 1999/05/24 02:03:56 1.4
  @@ -90,7 +90,7 @@
   }
   }
   
  -ap_status_t ap_closedir(ap_context_t *cont, struct dir_t *thedir)
  +ap_status_t ap_closedir(struct dir_t *thedir)
   {
   if (dir_cleanup(thedir) == APR_SUCCESS) {
   ap_kill_cleanup(cont-pool, thedir, dir_cleanup);
  @@ -101,7 +101,7 @@
   }
   } 
   
  -ap_status_t ap_readdir(ap_context_t *cont, struct dir_t *thedir)
  +ap_status_t ap_readdir(struct dir_t *thedir)
   {
   thedir-entry = readdir(thedir-dirstruct);
if (thedir-entry == NULL){
  @@ -110,7 +110,7 @@
   return APR_SUCCESS;
   }
   
  -ap_status_t ap_rewinddir(ap_context_t *cont, struct dir_t *thedir)
  +ap_status_t ap_rewinddir(struct dir_t *thedir)
   {
   rewinddir(thedir-dirstruct);
   return APR_SUCCESS;
  
  
  
  1.4   +1 -1  apache-apr/apr/file_io/beos/fileacc.c
  
  Index: fileacc.c
  ===
  RCS file: /home/cvs/apache-apr/apr/file_io/beos/fileacc.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- fileacc.c 1999/05/17 18:31:29 1.3
  +++ fileacc.c 1999/05/24 02:03:56 1.4
  @@ -61,7 +61,7 @@
   
   /* A file to put ALL of the accessor functions for struct file_t types. */
   
  -char * ap_get_filename(ap_context_t *cont, struct file_t *thefile)
  +char * ap_get_filename(struct file_t *thefile)
   {
   if (thefile != NULL) {
   return thefile-fname;
  
  
  
  1.4   +1 -1  apache-apr/apr/file_io/beos/filedup.c
  
  Index: filedup.c
  ===
  RCS file: /home/cvs/apache-apr/apr/file_io/beos/filedup.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- filedup.c 1999/05/17 18:31:30 1.3
  +++ filedup.c 1999/05/24 02:03:56 1.4
  @@ -58,7 +58,7 @@
   #include apr_file_io.h
   #include apr_general.h
   
  -struct file_t *ap_dupfile(ap_context_t *cont, struct file_t *old_file)
  +struct file_t *ap_dupfile(struct file_t *old_file)
   {
   struct file_t * new_file = (struct file_t 
*)ap_palloc(cont-pool,sizeof(struct file_t));
   
  
  
  
  1.4   +2 -2  apache-apr/apr/file_io/beos/filestat.c
  
  Index: filestat.c
  ===
  RCS file: /home/cvs/apache-apr/apr/file_io/beos/filestat.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- filestat.c1999/05/17 18:31:31 1.3
  +++ filestat.c1999/05/24 02:03:56 1.4
  @@ -58,7 +58,7 @@
   #include apr_file_io.h
   #include apr_errno.h
   
  -ap_status_t ap_getfileinfo(ap_context_t *cont, char * fname, struct file_t 
*thefile)
  +ap_status_t ap_getfileinfo(struct file_t *thefile)
   {
   struct stat info;
   int rv = stat(fname, info);
  @@ -79,7 +79,7 @@
   }
   }
   
  -ap_status_t ap_updatefileinfo(ap_context_t *cont, struct file_t *thefile)
  +ap_status_t ap_updatefileinfo(struct file_t *thefile)
   {
   struct stat info;
   int rv = fstat(thefile-filedes, info);
  
  
  
  1.5   +1 -1  apache-apr/apr/file_io/beos/open.c
  
  Index: open.c
  ===
  RCS file: 

cvs commit: apache-apr/pthreads/src/main http_accept.c http_main.c

1999-05-24 Thread manoj
manoj   99/05/23 19:10:28

  Modified:pthreads/src/include http_main.h
   pthreads/src/main http_accept.c http_main.c
  Log:
  Switch to using a pipe to notify children of graceful shutodwn instead
  of a signal. This also naturally solves a problem with graceful shutdown
  of children blocked on the accept mutex.
  
  Revision  ChangesPath
  1.6   +3 -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.5
  retrieving revision 1.6
  diff -u -u -r1.5 -r1.6
  --- http_main.h   1999/04/09 04:10:35 1.5
  +++ http_main.h   1999/05/24 02:10:25 1.6
  @@ -58,6 +58,9 @@
   #ifndef APACHE_HTTP_MAIN_H
   #define APACHE_HTTP_MAIN_H
   
  +/* Pipe used to signal a graceful child shutdown */
  +extern int ap_pipe_of_death[2];
  +
   #ifdef __cplusplus
   extern C {
   #endif
  
  
  
  1.15  +19 -15apache-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.14
  retrieving revision 1.15
  diff -u -u -r1.14 -r1.15
  --- http_accept.c 1999/05/20 05:00:41 1.14
  +++ http_accept.c 1999/05/24 02:10:26 1.15
  @@ -331,7 +331,6 @@
*/
   static listen_rec *head_listener;
   static struct pollfd *listenfds;
  -static int pipe_of_death;
   
   void accept_parent_init(pool *pconf, int listener_count)
   {
  @@ -344,7 +343,6 @@
int worker_threads_per_child)
   {
   int i;
  -int pipe_pair_of_death[2];
   listen_rec *lr;
   
   SAFE_ACCEPT(intra_mutex_init(pchild, 1));
  @@ -353,15 +351,7 @@
   head_listener = ap_listeners;
   
   listenfds = ap_palloc(pchild, sizeof(struct pollfd) * (num_listenfds + 
1));
  -
  -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[1];
  -listenfds[0].fd = pipe_pair_of_death[0];
  +listenfds[0].fd = ap_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) {
  @@ -380,7 +370,9 @@
   int csd = -1;
   int sd;
   int srv;
  +int ret;
   listen_rec *lr;
  +char pipe_read_char;
   
   size_t len = sizeof(struct sockaddr);
   
  @@ -400,6 +392,21 @@
   break;
   
   srv = poll(listenfds, num_listenfds + 1, -1);
  +if (listenfds[0].revents  POLLIN) {
  +/* A process has gotten a signal on the shutdown pipe.
  + * Check if we're the lucky process to die. */
  +ret = read(listenfds[0].fd, pipe_read_char, 1);
  +if (ret == -1  errno == EAGAIN) {
  +/* It lost the lottery. It must continue to suffer 
through
  + * a life of servitude */
  +continue;
  +}
  +else {
  +/* It won the lottery (or something else is very wrong).
  + * Embrace death with open arms. */
  +break;
  +}
  +}
   if (workers_may_exit)
   break;
   if (srv  0) {
  @@ -472,6 +479,7 @@
   break;
   }
   }
  +workers_may_exit = 1;
   return -1;
   }
   
  @@ -479,15 +487,11 @@
   {
   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 */
  -(void) write(pipe_of_death, char_of_death, 1);
   
   for (i = 0; i  ss-worker_threads; i++) {
pthread_join(ap_scoreboard_image-servers[index][i].tid, NULL);
  
  
  
  1.81  +26 -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.80
  retrieving revision 1.81
  diff -u -u -r1.80 -r1.81
  --- http_main.c   1999/05/20 04:33:32 1.80
  +++ http_main.c   1999/05/24 02:10:27 1.81
  @@ -216,6 +216,7 @@
   array_header *ap_server_config_defines;
   pool *pchild;/* Pool for httpd child stuff */
   
  +int ap_pipe_of_death[2];
   
   /* thread local storage code that isn't used right now */
   
  @@ -1963,7 +1964,6 @@
   /* XXX - Do the appropriate thing for each signal */
   switch 

cvs commit: apache-apr/apr/network_io/unix poll.c

1999-05-24 Thread rbb
rbb 99/05/23 19:23:43

  Modified:apr/network_io/unix poll.c
  Log:
  Argh!  There is a bug in the linux libc routines.  We have to pass -1 exactly
  into poll if we want to wait indefinitely, instead of any negative number as
  
  Revision  ChangesPath
  1.8   +5 -1  apache-apr/apr/network_io/unix/poll.c
  
  Index: poll.c
  ===
  RCS file: /home/cvs/apache-apr/apr/network_io/unix/poll.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- poll.c1999/05/24 02:04:08 1.7
  +++ poll.c1999/05/24 02:23:43 1.8
  @@ -130,7 +130,11 @@
   pollset[i].events = aprset[i].events;
   }
   
  -rv = poll(pollset, nsds, timeout * 1000);
  +if (timeout != -1) {
  +timeout *= 1000;
  +}
  +
  +rv = poll(pollset, nsds, timeout);
   
   for (i = 0; i  nsds; i++) {
   aprset[i].revents = get_revent(pollset[i].revents);
  
  
  


cvs commit: apache-apr/apr/threadproc/unix thread.c

1999-05-24 Thread rbb
rbb 99/05/23 19:29:28

  Modified:apr/threadproc/unix thread.c
  Log:
  Each new thread must automatically create a new pool for it's use.
  
  Revision  ChangesPath
  1.6   +1 -0  apache-apr/apr/threadproc/unix/thread.c
  
  Index: thread.c
  ===
  RCS file: /home/cvs/apache-apr/apr/threadproc/unix/thread.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- thread.c  1999/05/24 02:04:20 1.5
  +++ thread.c  1999/05/24 02:29:28 1.6
  @@ -103,6 +103,7 @@
   else
   temp = NULL;
   
  +new-cntxt = ap_create_sub_context(cont, NULL);
   if (pthread_create(new-td, temp, func, data) == 0) {
   return new;
   }
  
  
  


cvs commit: apache-apr/pthreads/src/main http_main.c

1999-05-24 Thread manoj
manoj   99/05/23 20:07:03

  Modified:pthreads/src/main http_main.c
  Log:
  Get rid of the last vestiges of SIGWINCH handling in child processes.
  Now, each worker thread knows when it's the last one to exit, and in
  that case, sends SIGTERM to kick the sigwait thread.
  
  Revision  ChangesPath
  1.82  +20 -26apache-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.81
  retrieving revision 1.82
  diff -u -u -r1.81 -r1.82
  --- http_main.c   1999/05/24 02:10:27 1.81
  +++ http_main.c   1999/05/24 03:07:02 1.82
  @@ -288,8 +288,10 @@
   static int my_pid; /* for hybridization, we need this.  Stupid to
 call getpid all the time */
   
  +/* Keep track of the number of worker threads currently active */
  +static int worker_thread_count;
  +static pthread_mutex_t worker_thread_count_mutex;
   
  -
   /*
* Pieces for managing the contents of the Server response header
* field.
  @@ -401,11 +403,6 @@
   exit(code);
   }
   
  -static void graceful_killer(void)
  -{
  -stop_accepting_connections(pconf);
  -}
  -
   int ap_get_timeout(request_rec *r)
   {
   
  @@ -991,11 +988,6 @@
   }
   }
   
  -static void graceful_sig_handler(int sig)
  -{
  -ap_max_requests_per_child = 1;
  -}
  -
   /*
* Connection structures and accounting...
*/
  @@ -1730,7 +1722,6 @@
   #endif
   }
   
  -
   static void * worker_thread(void * dummy)
   {
   proc_info * ti = dummy;
  @@ -1745,6 +1736,10 @@
   
   ptrans = ap_make_sub_pool(tpool);
   
  +pthread_mutex_lock(worker_thread_count_mutex);
  +worker_thread_count++;
  +pthread_mutex_unlock(worker_thread_count_mutex);
  +
   while (1) {
   (void) ap_update_child_status(process_slot, thread_slot, 
SERVER_READY, 
  (request_rec *) NULL);
  @@ -1757,9 +1752,17 @@
   }
   
   ap_destroy_pool(tpool);
  -kill(ap_scoreboard_image-parent[process_slot].pid, SIGWINCH);
   ap_update_child_status(process_slot, thread_slot, SERVER_DEAD,
   (request_rec *) NULL);
  +pthread_mutex_lock(worker_thread_count_mutex);
  +worker_thread_count--;
  +if (worker_thread_count == 0) {
  +/* All the threads have exited, now finish the shutdown process
  + * by signalling the sigwait thread */
  +kill(my_pid, SIGTERM);
  +}
  +pthread_mutex_unlock(worker_thread_count_mutex);
  +
   return NULL;
   }
   
  @@ -1891,7 +1894,7 @@
   sigset_t sig_mask;
   int signal_received;
   pthread_t thread;
  -int i, j;
  +int i;
   int my_child_num = child_num_arg;
   proc_info *my_info = NULL;
   
  @@ -1923,6 +1926,9 @@
   }
   
   /* Setup worker threads */
  +
  +worker_thread_count = 0;
  +pthread_mutex_init(worker_thread_count_mutex, NULL);
   for (i=0; i  ap_threads_per_child; i++) {
   
   my_info = NULL;
  @@ -1957,23 +1963,11 @@
   
   /* This thread will be the one responsible for handling signals */
   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) {
  -case 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;
   case SIGTERM:
   just_die(SIGTERM);
break;
  
  
  


cvs commit: apache-apr STATUS

1999-05-24 Thread manoj
manoj   99/05/23 20:47:39

  Modified:.STATUS
  Log:
  I saw Rob Malda take apart the circuitry in his beer mug last night.
  
  Revision  ChangesPath
  1.24  +1 -19 apache-apr/STATUS
  
  Index: STATUS
  ===
  RCS file: /home/cvs/apache-apr/STATUS,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -u -r1.23 -r1.24
  --- STATUS1999/04/29 19:34:19 1.23
  +++ STATUS1999/05/24 03:47:39 1.24
  @@ -1,5 +1,5 @@
   Apache Portable Runtime STATUS:
  -Last modified at [$Date: 1999/04/29 19:34:19 $]
  +Last modified at [$Date: 1999/05/24 03:47:39 $]
   
   Release:
   
  @@ -42,24 +42,6 @@
   Everything
   
   Needs patch:
  -
  -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. 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 http_main.c

1999-05-24 Thread manoj
manoj   99/05/23 23:29:45

  Modified:pthreads/src/main http_main.c
  Log:
  Minor cleanup
  
  Revision  ChangesPath
  1.83  +2 -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.82
  retrieving revision 1.83
  diff -u -u -r1.82 -r1.83
  --- http_main.c   1999/05/24 03:07:02 1.82
  +++ http_main.c   1999/05/24 06:29:43 1.83
  @@ -1966,17 +1966,14 @@
   sigaddset(sig_mask, SIGTERM);
   sigaddset(sig_mask, SIGINT);
   sigwait(sig_mask, signal_received);
  -/* XXX - Do the appropriate thing for each signal */
   switch (signal_received) {
   case SIGTERM:
  -just_die(SIGTERM);
  - break;
   case SIGINT:
  -just_die(SIGINT);
  +just_die(signal_received);
   break;
   default:
   ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf,
  -received strange signal: %d, signal_received);
  +received strange signal: %d, signal_received);
   
   }
   }
  
  
  


cvs commit: apache-apr/pthreads/src/main http_config.c http_core.c http_main.c

1999-05-24 Thread manoj
manoj   99/05/23 23:53:37

  Modified:pthreads/src/include httpd.h
   pthreads/src/main http_config.c http_core.c http_main.c
  Log:
  Change the algorithm for spare server maintanence to base its decisions
  on the number of idle threads, rather than the number of mostly idle
  processes.
  
  Revision  ChangesPath
  1.15  +0 -8  apache-apr/pthreads/src/include/httpd.h
  
  Index: httpd.h
  ===
  RCS file: /home/cvs/apache-apr/pthreads/src/include/httpd.h,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -u -r1.14 -r1.15
  --- httpd.h   1999/04/14 21:03:19 1.14
  +++ httpd.h   1999/05/24 06:53:32 1.15
  @@ -370,14 +370,6 @@
   #define DEFAULT_THREADS_PER_CHILD 50
   #endif
   
  -#ifndef DEFAULT_IDLE_THRESHOLD
  -#define DEFAULT_IDLE_THRESHOLD (int)(DEFAULT_THREADS_PER_CHILD * 0.05)
  -#endif
  -
  -#ifndef DEFAULT_BUSY_THRESHOLD
  -#define DEFAULT_BUSY_THRESHOLD (DEFAULT_THREADS_PER_CHILD - 
(int)(DEFAULT_THREADS_PER_CHILD * 0.05))
  -#endif
  -
   #ifndef DEFAULT_EXCESS_REQUESTS_PER_CHILD
   #define DEFAULT_EXCESS_REQUESTS_PER_CHILD 0
   #endif
  
  
  
  1.12  +0 -2  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.11
  retrieving revision 1.12
  diff -u -u -r1.11 -r1.12
  --- http_config.c 1999/03/17 17:01:18 1.11
  +++ http_config.c 1999/05/24 06:53:33 1.12
  @@ -1394,8 +1394,6 @@
   ap_lock_fname = DEFAULT_LOCKFILE;
   ap_max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
   ap_threads_per_child = DEFAULT_THREADS_PER_CHILD;
  -ap_idle_thread_threshold = DEFAULT_IDLE_THRESHOLD;
  -ap_busy_thread_threshold = DEFAULT_BUSY_THRESHOLD;
   /* ZZZ  Initialize the Network Address here. */
   ap_bind_address.s_addr = htonl(INADDR_ANY);
   ap_listeners = NULL;
  
  
  
  1.13  +0 -35 apache-apr/pthreads/src/main/http_core.c
  
  Index: http_core.c
  ===
  RCS file: /home/cvs/apache-apr/pthreads/src/main/http_core.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -u -r1.12 -r1.13
  --- http_core.c   1999/04/14 21:03:28 1.12
  +++ http_core.c   1999/05/24 06:53:33 1.13
  @@ -2155,28 +2155,7 @@
  
   return NULL;
   }
  -static const char *set_idle_threshold(cmd_parms *cmd, void *dummy, char *arg)
  -{
  -const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
  -if (err != NULL) {
  -return err;
  -}
   
  -ap_idle_thread_threshold = atoi(arg);
  -return NULL;
  -}
  -
  -static const char *set_busy_threshold(cmd_parms *cmd, void *dummy, char *arg)
  -{
  -const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
  -if (err != NULL) {
  -return err;
  -}
  -
  -ap_busy_thread_threshold = atoi(arg);
  -return NULL;
  -}
  -
   static const char *set_max_free_servers(cmd_parms *cmd, void *dummy, char 
*arg)
   {
   const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
  @@ -2224,8 +2203,6 @@
   }
   
   static const char *set_threads(cmd_parms *cmd, void *dummy, char *arg) {
  -int user_def_idle = ap_idle_thread_threshold;
  -int user_def_busy = ap_busy_thread_threshold;
   const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
   if (err != NULL) {
   return err;
  @@ -2233,14 +2210,6 @@
   
   ap_threads_per_child = atoi(arg);
   
  -ap_idle_thread_threshold = (int)(ap_threads_per_child * 0.05);
  -ap_busy_thread_threshold = ap_threads_per_child - 
(int)(ap_threads_per_child * 0.05);
  -
  -if (user_def_idle != DEFAULT_IDLE_THRESHOLD)
  -ap_idle_thread_threshold = user_def_idle;
  -if (user_def_busy != DEFAULT_BUSY_THRESHOLD)
  -ap_busy_thread_threshold = user_def_busy;
  -
   if (ap_threads_per_child  1) {
fprintf(stderr, WARNING: Require ThreadsPerChild  0, setting to 1\n);
ap_threads_per_child = 1;
  @@ -2838,10 +2807,6 @@
 Maximum number of idle children },
   { MaxServers, set_max_free_servers, NULL, RSRC_CONF, TAKE1,
 Deprecated equivalent to MaxSpareServers },
  -{ IdleThreadThreshold, set_idle_threshold, NULL, RSRC_CONF, TAKE1,
  -  Minimum number of idle threads, below which process is considered ready 
for reaping. },
  -{ BusyThreadThreshold, set_busy_threshold, NULL, RSRC_CONF, TAKE1,
  -  Maximum number of idle threads, above which process is considered busy. 
},
   { ServersSafetyLimit, set_server_limit, NULL, RSRC_CONF, TAKE1,
 Deprecated equivalent to MaxClients },
   { MaxClients, set_server_limit, NULL, RSRC_CONF, TAKE1,
  
  
  
  1.84  +16 -20apache-apr/pthreads/src/main/http_main.c
  
  Index: http_main.c
  

cvs commit: apache-apr/include apr_errno.h apr_file_io.h

1999-05-24 Thread rbb
rbb 99/05/24 10:28:19

  Modified:apr/file_io/unix dir.c fileacc.c filedup.c filestat.c open.c
pipe.c readwrite.c seek.c
   apr/test testfile.c
   include  apr_errno.h apr_file_io.h
  Log:
  All file functions now return a status value, and those status values are
  defined in apr_errno.h in a platform independant way.  The test program for
  file functions has also been updated.
  
  Revision  ChangesPath
  1.10  +43 -35apache-apr/apr/file_io/unix/dir.c
  
  Index: dir.c
  ===
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/dir.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- dir.c 1999/05/24 02:03:59 1.9
  +++ dir.c 1999/05/24 17:28:15 1.10
  @@ -68,11 +68,11 @@
   return APR_SUCCESS;
   }
   else {
  -return APR_FAILURE;
  +return errno;
   }
   } 
   
  -struct dir_t *ap_opendir(ap_context_t *cont, const char *dirname)
  +ap_status_t ap_opendir(ap_context_t *cont, const char *dirname, struct dir_t 
**new)
   {
   struct dir_t *thedir = (struct dir_t *)ap_palloc(cont-pool, 
sizeof(struct dir_t));
   
  @@ -83,28 +83,32 @@
   
   if (thedir-dirstruct == NULL) {
   thedir-dirstruct = NULL;
  -return NULL;
  +*new = thedir;
  +return errno;
   }
   else {
   ap_register_cleanup(thedir-cntxt-pool, (void *)thedir, 
dir_cleanup, NULL);
  -return thedir;
  +*new = thedir;
  +return APR_SUCCESS;
   }
   }
   
   ap_status_t ap_closedir(struct dir_t *thedir)
   {
  -if (dir_cleanup(thedir) == APR_SUCCESS) {
  +ap_status_t rv;
  +
  +if ((rv = dir_cleanup(thedir)) == APR_SUCCESS) {
   ap_kill_cleanup(thedir-cntxt-pool, thedir, dir_cleanup);
   return APR_SUCCESS;
   }
  -return APR_FAILURE;
  +return rv;
   }
   
   ap_status_t ap_readdir(struct dir_t *thedir)
   {
   thedir-entry = readdir(thedir-dirstruct);
   if (thedir-entry == NULL) {
  -return APR_FAILURE;
  +return errno;
   }
   return APR_SUCCESS;
   }
  @@ -122,7 +126,7 @@
   return APR_SUCCESS;
   }
   else {
  -return APR_FAILURE;
  +return errno;
   }
   }
   
  @@ -132,86 +136,90 @@
   return APR_SUCCESS;
   }
   else {
  -return APR_FAILURE;
  +return errno;
   }
   }
   
  -ap_ssize_t ap_dir_entry_size(struct dir_t *thedir)
  +ap_status_t ap_dir_entry_size(struct dir_t *thedir, ap_ssize_t *size)
   {
   struct stat filestat;
   char *fname = NULL;
   
   if (thedir-entry == NULL) {
  -errno = ENOFILE;
  -return -1;
  +*size = -1;
  +return APR_ENOFILE;
   }
   fname = ap_pstrcat(thedir-cntxt-pool, thedir-dirname, /, 
  thedir-entry-d_name, NULL);
   if (stat(fname, filestat) == -1) {
  -errno = ENOSTAT;
  -return -1;
  +*size = -1;
  +return APR_ENOSTAT;
   }
   
  -return filestat.st_size;
  +*size = filestat.st_size;
  +return APR_SUCCESS;
   }
   
  -time_t ap_dir_entry_mtime(struct dir_t *thedir)
  +ap_status_t ap_dir_entry_mtime(struct dir_t *thedir, time_t *time)
   {
   struct stat filestat;
   char *fname = NULL;
   
   if (thedir-entry == NULL) {
  -errno = ENOFILE;
  -return -1;
  +*time = -1;
  +return APR_ENOFILE;
   }
   
   fname = ap_pstrcat(thedir-cntxt-pool, thedir-dirname, /, 
  thedir-entry-d_name, NULL);
   if (stat(fname, filestat) == -1) {
  -errno = ENOSTAT;
  -return -1;
  +*time = -1;
  +return APR_ENOSTAT;
   }
   
  -return filestat.st_mtime;
  +*time = filestat.st_mtime;
  +return APR_SUCCESS;
   }

  -ap_filetype_e ap_dir_entry_ftype(struct dir_t *thedir)
  +ap_status_t ap_dir_entry_ftype(struct dir_t *thedir, ap_filetype_e *type)
   {
   struct stat filestat;
   char *fname = NULL;
   
   if (thedir-entry == NULL) {
  -errno = ENOFILE;
  -return -1;
  +*type = APR_REG;
  +return APR_ENOFILE;
   }
   
   fname = ap_pstrcat(thedir-cntxt-pool, thedir-dirname, /, 
  thedir-entry-d_name, NULL);
   if (stat(fname, filestat) == -1) {
  -errno = ENOSTAT;
  -return -1;
  +*type = APR_REG;
  +return APR_ENOSTAT;
   }
   
   if (S_ISREG(filestat.st_mode))
  -return APR_REG;
  +*type = APR_REG;
   if (S_ISDIR(filestat.st_mode))
  -return APR_DIR;
  +*type = APR_DIR;
   if (S_ISCHR(filestat.st_mode))
  -return APR_CHR;
  +*type = APR_CHR;
   if (S_ISBLK(filestat.st_mode))
  -return APR_BLK;
  +

cvs commit: apache-site bugdb.cgi

1999-05-24 Thread coar
coar99/05/24 10:43:44

  Modified:.bugdb.cgi
  Log:
Maybe this will slow down the 'pending' reports..
  
  Revision  ChangesPath
  1.41  +15 -9 apache-site/bugdb.cgi
  
  Index: bugdb.cgi
  ===
  RCS file: /home/cvs/apache-site/bugdb.cgi,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- bugdb.cgi 1999/01/19 19:37:15 1.40
  +++ bugdb.cgi 1999/05/24 17:43:43 1.41
  @@ -15,14 +15,18 @@
   # Lifetime (in seconds) of displayed info before it expires.
   $life_time = 30 * 60;
   $CCNOTE = EOT;
  -[In order for any reply to be added to the PR database, ]
  -[you need to include [EMAIL PROTECTED] in the Cc line ]
  -[and leave the subject line UNCHANGED.  This is not done]
  -[automatically because of the potential for mail loops. ]
  -[If you do not include this Cc, your reply may be ig-   ]
  -[nored unless you are responding to an explicit request ]
  -[from a developer.  ]
  -[Reply only with text; DO NOT SEND ATTACHMENTS! ]
  +#
  +[In order for any reply to be added to the PR database, you need]
  +[to include [EMAIL PROTECTED] in the Cc line and make sure the]
  +[subject line starts with the report component and number, with ]
  +[or without any 'Re:' prefixes (such as general/1098: or  ]
  +[Re: general/1098:).  If the subject doesn't match this   ]
  +[pattern, your message will be misfiled and ignored.  The   ]
  +[apbugs address is not added to the Cc line of messages from  ]
  +[the database automatically because of the potential for mail   ]
  +[loops.  If you do not include this Cc, your reply may be ig-   ]
  +[nored unless you are responding to an explicit request from a  ]
  +[developer.  Reply only with text; DO NOT SEND ATTACHMENTS! ]
   EOT
   
   #
  @@ -145,6 +149,8 @@
   #should go.
   #  01/19/1999 Ken Coar - IE5 doesn't like http:/no-server-name/path
   #URLs, so remove the scheme from server-local URLs we emit.
  +#  05/24/1999 Ken Coar - Try making the 'how to reply' message a little
  +#more explicit; we're getting lots of misfiled messages..
   #
   ### End Modification log
   
  @@ -282,7 +288,7 @@
   ### Main menu
   } elsif ($PATH_INFO eq ) {
   main_menu();
  -print HRSMALLVersion: 19 January 1999BRAuthors: ,
  +print HRSMALLVersion: 24 May 1999BRAuthors: ,
A HREF=\http://alumni.caltech.edu/~dank/gnats.html\;Dan Kegel ,
and Huy Le/A, BR ,
with revamp work by ,
  
  
  


cvs commit: apache-site bugdb.cgi

1999-05-24 Thread coar
coar99/05/24 10:55:51

  Modified:.bugdb.cgi
  Log:
Argh.. 65-char marker left in by mistake.
  
  Revision  ChangesPath
  1.42  +0 -1  apache-site/bugdb.cgi
  
  Index: bugdb.cgi
  ===
  RCS file: /home/cvs/apache-site/bugdb.cgi,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- bugdb.cgi 1999/05/24 17:43:43 1.41
  +++ bugdb.cgi 1999/05/24 17:55:50 1.42
  @@ -15,7 +15,6 @@
   # Lifetime (in seconds) of displayed info before it expires.
   $life_time = 30 * 60;
   $CCNOTE = EOT;
  -#
   [In order for any reply to be added to the PR database, you need]
   [to include [EMAIL PROTECTED] in the Cc line and make sure the]
   [subject line starts with the report component and number, with ]
  
  
  


cvs commit: apache-apr/include apr_errno.h apr_lock.h

1999-05-24 Thread rbb
rbb 99/05/24 11:16:52

  Modified:apr/locks/unix crossproc.c intraproc.c locks.c
   apr/test testthread.c
   include  apr_errno.h apr_lock.h
  Log:
  Locking functions now all return status codes.  Also updated test function
  appropriately.
  
  Revision  ChangesPath
  1.6   +47 -37apache-apr/apr/locks/unix/crossproc.c
  
  Index: crossproc.c
  ===
  RCS file: /home/cvs/apache-apr/apr/locks/unix/crossproc.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- crossproc.c   1999/05/24 02:04:03 1.5
  +++ crossproc.c   1999/05/24 18:16:34 1.6
  @@ -79,12 +79,12 @@
   
   if (new-interproc  0) {
   lock_cleanup(new);
  -return APR_FAILURE;
  +return errno;
   }
   ick.val = 1;
  -if (senctl(new-interproc, 0, SETVAL, ick)  0) {
  +if (semctl(new-interproc, 0, SETVAL, ick)  0) {
   lock_cleanup(new);
  -return APR_FAILURE;
  +return errno;
   }
   /* pre-initialize these */
   new-op_on.sem_num = 0;
  @@ -103,7 +103,7 @@
   {
   new-curr_locked == 1;
   if (semop(lock-interproc, lock-op_on, 1)  0) {
  -return(APR_FAILURE);
  +return errno;
   }
   return APR_SUCCESS;
   }
  @@ -111,7 +111,7 @@
   ap_status_t unlock_inter(struct lock_t *lock)
   {
   if (semop(lock-interproc, lock-op_off, 1)  0) {
  -return(APR_FAILURE);
  +return errno;
   }
   new-curr_locked == 0;
   return APR_SUCCESS;
  @@ -119,11 +119,13 @@
   
   ap_status_t destroy_inter_lock(struct lock_t *lock)
   {
  -if (lock_cleanup(lock) == APR_SUCCESS) {
  +ap_status_t stat;
  +
  +if ((stat = lock_cleanup(lock)) == APR_SUCCESS) {
   ap_kill_cleanup(lock-cntxt-pool, lock, lock_cleanup);
   return APR_SUCCESS;
   }
  -return APR_FAILURE;
  +return stat;
   }
   #elif defined (USE_PROC_PTHREAD_SERIALIZE)  
   
  @@ -131,10 +133,10 @@
   {
   if (lock-curr_locked == 1) {
   if (pthread_mutex_unlock(lock-interproc)) {
  -return APR_FAILURE;
  +return errno;
   } 
   if (munmap((caddr_t)lock-interproc, sizeof(pthread_mutex_t))){
  -return APR_FAILURE;
  +return errno;
   }
   }
   return APR_SUCCESS;
  @@ -142,39 +144,40 @@
   
   ap_status_t create_inter_lock(struct lock_t *new)
   {
  +ap_status_t stat;
   int fd;
   pthread_mutexattr_t mattr;
   
   fd = open(/dev/zero, O_RDWR);
   if (fd  0) {
  -return APR_FAILURE;
  +return errno;
   }
   
   new-interproc = (pthread_mutex_t *)mmap((caddr_t) 0, 
 sizeof(pthread_mutex_t), 
 PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); 
   if (new-interproc = (void *) (caddr_t) -1) {
  -return APR_FAILURE;
  +return errno;
   }
   close(fd);
  -if ((errno = pthread_mutexattr_init(mattr))) {
  +if ((stat = pthread_mutexattr_init(mattr))) {
   lock_cleanup(new);
  -return APR_FAILURE;
  +return stat;
   }
  -if ((errno = pthread_mutexattr_setpshared(mattr, 
  +if ((stat = pthread_mutexattr_setpshared(mattr, 
 PTHREAD_PROCESS_SHARED))) {
   lock_cleanup(new);
  -return APR_FAILURE;
  +return stat;
   }
   
  -if ((errno = pthread_mutex_init(new-interproc, mattr))) {
  +if ((stat = pthread_mutex_init(new-interproc, mattr))) {
   lock_cleanup(new);
  -return APR_FAILURE;
  +return stat;
   }
   
  -if ((errno = pthread_mutex_destroy(mattr))) {
  +if ((stat = pthread_mutex_destroy(mattr))) {
   lock_cleanup(new);
  -return APR_FAILURE;
  +return stat;
   }
   
   new-curr_locked == 0;
  @@ -184,17 +187,20 @@
   
   ap_status_t lock_inter(struct lock_t *lock)
   {
  +ap_status_t stat;
   new-curr_locked == 1;
  -if (errno = pthread_mutex_lock(lock-interproc)) {
  -return(APR_FAILURE);
  +if (stat = pthread_mutex_lock(lock-interproc)) {
  +return stat;
   }
   return APR_SUCCESS;
   }
   
   ap_status_t unlock_inter(struct lock_t *lock)
   {
  -if (errno = pthread_mutex_unlock(lock-interproc)) {
  -return(APR_FAILURE);
  +ap_status_t stat;
  +
  +if (stat = pthread_mutex_unlock(lock-interproc)) {
  +returno stat;
   }
   new-curr_locked == 0;
   return APR_SUCCESS;
  @@ -202,11 +208,12 @@
   
   ap_status_t destroy_inter_lock(struct lock_t *lock)
   {
  -if (lock_cleanup(lock) == APR_SUCCESS) {
  +ap_status_t stat;
  +if ((stat = lock_cleanup(lock)) == APR_SUCCESS) {
   ap_kill_cleanup(lock-cntxt-pool, lock, lock_cleanup);
   return APR_SUCCESS;
   }
  -  

cvs commit: apache-apr/pthreads/src/main http_main.c

1999-05-24 Thread manoj
manoj   99/05/24 13:33:35

  Modified:pthreads/src/main http_main.c
  Log:
  Since pthread_join isn't used anymore in the server, create all of our
  threads in detached state.
  
  Revision  ChangesPath
  1.85  +5 -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.84
  retrieving revision 1.85
  diff -u -u -r1.84 -r1.85
  --- http_main.c   1999/05/24 06:53:34 1.84
  +++ http_main.c   1999/05/24 20:33:32 1.85
  @@ -1894,6 +1894,7 @@
   sigset_t sig_mask;
   int signal_received;
   pthread_t thread;
  +pthread_attr_t thread_attr;
   int i;
   int my_child_num = child_num_arg;
   proc_info *my_info = NULL;
  @@ -1929,6 +1930,8 @@
   
   worker_thread_count = 0;
   pthread_mutex_init(worker_thread_count_mutex, NULL);
  +pthread_attr_init(thread_attr);
  +pthread_attr_setdetachstate(thread_attr, PTHREAD_CREATE_DETACHED);
   for (i=0; i  ap_threads_per_child; i++) {
   
   my_info = NULL;
  @@ -1942,7 +1945,7 @@
/* We are creating threads right now */
(void) ap_update_child_status(my_child_num, i, SERVER_STARTING, 
  (request_rec *) NULL);
  - if (pthread_create(thread, NULL, worker_thread, my_info)) {
  + if (pthread_create(thread, thread_attr, worker_thread, my_info)) {
ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf,
 pthread_create: unable to create worker thread);
/* 
  @@ -1959,6 +1962,7 @@
 */
   }
   
  +pthread_attr_destroy(thread_attr);
   start_accepting_connections(my_child_num);
   
   /* This thread will be the one responsible for handling signals */