httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@hyperreal.org
Subject cvs commit: apache-2.0/src/modules/mpm/dexter acceptlock.c dexter.c
Date Wed, 08 Sep 1999 18:58:51 GMT
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  Changes    Path
  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 -10    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.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]);
  -    ap_note_cleanups_for_fd(pconf, pipe_of_death[1]);
  +    ap_register_cleanup(pconf, &pipe_of_death[0], cleanup_fd, cleanup_fd);
  +    ap_register_cleanup(pconf, &pipe_of_death[1], cleanup_fd, cleanup_fd);
       if (fcntl(pipe_of_death[0], F_SETFD, O_NONBLOCK) == -1) {
           ap_log_error(APLOG_MARK, APLOG_ERR,
                        (const server_rec*) server_conf,
  
  
  

Mime
View raw message