]> granicus.if.org Git - apache/commitdiff
Implemented a checkunload callback to allow apache to be unloaded using
authorBradley Nicholes <bnicholes@apache.org>
Mon, 14 Jan 2002 18:55:51 +0000 (18:55 +0000)
committerBradley Nicholes <bnicholes@apache.org>
Mon, 14 Jan 2002 18:55:51 +0000 (18:55 +0000)
the Unload console command.  Also changed the nlm name and console
command to APACHE2.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92852 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/platform/netware.html
os/netware/util_nw.c
server/mpm/netware/mpm_netware.c

index 6bfcdc51901e8657e2202aa6c894d4fef3e4f2a7..c2a01dbd7a5bd499c73a5278a844e922d29968fc 100644 (file)
     <blockquote>
 <pre>or</pre>
     </blockquote>
-<pre>    httpd shutdown
+<pre>    apache2 shutdown
 </pre>
     If apache is running in a protected address space specify the
     address space in the unload statement: 
     <p>Apache 2.0 for NetWare includes a set of command line directives that can
     be used to modify or display information about the running instance of the
     web server.&nbsp; Each of these directives must be preceded by the keyword
-    HTTPD:</p>
+    APACHE2:</p>
 
     <ul>
       <li>RESTART - Instructs Apache to terminate all running worker threads as
index 77219815bed3a562c23446cd3df19905cc85db99..493abc31b4203802c82f0024ada148326df10535 100644 (file)
 
 #include "httpd.h"
 #include "http_log.h"
-#include "apr_strings.h"
 
-#include <stdarg.h>
-#include <time.h>
-#include <stdlib.h>
+#include <netware.h>
 
+int nlmUnloadSignaled();
 
 AP_DECLARE(apr_status_t) ap_os_create_privileged_process(
     const request_rec *r,
@@ -74,3 +72,8 @@ AP_DECLARE(apr_status_t) ap_os_create_privileged_process(
 {
     return APR_ENOTIMPL;
 }
+
+int  _NonAppCheckUnload( void )
+{
+       return nlmUnloadSignaled();
+}
index 9df5acc7ad73bf1d49aac10372ebe2c3831fb5bb..f389677fd1855b3752c452b16d14d78f341b13bd 100644 (file)
@@ -310,6 +310,18 @@ static void set_signals(void)
     apr_signal(SIGTERM, sig_term);
 }
 
+int nlmUnloadSignaled()
+{
+    if (shutdown_pending == 1) {
+        printf ("Shutdown in progress. Please wait...\n");
+    }
+    else {
+        shutdown_pending = 1;
+        printf ("Shutdown signalled. Please wait...\n");
+    }
+    return 0;
+}
+
 /*****************************************************************
  * Child process main loop.
  * The following vars are static to avoid getting clobbered by longjmp();
@@ -790,7 +802,7 @@ static void show_server_data()
     ap_listen_rec *lr;
     module **m;
 
-    printf("%s \n", ap_get_server_version());
+    printf("%s ID: %d\n", ap_get_server_version(), getpid());
 
     /* Display listening ports */
     printf("   Listening on port(s):");
@@ -1030,31 +1042,56 @@ void netware_rewrite_args(process_rec *process)
 
 static int CommandLineInterpreter(scr_t screenID, const char *commandLine)
 {
+    char *szCommand = "APACHE2 ";
+    int iCommandLen = 8;
+    char szcommandLine[256];
+    char *pID;
     screenID = screenID;
+
+
+    if (commandLine == NULL)
+        return NOTMYCOMMAND;
+
+    strncpy (szcommandLine, commandLine, sizeof(szcommandLine)-1);
+
     /*  All added commands begin with "HTTPD " */
 
-    if (!strnicmp("HTTPD ", commandLine, 6)) {
+    if (!strnicmp(szCommand, szcommandLine, iCommandLen)) {
         ActivateScreen (getscreenhandle());
 
-        if (!strnicmp("RESTART",&commandLine[6],3)) {
+        /* If an instance id was not given but the nlm is loaded in 
+            protected space, then the the command belongs to the
+            OS address space instance to pass it on. */
+        pID = strstr (szcommandLine, "-p");
+        if ((pID == NULL) && nlmisloadedprotected())
+            return NOTMYCOMMAND;
+
+        /* If we got an instance id but it doesn't match this 
+            instance of the nlm, pass it on. */
+        if (pID && (atoi(&pID[2]) != getpid()))
+            return NOTMYCOMMAND;
+
+        /* If we have determined that this command belongs to this
+            instance of the nlm, then handle it. */
+        if (!strnicmp("RESTART",&szcommandLine[iCommandLen],3)) {
             printf("Restart Requested...\n");
             restart();
         }
-        else if (!strnicmp("VERSION",&commandLine[6],3)) {
+        else if (!strnicmp("VERSION",&szcommandLine[iCommandLen],3)) {
             printf("Server version: %s\n", ap_get_server_version());
             printf("Server built:   %s\n", ap_get_server_built());
         }
-        else if (!strnicmp("MODULES",&commandLine[6],3)) {
+        else if (!strnicmp("MODULES",&szcommandLine[iCommandLen],3)) {
            ap_show_modules();
         }
-        else if (!strnicmp("DIRECTIVES",&commandLine[6],3)) {
+        else if (!strnicmp("DIRECTIVES",&szcommandLine[iCommandLen],3)) {
                ap_show_directives();
         }
-        else if (!strnicmp("SHUTDOWN",&commandLine[6],3)) {
+        else if (!strnicmp("SHUTDOWN",&szcommandLine[iCommandLen],3)) {
             printf("Shutdown Requested...\n");
             shutdown_pending = 1;
         }
-        else if (!strnicmp("SETTINGS",&commandLine[6],3)) {
+        else if (!strnicmp("SETTINGS",&szcommandLine[iCommandLen],3)) {
             if (show_settings) {
                 show_settings = 0;
                 ClearScreen (getscreenhandle());
@@ -1066,7 +1103,18 @@ static int CommandLineInterpreter(scr_t screenID, const char *commandLine)
             }
         }
         else {
-            printf("Unknown HTTPD command %s\n", &commandLine[6]);
+            show_settings = 0;
+            if (!strnicmp("HELP",&szcommandLine[iCommandLen],3))
+                printf("Unknown HTTPD command %s\n", &szcommandLine[iCommandLen]);
+            printf("Usage: HTTPD [command] [-p <instance ID>]\n");
+            printf("Commands:\n");
+            printf("\tDIRECTIVES - Show directives\n");
+            printf("\tHELP       - Display this help information\n");
+            printf("\tMODULES    - Show a list of the loaded modules\n");
+            printf("\tRESTART    - Reread the configurtion file and restart Apache\n");
+            printf("\tSETTINGS   - Show current thread status\n");
+            printf("\tSHUTDOWN   - Shutdown Apache\n");
+            printf("\tVERSION    - Display the server version information\n");
         }
 
         /*  Tell NetWare we handled the command */