PEL: Save process name in a UserData section

When creating a new PEL, add a UserData section that contains various
pieces of system information that will be saved in every error log.

In this first commit, just save the process name of the creator,
provided they passed in the '_PID' AdditionalData item containing their
PID.

Future commits will add other items like certain D-Bus properties.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I7139b4056e494277ff3388bfa8a00002c9c89dc1
diff --git a/extensions/openpower-pels/data_interface.hpp b/extensions/openpower-pels/data_interface.hpp
index 88c590a..e690542 100644
--- a/extensions/openpower-pels/data_interface.hpp
+++ b/extensions/openpower-pels/data_interface.hpp
@@ -1,5 +1,6 @@
 #pragma once
 
+#include <filesystem>
 #include <phosphor-logging/log.hpp>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/bus/match.hpp>
@@ -135,6 +136,28 @@
         return _serverFWVersion;
     }
 
+    /**
+     * @brief Returns the process name given its PID.
+     *
+     * @param[in] pid - The PID value as a string
+     *
+     * @return std::optional<std::string> - The name, or std::nullopt
+     */
+    std::optional<std::string> getProcessName(const std::string& pid) const
+    {
+        namespace fs = std::filesystem;
+
+        fs::path path{"/proc"};
+        path /= fs::path{pid} / "exe";
+
+        if (fs::exists(path))
+        {
+            return fs::read_symlink(path);
+        }
+
+        return std::nullopt;
+    }
+
   protected:
     /**
      * @brief Sets the host on/off state and runs any