summaryrefslogtreecommitdiff
path: root/src/libcamera/base/file_descriptor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcamera/base/file_descriptor.cpp')
-rw-r--r--src/libcamera/base/file_descriptor.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libcamera/base/file_descriptor.cpp b/src/libcamera/base/file_descriptor.cpp
index 98d4b4bf..da696b25 100644
--- a/src/libcamera/base/file_descriptor.cpp
+++ b/src/libcamera/base/file_descriptor.cpp
@@ -13,6 +13,7 @@
#include <utility>
#include <libcamera/base/log.h>
+#include <libcamera/base/unique_fd.h>
/**
* \file base/file_descriptor.h
@@ -110,6 +111,18 @@ FileDescriptor::FileDescriptor(int &&fd)
}
/**
+ * \brief Create a FileDescriptor taking ownership of a given UniqueFD \a fd
+ * \param[in] fd UniqueFD
+ *
+ * Construct a FileDescriptor from UniqueFD by taking ownership of the \a fd.
+ * The original \a fd becomes invalid.
+ */
+FileDescriptor::FileDescriptor(UniqueFD fd)
+ : FileDescriptor(fd.release())
+{
+}
+
+/**
* \brief Copy constructor, create a FileDescriptor from a copy of \a other
* \param[in] other The other FileDescriptor
*