Fill in shell functions/files for cooling type.
Change-Id: I8d18d3141e955adeffdd8122ebb17549c88edd77
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/utility.hpp b/utility.hpp
index b37987d..05fe60c 100644
--- a/utility.hpp
+++ b/utility.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <sdbusplus/bus.hpp>
+#include <unistd.h>
namespace phosphor
{
@@ -9,6 +10,37 @@
namespace util
{
+class FileDescriptor
+{
+ public:
+ FileDescriptor() = delete;
+ FileDescriptor(const FileDescriptor&) = delete;
+ FileDescriptor(FileDescriptor&&) = default;
+ FileDescriptor& operator=(const FileDescriptor&) = delete;
+ FileDescriptor& operator=(FileDescriptor&&) = default;
+
+ FileDescriptor(int fd) : fd(fd)
+ {
+ }
+
+ ~FileDescriptor()
+ {
+ if (fd != -1)
+ {
+ close(fd);
+ }
+ }
+
+ bool is_open()
+ {
+ return fd != -1;
+ }
+
+ private:
+ int fd = -1;
+
+};
+
/**
* @brief Get the inventory service name from the mapper object
*