windows-smb-started-synchronization-20080108
[openafs.git] / src / WINNT / afsd / afsd_service.c
index ea3fdd4..ac58d2a 100644 (file)
@@ -61,6 +61,8 @@ static void afsd_notifier(char *msgp, char *filep, long line)
 #ifdef AFSIFS
     int i;
 #endif
+    if (!msgp)
+        msgp = "unspecified assert";
 
     if (filep)
        LogEvent(EVENTLOG_ERROR_TYPE, MSG_SERVICE_ERROR_STOP_WITH_MSG_AND_LOCATION, 
@@ -76,6 +78,8 @@ static void afsd_notifier(char *msgp, char *filep, long line)
     buf_ForceTrace(TRUE);
 
     afsi_log("--- begin dump ---");
+    cm_MemDumpDirStats(afsi_file, "a", 0);
+    cm_MemDumpBPlusStats(afsi_file, "a", 0);
     cm_DumpCells(afsi_file, "a", 0);
     cm_DumpVolumes(afsi_file, "a", 0);
     cm_DumpSCache(afsi_file, "a", 0);
@@ -246,6 +250,11 @@ afsd_ServiceControlHandlerEx(
     {
     case SERVICE_CONTROL_SHUTDOWN:
     case SERVICE_CONTROL_STOP:
+       if (ctrlCode == SERVICE_CONTROL_SHUTDOWN)
+           afsi_log("SERVICE_CONTROL_SHUTDOWN");
+       else
+            afsi_log("SERVICE_CONTROL_STOP");
+
         ServiceStatus.dwCurrentState = SERVICE_STOP_PENDING;
         ServiceStatus.dwWin32ExitCode = NO_ERROR;
         ServiceStatus.dwCheckPoint = 1;
@@ -335,7 +344,7 @@ afsd_ServiceControlHandlerEx(
                    powerStateSuspended = 1;
                    if (osVersion.dwMajorVersion >= 6) {
                         cm_SuspendSCache();
-                       smb_StopListeners();
+                       smb_StopListeners(0);
                     }
                     dwRet = NO_ERROR;                       
                     break;                                  
@@ -344,14 +353,14 @@ afsd_ServiceControlHandlerEx(
                    powerStateSuspended = 1;
                    if (osVersion.dwMajorVersion >= 6) {
                         cm_SuspendSCache();
-                       smb_StopListeners();
+                       smb_StopListeners(0);
                     }
                     dwRet = NO_ERROR;                       
                     break;                                  
                 case PBT_APMRESUMECRITICAL:             
                     afsi_log("SERVICE_CONTROL_APMRESUMECRITICAL"); 
                    if (osVersion.dwMajorVersion >= 6)
-                       smb_RestartListeners();
+                       smb_RestartListeners(0);
                     dwRet = NO_ERROR;                       
                     break;                                  
                 case PBT_APMRESUMESUSPEND:                                                        
@@ -385,7 +394,7 @@ afsd_ServiceControlHandlerEx(
                     afsi_log("SERVICE_CONTROL_APMRESUMEAUTOMATIC"); 
                    powerStateSuspended = 0;
                    if (osVersion.dwMajorVersion >= 6)
-                       smb_RestartListeners();
+                       smb_RestartListeners(0);
                     dwRet = NO_ERROR;                       
                     break;                                  
                 default:                                                                          
@@ -432,7 +441,7 @@ static DWORD __stdcall MountGlobalDrivesThread(void * notUsed)
 
     dwResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKeyName, 0, KEY_QUERY_VALUE, &hKey);
     if (dwResult != ERROR_SUCCESS)
-        return;
+        return 0;
 
     while (dwIndex < MAX_DRIVES) {
         dwDriveSize = sizeof(szDriveToMapTo);
@@ -996,7 +1005,11 @@ BOOL AFSModulesVerify(void)
         RegCloseKey (parmKey);
     }
 
-    if (verifyServiceSig && cacheSize < 716800) {
+    if (verifyServiceSig 
+#ifndef _WIN64
+         && cacheSize < 716800
+#endif
+         ) {
         trustVerified = VerifyTrust(filename);
     } else {
         afsi_log("Signature Verification disabled");
@@ -1301,6 +1314,9 @@ afsd_Main(DWORD argc, LPTSTR *argv)
         SetServiceStatus(StatusHandle, &ServiceStatus);
 #endif
 
+        /* Notify any volume status handlers that the cache manager has started */
+        cm_VolStatus_Service_Started();
+
 /* the following ifdef chooses the mode of operation for the service.  to enable
  * a runtime flag (instead of compile-time), pioctl() would need to dynamically
  * determine the mode, in order to use the correct ioctl special-file path. */
@@ -1363,9 +1379,6 @@ afsd_Main(DWORD argc, LPTSTR *argv)
        LogEvent(EVENTLOG_INFORMATION_TYPE, MSG_SERVICE_RUNNING);
     }
 
-    /* Notify any volume status handlers that we have started */
-    cm_VolStatus_Service_Started();
-
     /* allow an exit to be called when started */
     hHookDll = LoadLibrary(AFSD_HOOK_DLL);
     if (hHookDll)