]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Move HostinfoProcessQuery() from hostinfo.c into hostinfoPosix.c.
authorJohn Wolfe <jwolfe@vmware.com>
Thu, 8 Sep 2022 21:51:39 +0000 (14:51 -0700)
committerJohn Wolfe <jwolfe@vmware.com>
Thu, 8 Sep 2022 21:51:39 +0000 (14:51 -0700)
open-vm-tools/lib/misc/hostinfo.c
open-vm-tools/lib/misc/hostinfoPosix.c

index c0fe3fd2fb742190a7b4978b0faa86ce9969e2ad..57db878d7e09fb3e0137d335e4ced47aee2bbd16 100644 (file)
@@ -335,41 +335,3 @@ Hostinfo_GetOSDetailedData(void)
 
    return detailedData;
 }
-
-/*
- *----------------------------------------------------------------------
- *
- * Hostinfo_QueryProcessExistence --
- *
- *      Determine if a PID is "alive" or "dead". Failing to be able to
- *      do this perfectly, do not make any assumption - say the answer
- *      is unknown.
- *
- * Results:
- *      HOSTINFO_PROCESS_QUERY_ALIVE    Process is alive
- *      HOSTINFO_PROCESS_QUERY_DEAD     Process is dead
- *      HOSTINFO_PROCESS_QUERY_UNKNOWN  Don't know
- *
- * Side effects:
- *      None
- *
- *----------------------------------------------------------------------
- */
-
-HostinfoProcessQuery
-Hostinfo_QueryProcessExistence(int pid)  // IN:
-{
-   HostinfoProcessQuery ret;
-   HostinfoProcessSnapshot *s = Hostinfo_AcquireProcessSnapshot();
-
-   if (s == NULL) {
-      return HOSTINFO_PROCESS_QUERY_UNKNOWN;
-   }
-
-   ret = Hostinfo_QueryProcessSnapshot(s, pid);
-
-   Hostinfo_ReleaseProcessSnapshot(s);
-
-   return ret;
-}
-
index f525236f3d230c9c511fdae5ed3f520e9cf7db01..72fdd18b4d8763b829c7d82fcb599d9d1d4e107b 100644 (file)
@@ -4452,11 +4452,11 @@ Hostinfo_ReleaseProcessSnapshot(HostinfoProcessSnapshot *s)  // IN/OPT:
 /*
  *----------------------------------------------------------------------
  *
- * Hostinfo_QueryProcessSnapshot --
+ * Hostinfo_QueryProcessExistence --
  *
- *      Determine if a PID is "alive" or "dead" within the specified
- *      process snapshot. Failing to be able to do this perfectly,
- *      do not make any assumption - say the answer is unknown.
+ *      Determine if a PID is "alive" or "dead". Failing to be able to
+ *      do this perfectly, do not make any assumption - say the answer
+ *      is unknown.
  *
  * Results:
  *      HOSTINFO_PROCESS_QUERY_ALIVE    Process is alive
@@ -4470,26 +4470,54 @@ Hostinfo_ReleaseProcessSnapshot(HostinfoProcessSnapshot *s)  // IN/OPT:
  */
 
 HostinfoProcessQuery
-Hostinfo_QueryProcessSnapshot(HostinfoProcessSnapshot *s,  // IN:
-                              int pid)                     // IN:
+Hostinfo_QueryProcessExistence(int pid)  // IN:
 {
-   HostinfoProcessQuery ret;
-
-   ASSERT(s != NULL);
+   HostinfoProcessQuery result;
 
    switch ((kill(pid, 0) == -1) ? errno : 0) {
    case 0:
    case EPERM:
-      ret = HOSTINFO_PROCESS_QUERY_ALIVE;
+      result = HOSTINFO_PROCESS_QUERY_ALIVE;
       break;
+
    case ESRCH:
-      ret = HOSTINFO_PROCESS_QUERY_DEAD;
+      result = HOSTINFO_PROCESS_QUERY_DEAD;
       break;
+
    default:
-      ret = HOSTINFO_PROCESS_QUERY_UNKNOWN;
+      result = HOSTINFO_PROCESS_QUERY_UNKNOWN;
       break;
    }
 
-   return ret;
+   return result;
 }
 
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Hostinfo_QueryProcessSnapshot --
+ *
+ *      Determine if a PID is "alive" or "dead" within the specified
+ *      process snapshot. Failing to be able to do this perfectly,
+ *      do not make any assumption - say the answer is unknown.
+ *
+ * Results:
+ *      HOSTINFO_PROCESS_QUERY_ALIVE    Process is alive
+ *      HOSTINFO_PROCESS_QUERY_DEAD     Process is dead
+ *      HOSTINFO_PROCESS_QUERY_UNKNOWN  Don't know
+ *
+ * Side effects:
+ *      None
+ *
+ *----------------------------------------------------------------------
+ */
+
+HostinfoProcessQuery
+Hostinfo_QueryProcessSnapshot(HostinfoProcessSnapshot *s,  // IN:
+                              int pid)                     // IN:
+{
+   ASSERT(s != NULL);
+
+   return Hostinfo_QueryProcessExistence(pid);
+}