]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[OPENSM] 1. feature: added SHUT_DOWN support. Without that one can't perform reboot...
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 5 Jul 2006 13:19:23 +0000 (13:19 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 5 Jul 2006 13:19:23 +0000 (13:19 +0000)
2. bugfix: added message file for correct logging to System Event Log.
3. bugfix: wrong passing parameters in server mode;
4. bugfix: error in table of parameters

git-svn-id: svn://openib.tc.cornell.edu/gen1@402 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

trunk/ulp/opensm/user/opensm/main.c
trunk/ulp/opensm/user/opensm/osm.mc [new file with mode: 0644]

index 49671610a0601ee811135939472f80f534f646a9..168b334ab82f5300bc9e187ce377370333192840 100644 (file)
@@ -77,6 +77,9 @@ typedef struct _osm_main_args_t
   char**                 argv;
 } osm_main_args_t;
 
+osm_main_args_t osm_main_args;
+
+
 /**********************************************************************
  **********************************************************************/
 void show_usage(void);
@@ -504,7 +507,8 @@ opensm_main(
   */
   const struct option long_option[] =
     {
-      {  "debug",         1, NULL, 'd'},
+      {  "service",         0, NULL, 'Z'},
+      {  "debug",                1, NULL, 'd'},
       {  "guid",          1, NULL, 'g'},
       {  "ignore_guids",  1, NULL, 'i'},
       {  "lmc",           1, NULL, 'l'},
@@ -542,7 +546,13 @@ opensm_main(
                                    long_option, NULL);
     switch(next_option)
     {
-    case 'o':
+       case 'Z':
+       /*
+         service option - nothing to do
+       */
+       break;
+       
+       case 'o':
       /*
         Run once option.
       */
@@ -873,7 +883,6 @@ main (
 {
   int i;
   boolean_t run_as_service = FALSE;
-  osm_main_args_t osm_main_args;
   osm_main_args.argc = argc;
   osm_main_args.argv = argv;
   /* If there are arguments that the executable is ran with, then this is 
@@ -921,7 +930,8 @@ VOID WINAPI OsmServiceCtrlHandler (DWORD Opcode)
  
    switch(Opcode) 
    { 
-      case SERVICE_CONTROL_STOP: 
+          case SERVICE_CONTROL_SHUTDOWN: 
+          case SERVICE_CONTROL_STOP: 
       // Do whatever it takes to stop here. 
         osm_exit_flag = TRUE;
          OsmServiceStatus.dwWin32ExitCode = 0; 
@@ -967,7 +977,7 @@ __stdcall  OsmServiceStart (DWORD argc, LPTSTR *argv)
     OsmServiceStatus.dwServiceType        = SERVICE_WIN32; 
     OsmServiceStatus.dwCurrentState       = SERVICE_START_PENDING; 
     OsmServiceStatus.dwControlsAccepted   = SERVICE_ACCEPT_STOP | 
-        SERVICE_ACCEPT_PAUSE_CONTINUE; 
+        SERVICE_ACCEPT_PAUSE_CONTINUE | SERVICE_ACCEPT_SHUTDOWN
     OsmServiceStatus.dwWin32ExitCode      = 0; 
     OsmServiceStatus.dwServiceSpecificExitCode = 0; 
     OsmServiceStatus.dwCheckPoint         = 0; 
@@ -1020,9 +1030,6 @@ __stdcall  OsmServiceStart (DWORD argc, LPTSTR *argv)
 DWORD OsmServiceInitialization(DWORD   argc, LPTSTR  *argv, 
     DWORD *specificError) 
 { 
-  osm_main_args_t osm_main_args;
-  osm_main_args.argc = argc;
-  osm_main_args.argv = argv;
   if (CreateThread(NULL, 0, opensm_main, &osm_main_args, 0, NULL) == NULL)
   {
     SvcDebugOut(" [OSM_SERVICE] failed to create thread (%d)\n",
diff --git a/trunk/ulp/opensm/user/opensm/osm.mc b/trunk/ulp/opensm/user/opensm/osm.mc
new file mode 100644 (file)
index 0000000..3030f71
--- /dev/null
@@ -0,0 +1,29 @@
+;/*++
+;=============================================================================
+;Copyright (c) 2005 Mellanox Technologies
+;
+;Module Name:
+;
+;    osm.mc
+;
+;Abstract:
+;
+;    OpenSM event log messages
+;
+;Authors:
+;
+;    Leonid Keller
+;
+;Environment:
+;
+;   Kernel Mode .
+;
+;=============================================================================
+;--*/
+;
+
+MessageId=0x0000 SymbolicName=EVENT_OSM_ANY_INFO
+Language=English
+%1
+.
+