summaryrefslogtreecommitdiff
path: root/test/v4l2_compat/meson.build
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2020-08-26 17:26:47 +0900
committerPaul Elder <paul.elder@ideasonboard.com>2020-10-07 19:17:31 +0900
commit1469d5e26e27bf5fe4d065a6f3c87edd804f2888 (patch)
tree2ffd4611a917ef4f6a375609e607e749d04d65b2 /test/v4l2_compat/meson.build
parent7e59bccb35015dea1a3ce6c50efb0cc23157060f (diff)
libcamera: ProcessManager: make ProcessManager lifetime explicitly managed
If any Process instances are destroyed after the ProcessManager is destroyed, then a segfault will occur. Fix this by making the lifetime of the ProcessManager explicit, and make the CameraManager construct and deconstruct (automatically, via a member variable) the ProcessManager. Update the tests accordingly. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
n class="hl opt">= int (*)(int dirfd, const char *path, int oflag, ...); using dup_func_t = int (*)(int oldfd); using close_func_t = int (*)(int fd); using ioctl_func_t = int (*)(int fd, unsigned long request, ...); using mmap_func_t = void *(*)(void *addr, size_t length, int prot, int flags, int fd, off64_t offset); using munmap_func_t = int (*)(void *addr, size_t length); openat_func_t openat; dup_func_t dup; close_func_t close; ioctl_func_t ioctl; mmap_func_t mmap; munmap_func_t munmap; }; static V4L2CompatManager *instance(); const FileOperations &fops() const { return fops_; } int openat(int dirfd, const char *path, int oflag, mode_t mode); int dup(int oldfd); int close(int fd); void *mmap(void *addr, size_t length, int prot, int flags, int fd, off64_t offset); int munmap(void *addr, size_t length); int ioctl(int fd, unsigned long request, void *arg); private: V4L2CompatManager(); ~V4L2CompatManager(); int start(); int getCameraIndex(int fd); std::shared_ptr<V4L2CameraFile> cameraFile(int fd); FileOperations fops_; libcamera::CameraManager *cm_; std::vector<std::unique_ptr<V4L2CameraProxy>> proxies_; std::map<int, std::shared_ptr<V4L2CameraFile>> files_; std::map<void *, std::shared_ptr<V4L2CameraFile>> mmaps_; };