httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@locus.apache.org
Subject cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c
Date Fri, 23 Jun 2000 00:14:15 GMT
rbb         00/06/22 17:14:15

  Modified:    src/modules/mpm/dexter dexter.c
  Log:
  Modify the dexter MPM to use an APR pipe for the pipe of death.  This fixes
  a bug I introduced earlier today, because it uses the APR_FILES_AS_SOCKETS
  to let us use the pipe of death in a poll call.  With this change, dexter
  becomes much more portable.  Dexter used to try to set the pipe
  non-blocking on it's own, but it only tried one argument to fcntl.  There
  are at least four different arguments to fcntl based on what platform you
  are on.  APR gets rid of that ugliness for us.
  
  Revision  Changes    Path
  1.102     +9 -15     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.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- dexter.c	2000/06/22 19:46:19	1.101
  +++ dexter.c	2000/06/23 00:14:14	1.102
  @@ -120,7 +120,8 @@
   
   static char ap_coredump_dir[MAX_STRING_LEN];
   
  -static int pipe_of_death[2];
  +static ap_file_t *pipe_of_death_in = NULL;
  +static ap_file_t *pipe_of_death_out = NULL;
   static pthread_mutex_t pipe_of_death_mutex;
   
   /* *Non*-shared http_main globals... */
  @@ -797,7 +798,9 @@
       
       /* Set up the pollfd array */
       listenfds = ap_pcalloc(pchild, sizeof(*listenfds) * (num_listenfds + 1));
  -    ap_put_os_sock(&listenfds[0], &pipe_of_death[0], pchild);
  +#if APR_FILES_AS_SOCKETS
  +    ap_socket_from_file(&listenfds[0], pipe_of_death_in);
  +#endif
       for (lr = ap_listeners, i = 1; i <= num_listenfds; lr = lr->next, ++i)
           listenfds[i]=lr->sd;
   
  @@ -1062,31 +1065,22 @@
       }
   }
   
  -static ap_status_t cleanup_fd(void *fdptr)
  -{
  -    if (close(*((int *) fdptr)) < 0) {
  -        return APR_EBADF;
  -    }
  -    return APR_SUCCESS;
  -}
  -
   int ap_mpm_run(ap_pool_t *_pconf, ap_pool_t *plog, server_rec *s)
   {
       int remaining_children_to_start;
       int i;
       ap_status_t rv;
  +    int one = 1;
   
       pconf = _pconf;
       ap_server_conf = s;
  -    if (pipe(pipe_of_death) == -1) {
  +    if (ap_create_pipe(&pipe_of_death_in, &pipe_of_death_out, pconf) != APR_SUCCESS)
{
           ap_log_error(APLOG_MARK, APLOG_ERR, errno,
                        (const server_rec*) ap_server_conf,
                        "pipe: (pipe_of_death)");
           exit(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_SETFL, O_NONBLOCK) == -1) {
  +    if (ap_set_pipe_timeout(pipe_of_death_in, 0) != APR_SUCCESS) {
           ap_log_error(APLOG_MARK, APLOG_ERR, errno,
                        (const server_rec*) ap_server_conf,
                        "fcntl: O_NONBLOCKing (pipe_of_death)");
  @@ -1205,7 +1199,7 @@
   	}
   	/* give the children the signal to die */
           for (i = 0; i < num_daemons;) {
  -            if (write(pipe_of_death[1], &char_of_death, 1) == -1) {
  +            if (ap_write(pipe_of_death_out, &char_of_death, &one) != APR_SUCCESS)
{
                   if (errno == EINTR) continue;
                   ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf,
                                "write pipe_of_death");
  
  
  

Mime
View raw message