Blame SOURCES/ovt-add-appinfo-plugin.patch

b87039
From 21437d973ef7389533b3cf67183aca73b3dad3ad Mon Sep 17 00:00:00 2001
b87039
From: Cathy Avery <cavery@redhat.com>
b87039
Date: Fri, 27 Mar 2020 13:33:32 +0100
b87039
Subject: add appinfo plugin
b87039
b87039
Message-id: <20200327133332.7366-1-cavery@redhat.com>
b87039
Patchwork-id: 94454
b87039
O-Subject: [RHEL7.9 open-vm-tools PATCH] add appinfo plugin
b87039
Bugzilla: 1809753
b87039
RH-Acked-by: Eduardo Otubo <otubo@redhat.com>
b87039
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
b87039
b87039
commit f1f0b812e7fb9ccf405fcfd48ddb4d65e8532eef
b87039
Author: Oliver Kurth <okurth@vmware.com>
b87039
Date:   Wed Feb 5 17:21:52 2020 -0800
b87039
b87039
    add appinfo plugin
b87039
b87039
Signed-off-by: Cathy Avery <cavery@redhat.com>
b87039
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
b87039
---
b87039
 open-vm-tools/configure.ac                         |   3 +-
b87039
 open-vm-tools/lib/include/appInfo.h                |  41 ++
b87039
 open-vm-tools/services/plugins/Makefile.am         |   5 +-
b87039
 open-vm-tools/services/plugins/appInfo/COPYING     | 502 ++++++++++++++++++
b87039
 open-vm-tools/services/plugins/appInfo/Makefile.am |  37 ++
b87039
 open-vm-tools/services/plugins/appInfo/appInfo.c   | 572 +++++++++++++++++++++
b87039
 .../services/plugins/appInfo/appInfoInt.h          |  64 +++
b87039
 .../services/plugins/appInfo/appInfoPosix.c        | 124 +++++
b87039
 .../services/plugins/appInfo/appInfoUtil.c         | 143 ++++++
b87039
 9 files changed, 1489 insertions(+), 2 deletions(-)
b87039
 create mode 100644 open-vm-tools/lib/include/appInfo.h
b87039
 create mode 100644 open-vm-tools/services/plugins/appInfo/COPYING
b87039
 create mode 100644 open-vm-tools/services/plugins/appInfo/Makefile.am
b87039
 create mode 100644 open-vm-tools/services/plugins/appInfo/appInfo.c
b87039
 create mode 100644 open-vm-tools/services/plugins/appInfo/appInfoInt.h
b87039
 create mode 100644 open-vm-tools/services/plugins/appInfo/appInfoPosix.c
b87039
 create mode 100644 open-vm-tools/services/plugins/appInfo/appInfoUtil.c
b87039
b87039
diff --git a/open-vm-tools/configure.ac b/open-vm-tools/configure.ac
b87039
index f1cc721..009fe87 100644
b87039
--- a/open-vm-tools/configure.ac
b87039
+++ b/open-vm-tools/configure.ac
b87039
@@ -1,5 +1,5 @@
b87039
 ################################################################################
b87039
-### Copyright (C) 2007-2019 VMware, Inc.  All rights reserved.
b87039
+### Copyright (C) 2007-2020 VMware, Inc.  All rights reserved.
b87039
 ###
b87039
 ### Configure script for building the VMware OSS Tools.
b87039
 ###
b87039
@@ -1579,6 +1579,7 @@ AC_CONFIG_FILES([                      \
b87039
    services/Makefile                   \
b87039
    services/vmtoolsd/Makefile          \
b87039
    services/plugins/Makefile           \
b87039
+   services/plugins/appInfo/Makefile   \
b87039
    services/plugins/desktopEvents/Makefile \
b87039
    services/plugins/dndcp/Makefile     \
b87039
    services/plugins/guestInfo/Makefile \
b87039
diff --git a/open-vm-tools/lib/include/appInfo.h b/open-vm-tools/lib/include/appInfo.h
b87039
new file mode 100644
b87039
index 0000000..122d08e
b87039
--- /dev/null
b87039
+++ b/open-vm-tools/lib/include/appInfo.h
b87039
@@ -0,0 +1,41 @@
b87039
+/*********************************************************
b87039
+ * Copyright (C) 2020 VMware, Inc. All rights reserved.
b87039
+ *
b87039
+ * This program is free software; you can redistribute it and/or modify it
b87039
+ * under the terms of the GNU Lesser General Public License as published
b87039
+ * by the Free Software Foundation version 2.1 and no later version.
b87039
+ *
b87039
+ * This program is distributed in the hope that it will be useful, but
b87039
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
b87039
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
b87039
+ * License for more details.
b87039
+ *
b87039
+ * You should have received a copy of the GNU Lesser General Public License
b87039
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
b87039
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
b87039
+ *
b87039
+ *********************************************************/
b87039
+
b87039
+#ifndef _APPINFO_H_
b87039
+#define _APPINFO_H_
b87039
+
b87039
+/**
b87039
+ * @file appInfo.h
b87039
+ *
b87039
+ * Declares few constants for the appInfo plugin.
b87039
+ */
b87039
+
b87039
+/**
b87039
+ * The guest Variable name for the application information.
b87039
+ */
b87039
+#define APP_INFO_GUESTVAR_KEY         "appInfo"
b87039
+
b87039
+#define APP_INFO_VERSION_1            1
b87039
+#define APP_INFO_KEY_VERSION          "version"
b87039
+#define APP_INFO_KEY_UPDATE_COUNTER   "updateCounter"
b87039
+#define APP_INFO_KEY_PUBLISHTIME      "publishTime"
b87039
+#define APP_INFO_KEY_APPS             "applications"
b87039
+#define APP_INFO_KEY_APP_NAME         "a"
b87039
+#define APP_INFO_KEY_APP_VERSION      "v"
b87039
+
b87039
+#endif /* _APPINFO_H_ */
b87039
diff --git a/open-vm-tools/services/plugins/Makefile.am b/open-vm-tools/services/plugins/Makefile.am
b87039
index 7ab22ee..e010ab1 100644
b87039
--- a/open-vm-tools/services/plugins/Makefile.am
b87039
+++ b/open-vm-tools/services/plugins/Makefile.am
b87039
@@ -1,5 +1,5 @@
b87039
 ################################################################################
b87039
-### Copyright (C) 2009-2019 VMware, Inc.  All rights reserved.
b87039
+### Copyright (C) 2009-2020 VMware, Inc.  All rights reserved.
b87039
 ###
b87039
 ### This program is free software; you can redistribute it and/or modify
b87039
 ### it under the terms of version 2 of the GNU General Public License as
b87039
@@ -16,6 +16,9 @@
b87039
 ################################################################################
b87039
 
b87039
 SUBDIRS =
b87039
+if LINUX
b87039
+SUBDIRS += appInfo
b87039
+endif
b87039
 if HAVE_X11
b87039
    SUBDIRS += desktopEvents
b87039
 endif
b87039
diff --git a/open-vm-tools/services/plugins/appInfo/COPYING b/open-vm-tools/services/plugins/appInfo/COPYING
b87039
new file mode 100644
b87039
index 0000000..9c6a6cc
b87039
--- /dev/null
b87039
+++ b/open-vm-tools/services/plugins/appInfo/COPYING
b87039
@@ -0,0 +1,502 @@
b87039
+		  GNU LESSER GENERAL PUBLIC LICENSE
b87039
+		       Version 2.1, February 1999
b87039
+
b87039
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
b87039
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
b87039
+ Everyone is permitted to copy and distribute verbatim copies
b87039
+ of this license document, but changing it is not allowed.
b87039
+
b87039
+[This is the first released version of the Lesser GPL.  It also counts
b87039
+ as the successor of the GNU Library Public License, version 2, hence
b87039
+ the version number 2.1.]
b87039
+
b87039
+			    Preamble
b87039
+
b87039
+  The licenses for most software are designed to take away your
b87039
+freedom to share and change it.  By contrast, the GNU General Public
b87039
+Licenses are intended to guarantee your freedom to share and change
b87039
+free software--to make sure the software is free for all its users.
b87039
+
b87039
+  This license, the Lesser General Public License, applies to some
b87039
+specially designated software packages--typically libraries--of the
b87039
+Free Software Foundation and other authors who decide to use it.  You
b87039
+can use it too, but we suggest you first think carefully about whether
b87039
+this license or the ordinary General Public License is the better
b87039
+strategy to use in any particular case, based on the explanations below.
b87039
+
b87039
+  When we speak of free software, we are referring to freedom of use,
b87039
+not price.  Our General Public Licenses are designed to make sure that
b87039
+you have the freedom to distribute copies of free software (and charge
b87039
+for this service if you wish); that you receive source code or can get
b87039
+it if you want it; that you can change the software and use pieces of
b87039
+it in new free programs; and that you are informed that you can do
b87039
+these things.
b87039
+
b87039
+  To protect your rights, we need to make restrictions that forbid
b87039
+distributors to deny you these rights or to ask you to surrender these
b87039
+rights.  These restrictions translate to certain responsibilities for
b87039
+you if you distribute copies of the library or if you modify it.
b87039
+
b87039
+  For example, if you distribute copies of the library, whether gratis
b87039
+or for a fee, you must give the recipients all the rights that we gave
b87039
+you.  You must make sure that they, too, receive or can get the source
b87039
+code.  If you link other code with the library, you must provide
b87039
+complete object files to the recipients, so that they can relink them
b87039
+with the library after making changes to the library and recompiling
b87039
+it.  And you must show them these terms so they know their rights.
b87039
+
b87039
+  We protect your rights with a two-step method: (1) we copyright the
b87039
+library, and (2) we offer you this license, which gives you legal
b87039
+permission to copy, distribute and/or modify the library.
b87039
+
b87039
+  To protect each distributor, we want to make it very clear that
b87039
+there is no warranty for the free library.  Also, if the library is
b87039
+modified by someone else and passed on, the recipients should know
b87039
+that what they have is not the original version, so that the original
b87039
+author's reputation will not be affected by problems that might be
b87039
+introduced by others.
b87039
+
b87039
+  Finally, software patents pose a constant threat to the existence of
b87039
+any free program.  We wish to make sure that a company cannot
b87039
+effectively restrict the users of a free program by obtaining a
b87039
+restrictive license from a patent holder.  Therefore, we insist that
b87039
+any patent license obtained for a version of the library must be
b87039
+consistent with the full freedom of use specified in this license.
b87039
+
b87039
+  Most GNU software, including some libraries, is covered by the
b87039
+ordinary GNU General Public License.  This license, the GNU Lesser
b87039
+General Public License, applies to certain designated libraries, and
b87039
+is quite different from the ordinary General Public License.  We use
b87039
+this license for certain libraries in order to permit linking those
b87039
+libraries into non-free programs.
b87039
+
b87039
+  When a program is linked with a library, whether statically or using
b87039
+a shared library, the combination of the two is legally speaking a
b87039
+combined work, a derivative of the original library.  The ordinary
b87039
+General Public License therefore permits such linking only if the
b87039
+entire combination fits its criteria of freedom.  The Lesser General
b87039
+Public License permits more lax criteria for linking other code with
b87039
+the library.
b87039
+
b87039
+  We call this license the "Lesser" General Public License because it
b87039
+does Less to protect the user's freedom than the ordinary General
b87039
+Public License.  It also provides other free software developers Less
b87039
+of an advantage over competing non-free programs.  These disadvantages
b87039
+are the reason we use the ordinary General Public License for many
b87039
+libraries.  However, the Lesser license provides advantages in certain
b87039
+special circumstances.
b87039
+
b87039
+  For example, on rare occasions, there may be a special need to
b87039
+encourage the widest possible use of a certain library, so that it becomes
b87039
+a de-facto standard.  To achieve this, non-free programs must be
b87039
+allowed to use the library.  A more frequent case is that a free
b87039
+library does the same job as widely used non-free libraries.  In this
b87039
+case, there is little to gain by limiting the free library to free
b87039
+software only, so we use the Lesser General Public License.
b87039
+
b87039
+  In other cases, permission to use a particular library in non-free
b87039
+programs enables a greater number of people to use a large body of
b87039
+free software.  For example, permission to use the GNU C Library in
b87039
+non-free programs enables many more people to use the whole GNU
b87039
+operating system, as well as its variant, the GNU/Linux operating
b87039
+system.
b87039
+
b87039
+  Although the Lesser General Public License is Less protective of the
b87039
+users' freedom, it does ensure that the user of a program that is
b87039
+linked with the Library has the freedom and the wherewithal to run
b87039
+that program using a modified version of the Library.
b87039
+
b87039
+  The precise terms and conditions for copying, distribution and
b87039
+modification follow.  Pay close attention to the difference between a
b87039
+"work based on the library" and a "work that uses the library".  The
b87039
+former contains code derived from the library, whereas the latter must
b87039
+be combined with the library in order to run.
b87039
+
b87039
+		  GNU LESSER GENERAL PUBLIC LICENSE
b87039
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
b87039
+
b87039
+  0. This License Agreement applies to any software library or other
b87039
+program which contains a notice placed by the copyright holder or
b87039
+other authorized party saying it may be distributed under the terms of
b87039
+this Lesser General Public License (also called "this License").
b87039
+Each licensee is addressed as "you".
b87039
+
b87039
+  A "library" means a collection of software functions and/or data
b87039
+prepared so as to be conveniently linked with application programs
b87039
+(which use some of those functions and data) to form executables.
b87039
+
b87039
+  The "Library", below, refers to any such software library or work
b87039
+which has been distributed under these terms.  A "work based on the
b87039
+Library" means either the Library or any derivative work under
b87039
+copyright law: that is to say, a work containing the Library or a
b87039
+portion of it, either verbatim or with modifications and/or translated
b87039
+straightforwardly into another language.  (Hereinafter, translation is
b87039
+included without limitation in the term "modification".)
b87039
+
b87039
+  "Source code" for a work means the preferred form of the work for
b87039
+making modifications to it.  For a library, complete source code means
b87039
+all the source code for all modules it contains, plus any associated
b87039
+interface definition files, plus the scripts used to control compilation
b87039
+and installation of the library.
b87039
+
b87039
+  Activities other than copying, distribution and modification are not
b87039
+covered by this License; they are outside its scope.  The act of
b87039
+running a program using the Library is not restricted, and output from
b87039
+such a program is covered only if its contents constitute a work based
b87039
+on the Library (independent of the use of the Library in a tool for
b87039
+writing it).  Whether that is true depends on what the Library does
b87039
+and what the program that uses the Library does.
b87039
+
b87039
+  1. You may copy and distribute verbatim copies of the Library's
b87039
+complete source code as you receive it, in any medium, provided that
b87039
+you conspicuously and appropriately publish on each copy an
b87039
+appropriate copyright notice and disclaimer of warranty; keep intact
b87039
+all the notices that refer to this License and to the absence of any
b87039
+warranty; and distribute a copy of this License along with the
b87039
+Library.
b87039
+
b87039
+  You may charge a fee for the physical act of transferring a copy,
b87039
+and you may at your option offer warranty protection in exchange for a
b87039
+fee.
b87039
+
b87039
+  2. You may modify your copy or copies of the Library or any portion
b87039
+of it, thus forming a work based on the Library, and copy and
b87039
+distribute such modifications or work under the terms of Section 1
b87039
+above, provided that you also meet all of these conditions:
b87039
+
b87039
+    a) The modified work must itself be a software library.
b87039
+
b87039
+    b) You must cause the files modified to carry prominent notices
b87039
+    stating that you changed the files and the date of any change.
b87039
+
b87039
+    c) You must cause the whole of the work to be licensed at no
b87039
+    charge to all third parties under the terms of this License.
b87039
+
b87039
+    d) If a facility in the modified Library refers to a function or a
b87039
+    table of data to be supplied by an application program that uses
b87039
+    the facility, other than as an argument passed when the facility
b87039
+    is invoked, then you must make a good faith effort to ensure that,
b87039
+    in the event an application does not supply such function or
b87039
+    table, the facility still operates, and performs whatever part of
b87039
+    its purpose remains meaningful.
b87039
+
b87039
+    (For example, a function in a library to compute square roots has
b87039
+    a purpose that is entirely well-defined independent of the
b87039
+    application.  Therefore, Subsection 2d requires that any
b87039
+    application-supplied function or table used by this function must
b87039
+    be optional: if the application does not supply it, the square
b87039
+    root function must still compute square roots.)
b87039
+
b87039
+These requirements apply to the modified work as a whole.  If
b87039
+identifiable sections of that work are not derived from the Library,
b87039
+and can be reasonably considered independent and separate works in
b87039
+themselves, then this License, and its terms, do not apply to those
b87039
+sections when you distribute them as separate works.  But when you
b87039
+distribute the same sections as part of a whole which is a work based
b87039
+on the Library, the distribution of the whole must be on the terms of
b87039
+this License, whose permissions for other licensees extend to the
b87039
+entire whole, and thus to each and every part regardless of who wrote
b87039
+it.
b87039
+
b87039
+Thus, it is not the intent of this section to claim rights or contest
b87039
+your rights to work written entirely by you; rather, the intent is to
b87039
+exercise the right to control the distribution of derivative or
b87039
+collective works based on the Library.
b87039
+
b87039
+In addition, mere aggregation of another work not based on the Library
b87039
+with the Library (or with a work based on the Library) on a volume of
b87039
+a storage or distribution medium does not bring the other work under
b87039
+the scope of this License.
b87039
+
b87039
+  3. You may opt to apply the terms of the ordinary GNU General Public
b87039
+License instead of this License to a given copy of the Library.  To do
b87039
+this, you must alter all the notices that refer to this License, so
b87039
+that they refer to the ordinary GNU General Public License, version 2,
b87039
+instead of to this License.  (If a newer version than version 2 of the
b87039
+ordinary GNU General Public License has appeared, then you can specify
b87039
+that version instead if you wish.)  Do not make any other change in
b87039
+these notices.
b87039
+
b87039
+  Once this change is made in a given copy, it is irreversible for
b87039
+that copy, so the ordinary GNU General Public License applies to all
b87039
+subsequent copies and derivative works made from that copy.
b87039
+
b87039
+  This option is useful when you wish to copy part of the code of
b87039
+the Library into a program that is not a library.
b87039
+
b87039
+  4. You may copy and distribute the Library (or a portion or
b87039
+derivative of it, under Section 2) in object code or executable form
b87039
+under the terms of Sections 1 and 2 above provided that you accompany
b87039
+it with the complete corresponding machine-readable source code, which
b87039
+must be distributed under the terms of Sections 1 and 2 above on a
b87039
+medium customarily used for software interchange.
b87039
+
b87039
+  If distribution of object code is made by offering access to copy
b87039
+from a designated place, then offering equivalent access to copy the
b87039
+source code from the same place satisfies the requirement to
b87039
+distribute the source code, even though third parties are not
b87039
+compelled to copy the source along with the object code.
b87039
+
b87039
+  5. A program that contains no derivative of any portion of the
b87039
+Library, but is designed to work with the Library by being compiled or
b87039
+linked with it, is called a "work that uses the Library".  Such a
b87039
+work, in isolation, is not a derivative work of the Library, and
b87039
+therefore falls outside the scope of this License.
b87039
+
b87039
+  However, linking a "work that uses the Library" with the Library
b87039
+creates an executable that is a derivative of the Library (because it
b87039
+contains portions of the Library), rather than a "work that uses the
b87039
+library".  The executable is therefore covered by this License.
b87039
+Section 6 states terms for distribution of such executables.
b87039
+
b87039
+  When a "work that uses the Library" uses material from a header file
b87039
+that is part of the Library, the object code for the work may be a
b87039
+derivative work of the Library even though the source code is not.
b87039
+Whether this is true is especially significant if the work can be
b87039
+linked without the Library, or if the work is itself a library.  The
b87039
+threshold for this to be true is not precisely defined by law.
b87039
+
b87039
+  If such an object file uses only numerical parameters, data
b87039
+structure layouts and accessors, and small macros and small inline
b87039
+functions (ten lines or less in length), then the use of the object
b87039
+file is unrestricted, regardless of whether it is legally a derivative
b87039
+work.  (Executables containing this object code plus portions of the
b87039
+Library will still fall under Section 6.)
b87039
+
b87039
+  Otherwise, if the work is a derivative of the Library, you may
b87039
+distribute the object code for the work under the terms of Section 6.
b87039
+Any executables containing that work also fall under Section 6,
b87039
+whether or not they are linked directly with the Library itself.
b87039
+
b87039
+  6. As an exception to the Sections above, you may also combine or
b87039
+link a "work that uses the Library" with the Library to produce a
b87039
+work containing portions of the Library, and distribute that work
b87039
+under terms of your choice, provided that the terms permit
b87039
+modification of the work for the customer's own use and reverse
b87039
+engineering for debugging such modifications.
b87039
+
b87039
+  You must give prominent notice with each copy of the work that the
b87039
+Library is used in it and that the Library and its use are covered by
b87039
+this License.  You must supply a copy of this License.  If the work
b87039
+during execution displays copyright notices, you must include the
b87039
+copyright notice for the Library among them, as well as a reference
b87039
+directing the user to the copy of this License.  Also, you must do one
b87039
+of these things:
b87039
+
b87039
+    a) Accompany the work with the complete corresponding
b87039
+    machine-readable source code for the Library including whatever
b87039
+    changes were used in the work (which must be distributed under
b87039
+    Sections 1 and 2 above); and, if the work is an executable linked
b87039
+    with the Library, with the complete machine-readable "work that
b87039
+    uses the Library", as object code and/or source code, so that the
b87039
+    user can modify the Library and then relink to produce a modified
b87039
+    executable containing the modified Library.  (It is understood
b87039
+    that the user who changes the contents of definitions files in the
b87039
+    Library will not necessarily be able to recompile the application
b87039
+    to use the modified definitions.)
b87039
+
b87039
+    b) Use a suitable shared library mechanism for linking with the
b87039
+    Library.  A suitable mechanism is one that (1) uses at run time a
b87039
+    copy of the library already present on the user's computer system,
b87039
+    rather than copying library functions into the executable, and (2)
b87039
+    will operate properly with a modified version of the library, if
b87039
+    the user installs one, as long as the modified version is
b87039
+    interface-compatible with the version that the work was made with.
b87039
+
b87039
+    c) Accompany the work with a written offer, valid for at
b87039
+    least three years, to give the same user the materials
b87039
+    specified in Subsection 6a, above, for a charge no more
b87039
+    than the cost of performing this distribution.
b87039
+
b87039
+    d) If distribution of the work is made by offering access to copy
b87039
+    from a designated place, offer equivalent access to copy the above
b87039
+    specified materials from the same place.
b87039
+
b87039
+    e) Verify that the user has already received a copy of these
b87039
+    materials or that you have already sent this user a copy.
b87039
+
b87039
+  For an executable, the required form of the "work that uses the
b87039
+Library" must include any data and utility programs needed for
b87039
+reproducing the executable from it.  However, as a special exception,
b87039
+the materials to be distributed need not include anything that is
b87039
+normally distributed (in either source or binary form) with the major
b87039
+components (compiler, kernel, and so on) of the operating system on
b87039
+which the executable runs, unless that component itself accompanies
b87039
+the executable.
b87039
+
b87039
+  It may happen that this requirement contradicts the license
b87039
+restrictions of other proprietary libraries that do not normally
b87039
+accompany the operating system.  Such a contradiction means you cannot
b87039
+use both them and the Library together in an executable that you
b87039
+distribute.
b87039
+
b87039
+  7. You may place library facilities that are a work based on the
b87039
+Library side-by-side in a single library together with other library
b87039
+facilities not covered by this License, and distribute such a combined
b87039
+library, provided that the separate distribution of the work based on
b87039
+the Library and of the other library facilities is otherwise
b87039
+permitted, and provided that you do these two things:
b87039
+
b87039
+    a) Accompany the combined library with a copy of the same work
b87039
+    based on the Library, uncombined with any other library
b87039
+    facilities.  This must be distributed under the terms of the
b87039
+    Sections above.
b87039
+
b87039
+    b) Give prominent notice with the combined library of the fact
b87039
+    that part of it is a work based on the Library, and explaining
b87039
+    where to find the accompanying uncombined form of the same work.
b87039
+
b87039
+  8. You may not copy, modify, sublicense, link with, or distribute
b87039
+the Library except as expressly provided under this License.  Any
b87039
+attempt otherwise to copy, modify, sublicense, link with, or
b87039
+distribute the Library is void, and will automatically terminate your
b87039
+rights under this License.  However, parties who have received copies,
b87039
+or rights, from you under this License will not have their licenses
b87039
+terminated so long as such parties remain in full compliance.
b87039
+
b87039
+  9. You are not required to accept this License, since you have not
b87039
+signed it.  However, nothing else grants you permission to modify or
b87039
+distribute the Library or its derivative works.  These actions are
b87039
+prohibited by law if you do not accept this License.  Therefore, by
b87039
+modifying or distributing the Library (or any work based on the
b87039
+Library), you indicate your acceptance of this License to do so, and
b87039
+all its terms and conditions for copying, distributing or modifying
b87039
+the Library or works based on it.
b87039
+
b87039
+  10. Each time you redistribute the Library (or any work based on the
b87039
+Library), the recipient automatically receives a license from the
b87039
+original licensor to copy, distribute, link with or modify the Library
b87039
+subject to these terms and conditions.  You may not impose any further
b87039
+restrictions on the recipients' exercise of the rights granted herein.
b87039
+You are not responsible for enforcing compliance by third parties with
b87039
+this License.
b87039
+
b87039
+  11. If, as a consequence of a court judgment or allegation of patent
b87039
+infringement or for any other reason (not limited to patent issues),
b87039
+conditions are imposed on you (whether by court order, agreement or
b87039
+otherwise) that contradict the conditions of this License, they do not
b87039
+excuse you from the conditions of this License.  If you cannot
b87039
+distribute so as to satisfy simultaneously your obligations under this
b87039
+License and any other pertinent obligations, then as a consequence you
b87039
+may not distribute the Library at all.  For example, if a patent
b87039
+license would not permit royalty-free redistribution of the Library by
b87039
+all those who receive copies directly or indirectly through you, then
b87039
+the only way you could satisfy both it and this License would be to
b87039
+refrain entirely from distribution of the Library.
b87039
+
b87039
+If any portion of this section is held invalid or unenforceable under any
b87039
+particular circumstance, the balance of the section is intended to apply,
b87039
+and the section as a whole is intended to apply in other circumstances.
b87039
+
b87039
+It is not the purpose of this section to induce you to infringe any
b87039
+patents or other property right claims or to contest validity of any
b87039
+such claims; this section has the sole purpose of protecting the
b87039
+integrity of the free software distribution system which is
b87039
+implemented by public license practices.  Many people have made
b87039
+generous contributions to the wide range of software distributed
b87039
+through that system in reliance on consistent application of that
b87039
+system; it is up to the author/donor to decide if he or she is willing
b87039
+to distribute software through any other system and a licensee cannot
b87039
+impose that choice.
b87039
+
b87039
+This section is intended to make thoroughly clear what is believed to
b87039
+be a consequence of the rest of this License.
b87039
+
b87039
+  12. If the distribution and/or use of the Library is restricted in
b87039
+certain countries either by patents or by copyrighted interfaces, the
b87039
+original copyright holder who places the Library under this License may add
b87039
+an explicit geographical distribution limitation excluding those countries,
b87039
+so that distribution is permitted only in or among countries not thus
b87039
+excluded.  In such case, this License incorporates the limitation as if
b87039
+written in the body of this License.
b87039
+
b87039
+  13. The Free Software Foundation may publish revised and/or new
b87039
+versions of the Lesser General Public License from time to time.
b87039
+Such new versions will be similar in spirit to the present version,
b87039
+but may differ in detail to address new problems or concerns.
b87039
+
b87039
+Each version is given a distinguishing version number.  If the Library
b87039
+specifies a version number of this License which applies to it and
b87039
+"any later version", you have the option of following the terms and
b87039
+conditions either of that version or of any later version published by
b87039
+the Free Software Foundation.  If the Library does not specify a
b87039
+license version number, you may choose any version ever published by
b87039
+the Free Software Foundation.
b87039
+
b87039
+  14. If you wish to incorporate parts of the Library into other free
b87039
+programs whose distribution conditions are incompatible with these,
b87039
+write to the author to ask for permission.  For software which is
b87039
+copyrighted by the Free Software Foundation, write to the Free
b87039
+Software Foundation; we sometimes make exceptions for this.  Our
b87039
+decision will be guided by the two goals of preserving the free status
b87039
+of all derivatives of our free software and of promoting the sharing
b87039
+and reuse of software generally.
b87039
+
b87039
+			    NO WARRANTY
b87039
+
b87039
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
b87039
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
b87039
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
b87039
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
b87039
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
b87039
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
b87039
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
b87039
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
b87039
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
b87039
+
b87039
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
b87039
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
b87039
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
b87039
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
b87039
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
b87039
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
b87039
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
b87039
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
b87039
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
b87039
+DAMAGES.
b87039
+
b87039
+		     END OF TERMS AND CONDITIONS
b87039
+
b87039
+           How to Apply These Terms to Your New Libraries
b87039
+
b87039
+  If you develop a new library, and you want it to be of the greatest
b87039
+possible use to the public, we recommend making it free software that
b87039
+everyone can redistribute and change.  You can do so by permitting
b87039
+redistribution under these terms (or, alternatively, under the terms of the
b87039
+ordinary General Public License).
b87039
+
b87039
+  To apply these terms, attach the following notices to the library.  It is
b87039
+safest to attach them to the start of each source file to most effectively
b87039
+convey the exclusion of warranty; and each file should have at least the
b87039
+"copyright" line and a pointer to where the full notice is found.
b87039
+
b87039
+    <one line to give the library's name and a brief idea of what it does.>
b87039
+    Copyright (C) <year>  <name of author>
b87039
+
b87039
+    This library is free software; you can redistribute it and/or
b87039
+    modify it under the terms of the GNU Lesser General Public
b87039
+    License as published by the Free Software Foundation; either
b87039
+    version 2.1 of the License, or (at your option) any later version.
b87039
+
b87039
+    This library is distributed in the hope that it will be useful,
b87039
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
b87039
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
b87039
+    Lesser General Public License for more details.
b87039
+
b87039
+    You should have received a copy of the GNU Lesser General Public
b87039
+    License along with this library; if not, write to the Free Software
b87039
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
b87039
+
b87039
+Also add information on how to contact you by electronic and paper mail.
b87039
+
b87039
+You should also get your employer (if you work as a programmer) or your
b87039
+school, if any, to sign a "copyright disclaimer" for the library, if
b87039
+necessary.  Here is a sample; alter the names:
b87039
+
b87039
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
b87039
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
b87039
+
b87039
+  <signature of Ty Coon>, 1 April 1990
b87039
+  Ty Coon, President of Vice
b87039
+
b87039
+That's all there is to it!
b87039
diff --git a/open-vm-tools/services/plugins/appInfo/Makefile.am b/open-vm-tools/services/plugins/appInfo/Makefile.am
b87039
new file mode 100644
b87039
index 0000000..fd1e466
b87039
--- /dev/null
b87039
+++ b/open-vm-tools/services/plugins/appInfo/Makefile.am
b87039
@@ -0,0 +1,37 @@
b87039
+################################################################################
b87039
+### Copyright (C) 2020 VMware, Inc.  All rights reserved.
b87039
+###
b87039
+### This program is free software; you can redistribute it and/or modify
b87039
+### it under the terms of version 2 of the GNU General Public License as
b87039
+### published by the Free Software Foundation.
b87039
+###
b87039
+### This program is distributed in the hope that it will be useful,
b87039
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
b87039
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b87039
+### GNU General Public License for more details.
b87039
+###
b87039
+### You should have received a copy of the GNU General Public License
b87039
+### along with this program; if not, write to the Free Software
b87039
+### Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
b87039
+################################################################################
b87039
+
b87039
+SUBDIRS =
b87039
+
b87039
+plugindir = @VMSVC_PLUGIN_INSTALLDIR@
b87039
+plugin_LTLIBRARIES = libappInfo.la
b87039
+
b87039
+libappInfo_la_CPPFLAGS =
b87039
+libappInfo_la_CPPFLAGS += @PLUGIN_CPPFLAGS@
b87039
+
b87039
+libappInfo_la_LDFLAGS =
b87039
+libappInfo_la_LDFLAGS += @PLUGIN_LDFLAGS@
b87039
+
b87039
+libappInfo_la_LIBADD =
b87039
+libappInfo_la_LIBADD += @VMTOOLS_LIBS@
b87039
+libappInfo_la_LIBADD += @GOBJECT_LIBS@
b87039
+
b87039
+libappInfo_la_SOURCES =
b87039
+libappInfo_la_SOURCES += appInfo.c
b87039
+libappInfo_la_SOURCES += appInfoInt.h
b87039
+libappInfo_la_SOURCES += appInfoUtil.c
b87039
+libappInfo_la_SOURCES += appInfoPosix.c
b87039
diff --git a/open-vm-tools/services/plugins/appInfo/appInfo.c b/open-vm-tools/services/plugins/appInfo/appInfo.c
b87039
new file mode 100644
b87039
index 0000000..b0db092
b87039
--- /dev/null
b87039
+++ b/open-vm-tools/services/plugins/appInfo/appInfo.c
b87039
@@ -0,0 +1,572 @@
b87039
+/*********************************************************
b87039
+ * Copyright (C) 2020 VMware, Inc. All rights reserved.
b87039
+ *
b87039
+ * This program is free software; you can redistribute it and/or modify it
b87039
+ * under the terms of the GNU Lesser General Public License as published
b87039
+ * by the Free Software Foundation version 2.1 and no later version.
b87039
+ *
b87039
+ * This program is distributed in the hope that it will be useful, but
b87039
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
b87039
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
b87039
+ * License for more details.
b87039
+ *
b87039
+ * You should have received a copy of the GNU Lesser General Public License
b87039
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
b87039
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
b87039
+ *
b87039
+ *********************************************************/
b87039
+
b87039
+/*
b87039
+ * appInfo.c --
b87039
+ *
b87039
+ *      Captures the information about running applications inside the guest
b87039
+ *      and publishes it to a guest variable.
b87039
+ */
b87039
+
b87039
+
b87039
+#include <stdio.h>
b87039
+#include <stdlib.h>
b87039
+#include <string.h>
b87039
+
b87039
+#include "appInfo.h"
b87039
+#include "appInfoInt.h"
b87039
+#include "vmware.h"
b87039
+#include "conf.h"
b87039
+#include "dynbuf.h"
b87039
+#include "escape.h"
b87039
+#include "str.h"
b87039
+#include "util.h"
b87039
+#include "vm_atomic.h"
b87039
+#include "vmcheck.h"
b87039
+#include "vmware/tools/log.h"
b87039
+#include "vmware/tools/threadPool.h"
b87039
+#include "vmware/tools/utils.h"
b87039
+
b87039
+#if !defined(__APPLE__)
b87039
+#include "vm_version.h"
b87039
+#include "embed_version.h"
b87039
+#include "vmtoolsd_version.h"
b87039
+VM_EMBED_VERSION(VMTOOLSD_VERSION_STRING);
b87039
+#endif
b87039
+
b87039
+#if defined(_WIN32)
b87039
+#include "codeset.h"
b87039
+#endif
b87039
+
b87039
+/**
b87039
+ * Maximum size of the packet size that appInfo plugin should send
b87039
+ * to the VMX. Currently, this is set to 62 KB.
b87039
+ */
b87039
+#define MAX_APP_INFO_SIZE (62 * 1024)
b87039
+
b87039
+/**
b87039
+ * Default poll interval for appInfo is 30m
b87039
+ */
b87039
+#define APP_INFO_POLL_INTERVAL (30 * 60)
b87039
+
b87039
+/**
b87039
+ * Default value for CONFNAME_APPINFO_DISABLED setting in
b87039
+ * tools configuration file.
b87039
+ *
b87039
+ * FALSE will enable the plugin. TRUE will disable the plugin.
b87039
+ */
b87039
+#define APP_INFO_CONF_DEFAULT_DISABLED_VALUE FALSE
b87039
+
b87039
+/**
b87039
+ * Defines the current poll interval (in seconds).
b87039
+ *
b87039
+ * This value is controlled by the appinfo.poll-interval config file option.
b87039
+ */
b87039
+int appInfoPollInterval = 0;
b87039
+
b87039
+/**
b87039
+ * AppInfo gather loop timeout source.
b87039
+ */
b87039
+static GSource *appInfoTimeoutSource = NULL;
b87039
+
b87039
+
b87039
+/*
b87039
+ *****************************************************************************
b87039
+ * EscapeJSONString --
b87039
+ *
b87039
+ * Escapes a string to be included in JSON content.
b87039
+ *
b87039
+ * @param[in] str The string to be escaped.
b87039
+ *
b87039
+ * @retval Pointer to a heap-allocated memory. This holds the escaped content
b87039
+ *         of the string passed by the caller.
b87039
+ *
b87039
+ *****************************************************************************
b87039
+ */
b87039
+
b87039
+static char *
b87039
+EscapeJSONString(const char *str)    // IN
b87039
+{
b87039
+   /*
b87039
+    * Escape '"' and '\' characters in the JSON string.
b87039
+    */
b87039
+
b87039
+   static const int bytesToEscape[] = {
b87039
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
b87039
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
b87039
+      0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   // "
b87039
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
b87039
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
b87039
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,   // '\'
b87039
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
b87039
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
b87039
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
b87039
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
b87039
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
b87039
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
b87039
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
b87039
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
b87039
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
b87039
+      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
b87039
+   };
b87039
+
b87039
+   return Escape_DoString("\\u00", bytesToEscape, str, strlen(str),
b87039
+                          NULL);
b87039
+}
b87039
+
b87039
+
b87039
+/*
b87039
+ *****************************************************************************
b87039
+ * SetGuestInfo --
b87039
+ *
b87039
+ * Sends a simple key-value update request to the VMX.
b87039
+ *
b87039
+ * @param[in] ctx       Application context.
b87039
+ * @param[in] key       Key sent to the VMX
b87039
+ * @param[in] value     GuestInfo data sent to the VMX
b87039
+ *
b87039
+ * @retval TRUE  RPCI succeeded.
b87039
+ * @retval FALSE RPCI failed.
b87039
+ *
b87039
+ *****************************************************************************
b87039
+ */
b87039
+
b87039
+static Bool
b87039
+SetGuestInfo(ToolsAppCtx *ctx,              // IN:
b87039
+             const char *guestVariableName, // IN:
b87039
+             const char *value)             // IN:
b87039
+{
b87039
+   Bool status;
b87039
+   char *reply = NULL;
b87039
+   gchar *msg;
b87039
+   size_t replyLen;
b87039
+
b87039
+   ASSERT(guestVariableName);
b87039
+   ASSERT(value);
b87039
+
b87039
+   msg = g_strdup_printf("info-set guestinfo.%s %s",
b87039
+                         guestVariableName,
b87039
+                         value);
b87039
+
b87039
+   status = RpcChannel_Send(ctx->rpc,
b87039
+                            msg,
b87039
+                            strlen(msg) + 1,
b87039
+                            &reply,
b87039
+                            &replyLen);
b87039
+   g_free(msg);
b87039
+
b87039
+   if (!status) {
b87039
+      g_warning("Error sending RPC message: %s\n", reply ? reply : "NULL");
b87039
+      vm_free(reply);
b87039
+      return FALSE;
b87039
+   } else {
b87039
+      g_info("Successfully sent the app information.\n");
b87039
+   }
b87039
+
b87039
+   status = (*reply == '\0');
b87039
+   vm_free(reply);
b87039
+   return status;
b87039
+}
b87039
+
b87039
+
b87039
+/*
b87039
+ *****************************************************************************
b87039
+ * AppInfoGatherTask --
b87039
+ *
b87039
+ * Collects all the desired application related information and updates VMX.
b87039
+ *
b87039
+ * @param[in]  data     The application context.
b87039
+ *
b87039
+ *****************************************************************************
b87039
+ */
b87039
+
b87039
+static void
b87039
+AppInfoGatherTask(ToolsAppCtx *ctx,
b87039
+                  void *data)
b87039
+{
b87039
+   DynBuf dynBuffer;
b87039
+   char tmpBuf[1024];
b87039
+   int len;
b87039
+   gchar *tstamp = NULL;
b87039
+   char *escapedCmd = NULL;
b87039
+   char *escapedVersion = NULL;
b87039
+   GSList *appList = NULL;
b87039
+   GSList *appNode;
b87039
+   static Atomic_uint64 updateCounter = {0};
b87039
+   uint64 counter = (uint64) Atomic_ReadInc64(&updateCounter) + 1;
b87039
+
b87039
+   static char headerFmt[] = "{\n"
b87039
+                     "\"" APP_INFO_KEY_VERSION        "\":\"%d\", \n"
b87039
+                     "\"" APP_INFO_KEY_UPDATE_COUNTER "\":\"%"FMT64"d\", \n"
b87039
+                     "\"" APP_INFO_KEY_PUBLISHTIME    "\":\"%s\", \n"
b87039
+                     "\"" APP_INFO_KEY_APPS           "\":[";
b87039
+   static char jsonPerAppFmt[] =
b87039
+                           "%s\n" // , for all the elements after the first one
b87039
+                           "{"
b87039
+                           "\"" APP_INFO_KEY_APP_NAME    "\":\"%s\""
b87039
+                           ","
b87039
+                           "\"" APP_INFO_KEY_APP_VERSION "\":\"%s\""
b87039
+                           "}";
b87039
+   static char jsonSuffix[] = "]}";
b87039
+
b87039
+   DynBuf_Init(&dynBuffer);
b87039
+
b87039
+   tstamp = VMTools_GetTimeAsString();
b87039
+
b87039
+   len = Str_Snprintf(tmpBuf, sizeof tmpBuf, headerFmt,
b87039
+                      APP_INFO_VERSION_1,
b87039
+                      counter,
b87039
+                      tstamp != NULL ? tstamp : "");
b87039
+
b87039
+   if (len < 0) {
b87039
+      g_warning("Insufficient space for the header.\n");
b87039
+      goto abort;
b87039
+   }
b87039
+
b87039
+   DynBuf_Append(&dynBuffer, tmpBuf, len);
b87039
+
b87039
+   appList = AppInfo_SortAppList(AppInfo_GetAppList());
b87039
+
b87039
+   for (appNode = appList; appNode != NULL; appNode = appNode->next) {
b87039
+      size_t currentBufferSize = DynBuf_GetSize(&dynBuffer);
b87039
+      AppInfo *appInfo = (AppInfo *) appNode->data;
b87039
+
b87039
+      if (appInfo->appName == NULL ||
b87039
+          appInfo->version == NULL) {
b87039
+         goto next_entry;
b87039
+      }
b87039
+
b87039
+      escapedCmd = EscapeJSONString(appInfo->appName);
b87039
+
b87039
+      if (NULL == escapedCmd) {
b87039
+         g_warning("Failed to escape the content of cmdName\n");
b87039
+         goto abort;
b87039
+      }
b87039
+
b87039
+      escapedVersion = EscapeJSONString(appInfo->version);
b87039
+      if (NULL == escapedVersion) {
b87039
+         g_warning("Failed to escape the content of version information.\n");
b87039
+         goto abort;
b87039
+      }
b87039
+
b87039
+      if (appNode == appList) {
b87039
+         len = Str_Snprintf(tmpBuf, sizeof tmpBuf, jsonPerAppFmt,
b87039
+                            "", escapedCmd, escapedVersion);
b87039
+      } else {
b87039
+         /*
b87039
+          * If this is not the first element, then add ',' at the beginning.
b87039
+          */
b87039
+         len = Str_Snprintf(tmpBuf, sizeof tmpBuf, jsonPerAppFmt,
b87039
+                            ",", escapedCmd, escapedVersion);
b87039
+      }
b87039
+
b87039
+      if (len < 0) {
b87039
+         g_warning("Insufficient space for the application information.\n");
b87039
+         goto next_entry;
b87039
+      }
b87039
+
b87039
+      if (currentBufferSize + len + sizeof jsonSuffix > MAX_APP_INFO_SIZE) {
b87039
+         g_warning("Exceeded the max info packet size."
b87039
+                   " Truncating the rest of the applications.\n");
b87039
+         break;
b87039
+      }
b87039
+
b87039
+      DynBuf_Append(&dynBuffer, tmpBuf, len);
b87039
+
b87039
+next_entry:
b87039
+      free(escapedCmd);
b87039
+      escapedCmd = NULL;
b87039
+      free(escapedVersion);
b87039
+      escapedVersion = NULL;
b87039
+   }
b87039
+
b87039
+   DynBuf_Append(&dynBuffer, jsonSuffix, sizeof jsonSuffix - 1);
b87039
+   SetGuestInfo(ctx, APP_INFO_GUESTVAR_KEY, DynBuf_GetString(&dynBuffer));
b87039
+
b87039
+abort:
b87039
+   free(escapedCmd);
b87039
+   free(escapedVersion);
b87039
+   AppInfo_DestroyAppList(appList);
b87039
+   g_free(tstamp);
b87039
+   DynBuf_Destroy(&dynBuffer);
b87039
+}
b87039
+
b87039
+
b87039
+/*
b87039
+ *****************************************************************************
b87039
+ * AppInfoGather --
b87039
+ *
b87039
+ * Creates a new thread that collects all the desired application related
b87039
+ * information and udates the VMX.
b87039
+ *
b87039
+ * @param[in]  data     The application context.
b87039
+ *
b87039
+ * @return TRUE to indicate that the timer should be rescheduled.
b87039
+ *
b87039
+ *****************************************************************************
b87039
+ */
b87039
+
b87039
+static gboolean
b87039
+AppInfoGather(gpointer data)
b87039
+{
b87039
+   ToolsAppCtx *ctx = data;
b87039
+   if (!ToolsCorePool_SubmitTask(ctx, AppInfoGatherTask, NULL, NULL)) {
b87039
+      g_warning("%s: failed to start information gather thread\n",
b87039
+                __FUNCTION__);
b87039
+   }
b87039
+
b87039
+   return TRUE;
b87039
+}
b87039
+
b87039
+
b87039
+/*
b87039
+ *****************************************************************************
b87039
+ * TweakGatherLoop --
b87039
+ *
b87039
+ * @brief Start, stop, reconfigure a GuestInfoGather poll loop.
b87039
+ *
b87039
+ * This function is responsible for creating, manipulating, and resetting a
b87039
+ * AppDiscoveryGather loop timeout source.
b87039
+ *
b87039
+ * @param[in]     ctx           The app context.
b87039
+ * @param[in]     enable        Whether to enable the gather loop.
b87039
+ *
b87039
+ *****************************************************************************
b87039
+ */
b87039
+
b87039
+static void
b87039
+TweakGatherLoop(ToolsAppCtx *ctx,
b87039
+                gboolean enable)
b87039
+{
b87039
+   gint pollInterval = 0;
b87039
+
b87039
+   if (enable) {
b87039
+      pollInterval = APP_INFO_POLL_INTERVAL * 1000;
b87039
+
b87039
+      /*
b87039
+      * Check the config registry for custom poll interval,
b87039
+      * converting from seconds to milliseconds.
b87039
+      */
b87039
+      if (g_key_file_has_key(ctx->config, CONFGROUPNAME_APPINFO,
b87039
+                             CONFNAME_APPINFO_POLLINTERVAL, NULL)) {
b87039
+         GError *gError = NULL;
b87039
+
b87039
+         pollInterval = g_key_file_get_integer(ctx->config,
b87039
+                                               CONFGROUPNAME_APPINFO,
b87039
+                                               CONFNAME_APPINFO_POLLINTERVAL,
b87039
+                                               &gError);
b87039
+         pollInterval *= 1000;
b87039
+
b87039
+         if (pollInterval < 0 || gError) {
b87039
+            g_warning("Invalid %s.%s value. Using default %us.\n",
b87039
+                      CONFGROUPNAME_APPINFO,
b87039
+                      CONFNAME_APPINFO_POLLINTERVAL,
b87039
+                      APP_INFO_POLL_INTERVAL);
b87039
+            pollInterval = APP_INFO_POLL_INTERVAL * 1000;
b87039
+         }
b87039
+
b87039
+         g_clear_error(&gError);
b87039
+      }
b87039
+   }
b87039
+
b87039
+   if (appInfoTimeoutSource != NULL) {
b87039
+      /*
b87039
+       * If the interval hasn't changed, let's not interfere with the existing
b87039
+       * timeout source.
b87039
+       */
b87039
+      if (pollInterval == appInfoPollInterval) {
b87039
+         ASSERT(pollInterval);
b87039
+         return;
b87039
+      }
b87039
+
b87039
+      /*
b87039
+       * Destroy the existing timeout source since the interval has changed.
b87039
+       */
b87039
+
b87039
+      g_source_destroy(appInfoTimeoutSource);
b87039
+      appInfoTimeoutSource = NULL;
b87039
+   }
b87039
+
b87039
+   /*
b87039
+    * All checks have passed.  Create a new timeout source and attach it.
b87039
+    */
b87039
+   appInfoPollInterval = pollInterval;
b87039
+
b87039
+   if (appInfoPollInterval) {
b87039
+      g_info("New value for %s is %us.\n",
b87039
+             CONFNAME_APPINFO_POLLINTERVAL,
b87039
+             appInfoPollInterval / 1000);
b87039
+
b87039
+      appInfoTimeoutSource = g_timeout_source_new(appInfoPollInterval);
b87039
+      VMTOOLSAPP_ATTACH_SOURCE(ctx, appInfoTimeoutSource,
b87039
+                               AppInfoGather, ctx, NULL);
b87039
+      g_source_unref(appInfoTimeoutSource);
b87039
+   } else {
b87039
+      g_info("Poll loop for %s disabled.\n", CONFNAME_APPINFO_POLLINTERVAL);
b87039
+      SetGuestInfo(ctx, APP_INFO_GUESTVAR_KEY, "");
b87039
+   }
b87039
+}
b87039
+
b87039
+
b87039
+/*
b87039
+ *****************************************************************************
b87039
+ * AppInfoServerConfReload --
b87039
+ *
b87039
+ * @brief Reconfigures the poll loop interval upon config file reload.
b87039
+ *
b87039
+ * @param[in]  src     The source object.
b87039
+ * @param[in]  ctx     The application context.
b87039
+ * @param[in]  data    Unused.
b87039
+ *
b87039
+ *****************************************************************************
b87039
+ */
b87039
+
b87039
+static void
b87039
+AppInfoServerConfReload(gpointer src,
b87039
+                        ToolsAppCtx *ctx,
b87039
+                        gpointer data)
b87039
+{
b87039
+   gboolean disabled =
b87039
+      VMTools_ConfigGetBoolean(ctx->config,
b87039
+                               CONFGROUPNAME_APPINFO,
b87039
+                               CONFNAME_APPINFO_DISABLED,
b87039
+                               APP_INFO_CONF_DEFAULT_DISABLED_VALUE);
b87039
+   TweakGatherLoop(ctx, !disabled);
b87039
+}
b87039
+
b87039
+
b87039
+/*
b87039
+ *****************************************************************************
b87039
+ * AppInfoServerShutdown --
b87039
+ *
b87039
+ * Cleanup internal data on shutdown.
b87039
+ *
b87039
+ * @param[in]  src     The source object.
b87039
+ * @param[in]  ctx     Unused.
b87039
+ * @param[in]  data    Unused.
b87039
+ *
b87039
+ *****************************************************************************
b87039
+ */
b87039
+
b87039
+static void
b87039
+AppInfoServerShutdown(gpointer src,
b87039
+                      ToolsAppCtx *ctx,
b87039
+                      gpointer data)
b87039
+{
b87039
+   if (appInfoTimeoutSource != NULL) {
b87039
+      g_source_destroy(appInfoTimeoutSource);
b87039
+      appInfoTimeoutSource = NULL;
b87039
+   }
b87039
+
b87039
+   SetGuestInfo(ctx, APP_INFO_GUESTVAR_KEY, "");
b87039
+}
b87039
+
b87039
+
b87039
+/*
b87039
+ *****************************************************************************
b87039
+ * ToolsOnLoad --
b87039
+ *
b87039
+ * Plugin entry point. Initializes internal plugin state.
b87039
+ *
b87039
+ * @param[in]  ctx   The app context.
b87039
+ *
b87039
+ * @return The registration data.
b87039
+ *
b87039
+ *****************************************************************************
b87039
+ */
b87039
+
b87039
+TOOLS_MODULE_EXPORT ToolsPluginData *
b87039
+ToolsOnLoad(ToolsAppCtx *ctx)
b87039
+{
b87039
+   static ToolsPluginData regData = {
b87039
+      "appInfo",
b87039
+      NULL,
b87039
+      NULL
b87039
+   };
b87039
+
b87039
+   uint32 vmxVersion = 0;
b87039
+   uint32 vmxType = VMX_TYPE_UNSET;
b87039
+
b87039
+   /*
b87039
+    * Return NULL to disable the plugin if not running in a VMware VM.
b87039
+    */
b87039
+   if (!ctx->isVMware) {
b87039
+      g_info("Not running in a VMware VM.\n");
b87039
+      return NULL;
b87039
+   }
b87039
+
b87039
+   /*
b87039
+    * Return NULL to disable the plugin if VM is not running on ESX host.
b87039
+    */
b87039
+   if (!VmCheck_GetVersion(&vmxVersion, &vmxType) ||
b87039
+       vmxType != VMX_TYPE_SCALABLE_SERVER) {
b87039
+      g_info("VM is not running on ESX host.\n");
b87039
+      return NULL;
b87039
+   }
b87039
+
b87039
+   /*
b87039
+    * Return NULL to disable the plugin if not running in vmsvc daemon.
b87039
+    */
b87039
+   if (!TOOLS_IS_MAIN_SERVICE(ctx)) {
b87039
+      g_info("Not running in vmsvc daemon: container name='%s'.\n",
b87039
+             ctx->name);
b87039
+      return NULL;
b87039
+   }
b87039
+
b87039
+   /*
b87039
+    * This plugin is useless without an RpcChannel.  If we don't have one,
b87039
+    * just bail.
b87039
+    */
b87039
+   if (ctx->rpc != NULL) {
b87039
+      ToolsPluginSignalCb sigs[] = {
b87039
+         { TOOLS_CORE_SIG_CONF_RELOAD, AppInfoServerConfReload, NULL },
b87039
+         { TOOLS_CORE_SIG_SHUTDOWN, AppInfoServerShutdown, NULL }
b87039
+      };
b87039
+      ToolsAppReg regs[] = {
b87039
+         { TOOLS_APP_SIGNALS,
b87039
+           VMTools_WrapArray(sigs, sizeof *sigs, ARRAYSIZE(sigs))
b87039
+         }
b87039
+      };
b87039
+
b87039
+      gboolean disabled = FALSE;
b87039
+
b87039
+      regData.regs = VMTools_WrapArray(regs,
b87039
+                                       sizeof *regs,
b87039
+                                       ARRAYSIZE(regs));
b87039
+
b87039
+      /*
b87039
+       * Set up the AppInfo gather loop.
b87039
+       */
b87039
+      disabled =
b87039
+         VMTools_ConfigGetBoolean(ctx->config,
b87039
+                                  CONFGROUPNAME_APPINFO,
b87039
+                                  CONFNAME_APPINFO_DISABLED,
b87039
+                                  APP_INFO_CONF_DEFAULT_DISABLED_VALUE);
b87039
+      TweakGatherLoop(ctx, !disabled);
b87039
+
b87039
+      return &regData;
b87039
+   }
b87039
+
b87039
+   return NULL;
b87039
+}
b87039
+
b87039
+
b87039
+/*
b87039
+ * END Tools Core Services goodies.
b87039
+ *****************************************************************************
b87039
+ */
b87039
diff --git a/open-vm-tools/services/plugins/appInfo/appInfoInt.h b/open-vm-tools/services/plugins/appInfo/appInfoInt.h
b87039
new file mode 100644
b87039
index 0000000..1897926
b87039
--- /dev/null
b87039
+++ b/open-vm-tools/services/plugins/appInfo/appInfoInt.h
b87039
@@ -0,0 +1,64 @@
b87039
+/*********************************************************
b87039
+ * Copyright (C) 2020 VMware, Inc. All rights reserved.
b87039
+ *
b87039
+ * This program is free software; you can redistribute it and/or modify it
b87039
+ * under the terms of the GNU Lesser General Public License as published
b87039
+ * by the Free Software Foundation version 2.1 and no later version.
b87039
+ *
b87039
+ * This program is distributed in the hope that it will be useful, but
b87039
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
b87039
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
b87039
+ * License for more details.
b87039
+ *
b87039
+ * You should have received a copy of the GNU Lesser General Public License
b87039
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
b87039
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
b87039
+ *
b87039
+ *********************************************************/
b87039
+
b87039
+#ifndef _APPINFOINT_H_
b87039
+#define _APPINFOINT_H_
b87039
+
b87039
+/**
b87039
+ * @file appInfoInt.h
b87039
+ *
b87039
+ * Header file with few functions that are internal to appInfo plugin.
b87039
+ */
b87039
+
b87039
+#define G_LOG_DOMAIN "appInfo"
b87039
+#include "vm_basic_types.h"
b87039
+#include <glib.h>
b87039
+#include "vmware/tools/plugin.h"
b87039
+
b87039
+#if defined(_WIN32)
b87039
+
b87039
+#include <windows.h>
b87039
+typedef DWORD AppInfo_Pid;
b87039
+
b87039
+#else /* POSIX */
b87039
+
b87039
+#include <sys/types.h>
b87039
+typedef pid_t AppInfo_Pid;
b87039
+
b87039
+#endif
b87039
+
b87039
+/*
b87039
+ * Application information structure.
b87039
+ * This holds basic information we return per process
b87039
+ * when listing process information inside the guest.
b87039
+ */
b87039
+
b87039
+typedef struct AppInfo {
b87039
+   AppInfo_Pid procId;
b87039
+   char *appName;             // UTF-8
b87039
+   char *version;
b87039
+#if defined(_WIN32)
b87039
+   size_t memoryUsed;
b87039
+#endif
b87039
+} AppInfo;
b87039
+
b87039
+GSList *AppInfo_GetAppList(void);
b87039
+GSList *AppInfo_SortAppList(GSList *appList);
b87039
+
b87039
+void AppInfo_DestroyAppList(GSList *appList);
b87039
+#endif /* _APPINFOINT_H_ */
b87039
diff --git a/open-vm-tools/services/plugins/appInfo/appInfoPosix.c b/open-vm-tools/services/plugins/appInfo/appInfoPosix.c
b87039
new file mode 100644
b87039
index 0000000..d7b05be
b87039
--- /dev/null
b87039
+++ b/open-vm-tools/services/plugins/appInfo/appInfoPosix.c
b87039
@@ -0,0 +1,124 @@
b87039
+/*********************************************************
b87039
+ * Copyright (C) 2020 VMware, Inc. All rights reserved.
b87039
+ *
b87039
+ * This program is free software; you can redistribute it and/or modify it
b87039
+ * under the terms of the GNU Lesser General Public License as published
b87039
+ * by the Free Software Foundation version 2.1 and no later version.
b87039
+ *
b87039
+ * This program is distributed in the hope that it will be useful, but
b87039
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
b87039
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
b87039
+ * License for more details.
b87039
+ *
b87039
+ * You should have received a copy of the GNU Lesser General Public License
b87039
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
b87039
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
b87039
+ *
b87039
+ *********************************************************/
b87039
+
b87039
+/*
b87039
+ * appInfoPosix.c --
b87039
+ *
b87039
+ *      Functions to capture the information about running applications inside
b87039
+ *      a Linux guest.
b87039
+ *
b87039
+ */
b87039
+
b87039
+#ifndef __linux__
b87039
+#   error This file should not be compiled.
b87039
+#endif
b87039
+
b87039
+
b87039
+#include <stdio.h>
b87039
+#include <stdlib.h>
b87039
+#include <string.h>
b87039
+
b87039
+#include "appInfoInt.h"
b87039
+#include "procMgr.h"
b87039
+#include "vmware.h"
b87039
+#include "str.h"
b87039
+#include "util.h"
b87039
+
b87039
+
b87039
+/*
b87039
+ *----------------------------------------------------------------------
b87039
+ * AppInfoGetAppInfo --
b87039
+ *
b87039
+ * Retrieves the application information for a specified process.
b87039
+ *
b87039
+ * @param[in] procInfo   Information about a process.
b87039
+ *
b87039
+ * @retval The application information. The caller must free the memory
b87039
+ *         allocated for the application information.
b87039
+ *         NULL if any error happens.
b87039
+ *
b87039
+ *----------------------------------------------------------------------
b87039
+ */
b87039
+
b87039
+AppInfo *
b87039
+AppInfoGetAppInfo(ProcMgrProcInfo *procInfo)   // IN
b87039
+{
b87039
+   AppInfo *appInfo = NULL;
b87039
+
b87039
+   if (procInfo == NULL) {
b87039
+      return appInfo;
b87039
+   }
b87039
+
b87039
+   if (procInfo->procCmdName == NULL) {
b87039
+      return appInfo;
b87039
+   }
b87039
+
b87039
+   appInfo = Util_SafeMalloc(sizeof (*appInfo) * 1);
b87039
+   appInfo->procId = procInfo->procId;
b87039
+   appInfo->appName = Util_SafeStrdup(procInfo->procCmdName);
b87039
+   appInfo->version = Util_SafeStrdup("");
b87039
+
b87039
+   return appInfo;
b87039
+}
b87039
+
b87039
+
b87039
+/*
b87039
+ *----------------------------------------------------------------------
b87039
+ * AppInfo_GetAppList --
b87039
+ *
b87039
+ * Generates the application information list.
b87039
+ *
b87039
+ * @retval Pointer to the newly allocated application list. The caller must
b87039
+ *         free the memory using AppInfoDestroyAppList function.
b87039
+ *         NULL if any error occurs.
b87039
+ *
b87039
+ *----------------------------------------------------------------------
b87039
+ */
b87039
+
b87039
+GSList *
b87039
+AppInfo_GetAppList(void) {
b87039
+   GSList *appList = NULL;
b87039
+   int i;
b87039
+   ProcMgrProcInfoArray *procList = NULL;
b87039
+   size_t procCount;
b87039
+
b87039
+#if defined(_WIN32)
b87039
+   procList = ProcMgr_ListProcessesEx();
b87039
+#else
b87039
+   procList = ProcMgr_ListProcesses();
b87039
+#endif
b87039
+
b87039
+   if (procList == NULL) {
b87039
+      g_warning("Failed to get the list of processes.\n");
b87039
+      return appList;
b87039
+   }
b87039
+
b87039
+   procCount = ProcMgrProcInfoArray_Count(procList);
b87039
+   for (i = 0; i < procCount; i++) {
b87039
+      AppInfo *appInfo;
b87039
+      ProcMgrProcInfo *procInfo = ProcMgrProcInfoArray_AddressOf(procList, i);
b87039
+      appInfo = AppInfoGetAppInfo(procInfo);
b87039
+      if (NULL != appInfo) {
b87039
+         appList = g_slist_prepend(appList, appInfo);
b87039
+      }
b87039
+   }
b87039
+
b87039
+   ProcMgr_FreeProcList(procList);
b87039
+
b87039
+   return appList;
b87039
+}
b87039
diff --git a/open-vm-tools/services/plugins/appInfo/appInfoUtil.c b/open-vm-tools/services/plugins/appInfo/appInfoUtil.c
b87039
new file mode 100644
b87039
index 0000000..f0327ec
b87039
--- /dev/null
b87039
+++ b/open-vm-tools/services/plugins/appInfo/appInfoUtil.c
b87039
@@ -0,0 +1,143 @@
b87039
+/*********************************************************
b87039
+ * Copyright (C) 2020 VMware, Inc. All rights reserved.
b87039
+ *
b87039
+ * This program is free software; you can redistribute it and/or modify it
b87039
+ * under the terms of the GNU Lesser General Public License as published
b87039
+ * by the Free Software Foundation version 2.1 and no later version.
b87039
+ *
b87039
+ * This program is distributed in the hope that it will be useful, but
b87039
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
b87039
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
b87039
+ * License for more details.
b87039
+ *
b87039
+ * You should have received a copy of the GNU Lesser General Public License
b87039
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
b87039
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
b87039
+ *
b87039
+ *********************************************************/
b87039
+
b87039
+/*
b87039
+ * appInfoUtil.c --
b87039
+ *
b87039
+ *      Utility functions for the application list information.
b87039
+ */
b87039
+
b87039
+
b87039
+#include <stdio.h>
b87039
+#include <stdlib.h>
b87039
+#include "appInfoInt.h"
b87039
+
b87039
+
b87039
+/*
b87039
+ ******************************************************************************
b87039
+ * AppInfoDestroyAppData --
b87039
+ *
b87039
+ * Free function for application data. This function is called by the glib
b87039
+ * for each element in the application list while freeing.
b87039
+ *
b87039
+ * @param[in] data      Pointer to the application data.
b87039
+ *
b87039
+ * @retval NONE
b87039
+ *
b87039
+ ******************************************************************************
b87039
+ */
b87039
+
b87039
+void
b87039
+AppInfoDestroyAppData(gpointer data) {
b87039
+   AppInfo *appInfo = (AppInfo *) data;
b87039
+
b87039
+   if (appInfo == NULL) {
b87039
+      return;
b87039
+   }
b87039
+
b87039
+   free(appInfo->appName);
b87039
+   free(appInfo->version);
b87039
+   free(appInfo);
b87039
+}
b87039
+
b87039
+
b87039
+/*
b87039
+ ******************************************************************************
b87039
+ * AppInfoDestroyAppList --
b87039
+ *
b87039
+ * Frees the entire memory allocated for the application list.
b87039
+ *
b87039
+ * @param[in] appList      Pointer to the application list.
b87039
+ *
b87039
+ * @retval NONE
b87039
+ *
b87039
+ ******************************************************************************
b87039
+ */
b87039
+
b87039
+void
b87039
+AppInfo_DestroyAppList(GSList *appList) {
b87039
+   if (appList == NULL) {
b87039
+      return;
b87039
+   }
b87039
+
b87039
+   g_slist_free_full(appList, AppInfoDestroyAppData);
b87039
+}
b87039
+
b87039
+
b87039
+/*
b87039
+ ******************************************************************************
b87039
+ * AppInfoCompareApps --
b87039
+ *
b87039
+ * Compare function used by glib while sorting the application list.
b87039
+ * For windows guests, the memory used by the application is used for comparing.
b87039
+ * For linux guests, no comparison is done and hence 0 is returned.
b87039
+ *
b87039
+ * @param[in] a      Pointer to the first application that should be compared.
b87039
+ * @param[in] b      Pointer to the second application that should be compared.
b87039
+ *
b87039
+ * @retval -1 if a should be kept before b in the sorted list.
b87039
+ *          0 if both the elements are same.
b87039
+ *          1 if b should be kept before a in the sorted list.
b87039
+ *
b87039
+ ******************************************************************************
b87039
+ */
b87039
+
b87039
+static gint
b87039
+AppInfoCompareApps(gconstpointer a,
b87039
+                   gconstpointer b) {
b87039
+#if defined(_WIN32)
b87039
+   if (a != NULL && b != NULL) {
b87039
+      size_t aMemory = ((AppInfo *) a)->memoryUsed;
b87039
+      size_t bMemory = ((AppInfo *) b)->memoryUsed;
b87039
+      if (aMemory < bMemory) {
b87039
+         return 1;
b87039
+      } else if (aMemory == bMemory) {
b87039
+         return 0;
b87039
+      } else {
b87039
+         return -1;
b87039
+      }
b87039
+   }
b87039
+   return 0;
b87039
+#else
b87039
+   return 0;
b87039
+#endif
b87039
+}
b87039
+
b87039
+
b87039
+/*
b87039
+ ******************************************************************************
b87039
+ * AppInfo_SortAppList --
b87039
+ *
b87039
+ * Sorts the provided list of applications.
b87039
+ *
b87039
+ * @param[in] appList List of applications that need to be sorted.
b87039
+ *
b87039
+ * @retval The sorted list of applications.
b87039
+ *
b87039
+ ******************************************************************************
b87039
+ */
b87039
+
b87039
+GSList *
b87039
+AppInfo_SortAppList(GSList *appList) // IN/OUT
b87039
+{
b87039
+   if (appList == NULL) {
b87039
+      return appList;
b87039
+   }
b87039
+
b87039
+   return g_slist_sort(appList, AppInfoCompareApps);
b87039
+}
b87039
-- 
b87039
1.8.3.1
b87039