]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
VIGOR and RPCI definitions for the tools hang detector events.
authorOliver Kurth <okurth@vmware.com>
Fri, 2 Nov 2018 22:28:25 +0000 (15:28 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 2 Nov 2018 22:28:25 +0000 (15:28 -0700)
Define an array of ToolsHealthEvent to record the last N tools hang
events. By keeping a list of historical events since the power on,
we help ourselves trouble shooting guest/toolsd issues.

Use the first array element for the latest event. This simplifies
implementation as the DynArray can be easily capped by setting the
array count. This requires us to add a PushFront function to add
new element to the front of the DynArray.

Added the RPCI handler for the tools hang detector RPCI messages.

Added feature switch Tools_Update_Health.

open-vm-tools/lib/include/dynarray.h
open-vm-tools/lib/include/vmware/guestrpc/tclodefs.h

index 56f787dc99bf8b539631c297eba1ec3ead900339..e73b952359b8990a195e38ea8ebb0c6863267d34 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2004-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2004-2018 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -317,6 +317,22 @@ DynArray_Copy(DynArray *src,        // IN
       return TRUE;                                                      \
    }                                                                    \
                                                                         \
+   static INLINE Bool                                                   \
+   T##Array_PushFront(T##Array *a, TYPE val)                            \
+   {                                                                    \
+      unsigned int count = T##Array_Count(a);                           \
+      if (!T##Array_SetCount(a, count + 1)) {                           \
+         return FALSE;                                                  \
+      } else {                                                          \
+         unsigned int i;                                                \
+         for (i = count; i > 0; --i) {                                  \
+            *T##Array_AddressOf(a, i) = *T##Array_AddressOf(a, i-1);    \
+         }                                                              \
+         *T##Array_AddressOf(a, 0) = val;                               \
+         return TRUE;                                                   \
+      }                                                                 \
+   }                                                                    \
+                                                                        \
    static INLINE unsigned int                                           \
    T##Array_AllocCount(T##Array *a)                                     \
    {                                                                    \
index c9288e0d98d86de45e96199ff804a9eedb0091d2..560f438dcbc5595a392e13a0cccc5ade59d277bf 100644 (file)
 #define GUEST_LOG_STATE_CMD "guest.log.state"
 #define GUEST_LOG_TEXT_CMD "guest.log.text"
 
+/*
+ *  Update tools health command.
+ */
+#define UPDATE_TOOLS_HEALTH_CMD "update.tools.health"
+#define TOOLS_HEALTH_NORMAL_KEY "normal"
+#define TOOLS_HEALTH_HUNG_KEY "hung"
+#define TOOLS_HEALTH_GUEST_SLOW_KEY "guest_slow"
+
 /*
  * The max selection buffer length has to be less than the
  * ipc msg max size b/c the selection is transferred from mks -> vmx