httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/server/mpm/winnt mpm_winnt.c
Date Mon, 01 Jul 2002 19:03:04 GMT
wrowe       2002/07/01 12:03:04

  Modified:    server/mpm/winnt mpm_winnt.c
  Log:
    Using apr_file_write_full() we have less to worry about,
    and no extra os file handle.
  
  Revision  Changes    Path
  1.283     +26 -29    httpd-2.0/server/mpm/winnt/mpm_winnt.c
  
  Index: mpm_winnt.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm_winnt.c,v
  retrieving revision 1.282
  retrieving revision 1.283
  diff -u -r1.282 -r1.283
  --- mpm_winnt.c	1 Jul 2002 18:24:54 -0000	1.282
  +++ mpm_winnt.c	1 Jul 2002 19:03:03 -0000	1.283
  @@ -1466,7 +1466,7 @@
       CloseHandle(exit_event);
   }
   
  -static int send_handles_to_child(apr_pool_t *p, HANDLE child_exit_event, HANDLE hProcess,
HANDLE hPipeWrite)
  +static int send_handles_to_child(apr_pool_t *p, HANDLE child_exit_event, HANDLE hProcess,
apr_file_t *child_in)
   {
       apr_status_t rv;
       HANDLE hScore;
  @@ -1480,10 +1480,9 @@
                        "Parent: Unable to duplicate the exit event handle for the child");
           return -1;
       }
  -    if (!WriteFile(hPipeWrite, &hDup, sizeof(hDup),
  -                   &BytesWritten, (LPOVERLAPPED) NULL)
  -            || (BytesWritten != sizeof(hDup))) {
  -        ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf,
  +    if ((rv = apr_file_write_full(child_in, &hDup, sizeof(hDup), &BytesWritten))
  +            != APR_SUCCESS) {
  +        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf,
                        "Parent: Unable to send the exit event handle to the child");
           return -1;
       }
  @@ -1499,10 +1498,9 @@
                        "Parent: Unable to duplicate the scoreboard handle to the child");
           return -1;
       }
  -    if (!WriteFile(hPipeWrite, &hDup, sizeof(hDup),
  -                   &BytesWritten, (LPOVERLAPPED) NULL)
  -            || (BytesWritten != sizeof(hDup))) {
  -        ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf,
  +    if ((rv = apr_file_write_full(child_in, &hDup, sizeof(hDup), &BytesWritten))
  +            != APR_SUCCESS) {
  +        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf,
                        "Parent: Unable to send the scoreboard handle to the child");
           return -1;
       }
  @@ -1512,8 +1510,10 @@
       return 0;
   }
   
  -static int send_listeners_to_child(apr_pool_t *p, DWORD dwProcessId, HANDLE hPipeWrite)
  +static int send_listeners_to_child(apr_pool_t *p, DWORD dwProcessId, 
  +                                   apr_file_t *child_in)
   {
  +    apr_status_t rv;
       int lcnt = 0;
       ap_listen_rec *lr;
       LPWSAPROTOCOL_INFO  lpWSAProtocolInfo;
  @@ -1537,11 +1537,10 @@
               return -1;
           }
   
  -        if (!WriteFile(hPipeWrite, lpWSAProtocolInfo, (DWORD) sizeof(WSAPROTOCOL_INFO),
  -                       &BytesWritten,
  -                       (LPOVERLAPPED) NULL)
  -                || BytesWritten != sizeof(WSAPROTOCOL_INFO)) {
  -            ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), ap_server_conf,
  +        if ((rv = apr_file_write_full(child_in, lpWSAProtocolInfo, 
  +                                      sizeof(WSAPROTOCOL_INFO), &BytesWritten))
  +                != APR_SUCCESS) {
  +            ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf,
                            "Parent: Unable to write duplicated socket %d to the child.",
lr->sd );
               return -1;
           }
  @@ -1555,21 +1554,22 @@
   static int create_process(apr_pool_t *p, HANDLE *child_proc, HANDLE *child_exit_event,

                             DWORD *child_pid)
   {
  -    apr_pool_t *ptemp;
  -    char *cmd;
  -    HANDLE hExitEvent;
  -    HANDLE hPipeWrite;
  -    apr_status_t rv;
  -    apr_procattr_t *attr;
  -    apr_file_t *child_out;
  -    apr_file_t *child_err;
  -    apr_proc_t new_child;
       /* These NEVER change for the lifetime of this parent 
        */
       static char **args = NULL;
       static char **env = NULL;
       static char pidbuf[28];
  +
  +    apr_status_t rv;
  +    apr_pool_t *ptemp;
  +    apr_procattr_t *attr;
  +    apr_file_t *child_out;
  +    apr_file_t *child_err;
  +    apr_proc_t new_child;
  +    HANDLE hExitEvent;
  +    char *cmd;
       char *cwd;
  +
       apr_pool_sub_make(&ptemp, p, NULL);
   
       /* Build the command line. Should look something like this:
  @@ -1685,10 +1685,7 @@
       ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf,
                    "Parent: Created child process %d", new_child.pid);
   
  -    /* Temporary until send_handles and send_listeners accept an apr_file_t */
  -    apr_os_file_get(&hPipeWrite, new_child.in);
  -
  -    if (send_handles_to_child(p, hExitEvent, new_child.hproc, hPipeWrite)) {
  +    if (send_handles_to_child(ptemp, hExitEvent, new_child.hproc, new_child.in)) {
           /*
            * This error is fatal, mop up the child and move on
            * We toggle the child's exit event to cause this child 
  @@ -1711,7 +1708,7 @@
        */
       Sleep(1000);
   
  -    if (send_listeners_to_child(p, new_child.pid, hPipeWrite)) {
  +    if (send_listeners_to_child(ptemp, new_child.pid, new_child.in)) {
           /*
            * This error is fatal, mop up the child and move on
            * We toggle the child's exit event to cause this child 
  
  
  

Mime
View raw message