summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorHirokazu Honda <hiroh@chromium.org>2021-06-10 16:50:25 +0900
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-12-04 23:05:03 +0200
commit91436688874a2450c7da22527c59e34c2053b9ef (patch)
treed7220d238db08c90ab37f990a60414483a77d6cf /include
parentedd70612e520f742600ce997f3b4ab0e0d9236c8 (diff)
libcamera: ipc_unixsocket: Use UniqueFD for a file descriptor
IPCUnixSocket::create() creates two file descriptors. One of them is stored in IPCUnixSocket and the other is returned to a caller. This clarifies the ownership using UniqueFD. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/internal/ipc_unixsocket.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/libcamera/internal/ipc_unixsocket.h b/include/libcamera/internal/ipc_unixsocket.h
index 5010b66a..3963d182 100644
--- a/include/libcamera/internal/ipc_unixsocket.h
+++ b/include/libcamera/internal/ipc_unixsocket.h
@@ -12,6 +12,7 @@
#include <vector>
#include <libcamera/base/signal.h>
+#include <libcamera/base/unique_fd.h>
namespace libcamera {
@@ -28,8 +29,8 @@ public:
IPCUnixSocket();
~IPCUnixSocket();
- int create();
- int bind(int fd);
+ UniqueFD create();
+ int bind(UniqueFD fd);
void close();
bool isBound() const;
@@ -49,7 +50,7 @@ private:
void dataNotifier();
- int fd_;
+ UniqueFD fd_;
bool headerReceived_;
struct Header header_;
EventNotifier *notifier_;