httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@apache.org
Subject cvs commit: httpd-2.0/server/mpm/winnt mpm_winnt.c mpm_winnt.h service.c
Date Wed, 17 Oct 2001 15:51:22 GMT
stoddard    01/10/17 08:51:22

  Modified:    server/mpm/winnt mpm_winnt.c mpm_winnt.h service.c
  Log:
  Win32: Deprecate ap_start_shutdown/ap_start_restart in favor of ap_signal_parent(enum).
  This simplifies the code a bit for some more MPM cleanup work forthcoming.
  
  Revision  Changes    Path
  1.179     +26 -32    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.178
  retrieving revision 1.179
  diff -u -r1.178 -r1.179
  --- mpm_winnt.c	2001/08/30 20:50:06	1.178
  +++ mpm_winnt.c	2001/10/17 15:51:22	1.179
  @@ -292,26 +292,39 @@
   	"%s_restart", signal_name_prefix);    
   }
   
  -void signal_parent(int type)
  +static int volatile is_graceful = 0;
  +AP_DECLARE(int) ap_graceful_stop_signalled(void)
  +{
  +    return is_graceful;
  +}
  +
  +AP_DECLARE(void) ap_signal_parent(ap_signal_parent_e type)
   {
       HANDLE e;
       char *signal_name;
       
  -    /* after updating the shutdown_pending or restart flags, we need
  -     * to wake up the parent process so it can see the changes. The
  -     * parent will normally be waiting for either a child process
  -     * to die, or for a signal on the "spache-signal" event. So set the
  -     * "apache-signal" event here.
  -     */
       if (one_process) {
   	return;
       }
   
       switch(type) {
  -    case 0: signal_name = signal_shutdown_name; break;
  -    case 1: signal_name = signal_restart_name; break;
  -    default: return;
  +       case SIGNAL_PARENT_SHUTDOWN: 
  +       {
  +           signal_name = signal_shutdown_name; 
  +           break;
  +       }
  +       /* This MPM supports only graceful restarts right now */
  +       case SIGNAL_PARENT_RESTART: 
  +       case SIGNAL_PARENT_RESTART_GRACEFUL:
  +       {
  +           signal_name = signal_restart_name;     
  +           is_graceful = 1;
  +           break;
  +       }
  +       default: 
  +           return;
       }
  +
       e = OpenEvent(EVENT_ALL_ACCESS, FALSE, signal_name);
       if (!e) {
   	/* Um, problem, can't signal the parent, which means we can't
  @@ -331,25 +344,6 @@
       CloseHandle(e);
   }
   
  -static int volatile is_graceful = 0;
  -
  -AP_DECLARE(int) ap_graceful_stop_signalled(void)
  -{
  -    return is_graceful;
  -}
  -
  -AP_DECLARE(void) ap_start_shutdown(void)
  -{
  -    signal_parent(0);
  -}
  -
  -AP_DECLARE(void) ap_start_restart(int gracefully)
  -{
  -    is_graceful = gracefully;
  -    signal_parent(1);
  -}
  -
  -
   /*
    * find_ready_listener()
    * Only used by Win9* and should go away when the win9*_accept() function is 
  @@ -409,7 +403,7 @@
                         &BytesRead, (LPOVERLAPPED) NULL)) {
               ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_os_error(), server_conf,
                            "setup_inherited_listeners: Unable to read socket data from parent");
  -            signal_parent(0);	/* tell parent to die */
  +            ap_signal_parent(SIGNAL_PARENT_SHUTDOWN);
               exit(1);
           }
           ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, APR_SUCCESS, server_conf,
  @@ -419,7 +413,7 @@
           if (nsd == INVALID_SOCKET) {
               ap_log_error(APLOG_MARK, APLOG_CRIT, apr_get_netos_error(), server_conf,
                            "Child %d: setup_inherited_listeners(), WSASocket failed to open
the inherited socket.", my_pid);
  -            signal_parent(0);	/* tell parent to die */
  +            ap_signal_parent(SIGNAL_PARENT_SHUTDOWN);
               exit(1);
           }
           apr_os_sock_put(&lr->sd, &nsd, pconf);
  @@ -992,7 +986,7 @@
       if (status != APR_SUCCESS) {
   	ap_log_error(APLOG_MARK,APLOG_ERR, status, server_conf,
                        "Child %d: Failed to acquire the start_mutex. Process will exit.",
my_pid);
  -        signal_parent(0);	/* tell parent to die */
  +        ap_signal_parent(SIGNAL_PARENT_SHUTDOWN);
   	exit(0);
       }
       ap_log_error(APLOG_MARK,APLOG_INFO, APR_SUCCESS, server_conf, 
  
  
  
  1.29      +6 -4      httpd-2.0/server/mpm/winnt/mpm_winnt.h
  
  Index: mpm_winnt.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm_winnt.h,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- mpm_winnt.h	2001/08/17 17:00:07	1.28
  +++ mpm_winnt.h	2001/10/17 15:51:22	1.29
  @@ -117,12 +117,14 @@
   extern OSVERSIONINFO osver;
   extern void clean_child_exit(int);
   
  -AP_DECLARE(void) ap_start_shutdown(void);
  -AP_DECLARE(void) ap_start_restart(int gracefully);
  -
   void setup_signal_names(char *prefix);
  -void signal_parent(int type);
   
  +typedef enum {
  +    SIGNAL_PARENT_SHUTDOWN,
  +    SIGNAL_PARENT_RESTART,
  +    SIGNAL_PARENT_RESTART_GRACEFUL
  +} ap_signal_parent_e;
  +AP_DECLARE(void) ap_signal_parent(ap_signal_parent_e type);
   
   /* This code is stolen from the apr_private.h and misc/win32/misc.c
    * Please see those sources for detailed documentation.
  
  
  
  1.39      +8 -8      httpd-2.0/server/mpm/winnt/service.c
  
  Index: service.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/service.c,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- service.c	2001/09/24 22:02:14	1.38
  +++ service.c	2001/10/17 15:51:22	1.39
  @@ -183,7 +183,7 @@
       if ((msg == WM_ENDSESSION) 
               && (die_on_logoff || (lParam != ENDSESSION_LOGOFF)))
       {
  -        signal_parent(0);
  +        ap_signal_parent(SIGNAL_PARENT_SHUTDOWN);
   	if (wParam)
               /* Don't leave this message until we are dead! */
   	    WaitForSingleObject(globdat.mpm_thread, 30000);
  @@ -274,7 +274,7 @@
       {
           case CTRL_BREAK_EVENT:
               fprintf(stderr, "Apache server restarting...\n");
  -            signal_parent(1);
  +            ap_signal_parent(SIGNAL_PARENT_RESTART);
               return TRUE;
           case CTRL_C_EVENT:
               fprintf(stderr, "Apache server interrupted...\n");
  @@ -282,7 +282,7 @@
                * Tell the system we have dealt with the signal
                * without waiting for Apache to terminate.
                */
  -            signal_parent(0);
  +            ap_signal_parent(SIGNAL_PARENT_SHUTDOWN);
               return TRUE;
   
           case CTRL_CLOSE_EVENT:
  @@ -295,7 +295,7 @@
                * THESE EVENTS WILL NOT OCCUR UNDER WIN9x!
                */
               fprintf(stderr, "Apache server shutdown initiated...\n");
  -            signal_parent(0);
  +            ap_signal_parent(SIGNAL_PARENT_SHUTDOWN);
               Sleep(30000);
               return TRUE;
       }
  @@ -484,14 +484,14 @@
   {
       if (dwCtrlCode == SERVICE_CONTROL_STOP)
       {
  -        ap_start_shutdown();
  +        ap_signal_parent(SIGNAL_PARENT_SHUTDOWN);
           globdat.ssStatus.dwCurrentState = SERVICE_STOP_PENDING;
           ReportStatusToSCMgr(SERVICE_STOP_PENDING, NO_ERROR, 3000);
           return;
       }
       if (dwCtrlCode == SERVICE_APACHE_RESTART)
       {
  -        ap_start_restart(1);
  +        ap_signal_parent(SIGNAL_PARENT_RESTART);
           globdat.ssStatus.dwCurrentState = SERVICE_START_PENDING;
           ReportStatusToSCMgr(SERVICE_START_PENDING, NO_ERROR, 3000);
           return;
  @@ -1337,7 +1337,7 @@
           if (!signal) 
           {
               int ticks = 60;
  -            ap_start_shutdown();
  +            ap_signal_parent(SIGNAL_PARENT_SHUTDOWN);
               while (--ticks)
               {
                   if (!IsWindow(hwnd)) {
  @@ -1360,7 +1360,7 @@
               }
               else {
                   success = TRUE;
  -                ap_start_restart(1);
  +                ap_signal_parent(SIGNAL_PARENT_RESTART);
               }
           }
       }
  
  
  

Mime
View raw message