summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorHirokazu Honda <hiroh@chromium.org>2021-06-10 16:50:20 +0900
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-12-04 23:05:01 +0200
commitedd70612e520f742600ce997f3b4ab0e0d9236c8 (patch)
tree88168a889c065256437ceb5ae02426c0af06993c /include
parenta59c471e5aa6eb8a8fd99987073aa70acc79f274 (diff)
libcamera: file: Manage fd by UniqueFD
Manages the file descriptor owned by File by UniqueFD. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/base/file.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/libcamera/base/file.h b/include/libcamera/base/file.h
index 55e8edd9..0cdc2ed0 100644
--- a/include/libcamera/base/file.h
+++ b/include/libcamera/base/file.h
@@ -17,6 +17,7 @@
#include <libcamera/base/class.h>
#include <libcamera/base/flags.h>
#include <libcamera/base/span.h>
+#include <libcamera/base/unique_fd.h>
namespace libcamera {
@@ -48,7 +49,7 @@ public:
bool exists() const;
bool open(OpenMode mode);
- bool isOpen() const { return fd_ != -1; }
+ bool isOpen() const { return fd_.isValid(); }
OpenMode openMode() const { return mode_; }
void close();
@@ -73,7 +74,7 @@ private:
void unmapAll();
std::string name_;
- int fd_;
+ UniqueFD fd_;
OpenMode mode_;
int error_;