[{"id":21998,"web_url":"https://patchwork.libcamera.org/comment/21998/","msgid":"<164183286883.10801.17460041103638502773@Monstersaurus>","date":"2022-01-10T16:41:08","subject":"Re: [libcamera-devel] [PATCH v1 2/5] v4l2: v4l2_camera_file: Store\n\tfile description","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2021-12-28 21:59:48)\n> Create a string that describe the file from the path and file\n> descriptor. This will be used in log messages to clearly identify which\n> file an operation is related to.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/v4l2/v4l2_camera_file.cpp    | 28 +++++++++++++++++++++++++++-\n>  src/v4l2/v4l2_camera_file.h      |  8 +++++++-\n>  src/v4l2/v4l2_compat_manager.cpp |  4 +++-\n>  3 files changed, 37 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/v4l2/v4l2_camera_file.cpp b/src/v4l2/v4l2_camera_file.cpp\n> index a07679b587ce..0a41587ca90b 100644\n> --- a/src/v4l2/v4l2_camera_file.cpp\n> +++ b/src/v4l2/v4l2_camera_file.cpp\n> @@ -7,20 +7,46 @@\n>  \n>  #include \"v4l2_camera_file.h\"\n>  \n> +#include <fcntl.h>\n> +#include <stdlib.h>\n> +#include <unistd.h>\n> +\n>  #include <linux/videodev2.h>\n>  \n>  #include \"v4l2_camera_proxy.h\"\n>  \n>  using namespace libcamera;\n>  \n> -V4L2CameraFile::V4L2CameraFile(int efd, bool nonBlocking, V4L2CameraProxy *proxy)\n> +V4L2CameraFile::V4L2CameraFile(int dirfd, const char *path, int efd,\n> +                              bool nonBlocking, V4L2CameraProxy *proxy)\n>         : proxy_(proxy), nonBlocking_(nonBlocking), efd_(efd),\n>           priority_(V4L2_PRIORITY_DEFAULT)\n>  {\n>         proxy_->open(this);\n> +\n> +       if (path[0] != '/') {\n> +               if (dirfd == AT_FDCWD) {\n> +                       char *cwd = getcwd(nullptr, 0);\n> +                       if (cwd) {\n> +                               description_ = std::string(cwd) + \"/\";\n> +                               free(cwd);\n> +                       } else {\n> +                               description_ = std::string(\"(unreachable)/\");\n\nI would have thought this could have been './' but I don't expect it to\nfail in these circumstances. Though saying that, man getcwd() does state\nthat the nullptr,0 parameters are a glibc specific extension - so we\ncould end up with this failing in fact.\n\nSo (unreachable)/ is probably fine, but we could also at that point\nallocate our own memory to actaully obtain it... (or .. use '.').\n\nAnyway, I don't think that's too important here, as it's probably an\nedge case (until someone tests otherwise).\n\nSo,\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> +                       }\n> +               } else {\n> +                       description_ = \"(dirfd:\" + std::to_string(dirfd) + \")/\";\n> +               }\n> +       }\n> +\n> +       description_ += std::string(path) + \" (fd:\" + std::to_string(efd) + \")\";\n>  }\n>  \n>  V4L2CameraFile::~V4L2CameraFile()\n>  {\n>         proxy_->close(this);\n>  }\n> +\n> +const std::string &V4L2CameraFile::description() const\n> +{\n> +       return description_;\n> +}\n> diff --git a/src/v4l2/v4l2_camera_file.h b/src/v4l2/v4l2_camera_file.h\n> index 6c4cb5d89dbf..1a7b6a63ae95 100644\n> --- a/src/v4l2/v4l2_camera_file.h\n> +++ b/src/v4l2/v4l2_camera_file.h\n> @@ -7,6 +7,8 @@\n>  \n>  #pragma once\n>  \n> +#include <string>\n> +\n>  #include <linux/videodev2.h>\n>  \n>  class V4L2CameraProxy;\n> @@ -14,7 +16,8 @@ class V4L2CameraProxy;\n>  class V4L2CameraFile\n>  {\n>  public:\n> -       V4L2CameraFile(int efd, bool nonBlocking, V4L2CameraProxy *proxy);\n> +       V4L2CameraFile(int dirfd, const char *path, int efd, bool nonBlocking,\n> +                      V4L2CameraProxy *proxy);\n>         ~V4L2CameraFile();\n>  \n>         V4L2CameraProxy *proxy() const { return proxy_; }\n> @@ -25,9 +28,12 @@ public:\n>         enum v4l2_priority priority() const { return priority_; }\n>         void setPriority(enum v4l2_priority priority) { priority_ = priority; }\n>  \n> +       const std::string &description() const;\n> +\n>  private:\n>         V4L2CameraProxy *proxy_;\n>  \n> +       std::string description_;\n>         bool nonBlocking_;\n>         int efd_;\n>         enum v4l2_priority priority_;\n> diff --git a/src/v4l2/v4l2_compat_manager.cpp b/src/v4l2/v4l2_compat_manager.cpp\n> index c64cdb862489..585046e97e4b 100644\n> --- a/src/v4l2/v4l2_compat_manager.cpp\n> +++ b/src/v4l2/v4l2_compat_manager.cpp\n> @@ -156,7 +156,9 @@ int V4L2CompatManager::openat(int dirfd, const char *path, int oflag, mode_t mod\n>                 return efd;\n>  \n>         V4L2CameraProxy *proxy = proxies_[ret].get();\n> -       files_.emplace(efd, std::make_shared<V4L2CameraFile>(efd, oflag & O_NONBLOCK, proxy));\n> +       files_.emplace(efd, std::make_shared<V4L2CameraFile>(dirfd, path, efd,\n> +                                                            oflag & O_NONBLOCK,\n> +                                                            proxy));\n>  \n>         LOG(V4L2Compat, Debug) << \"Opened \" << path << \" -> fd \" << efd;\n>         return efd;\n> -- \n> Regards,\n> \n> Laurent Pinchart\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id AEEC9BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 10 Jan 2022 16:41:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 05CE860935;\n\tMon, 10 Jan 2022 17:41:13 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EF0136021A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 10 Jan 2022 17:41:11 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8D9E7A50;\n\tMon, 10 Jan 2022 17:41:11 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"DBHSes8s\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1641832871;\n\tbh=IcCS6DD0Xp7vMHmlK+/mUsIRb84AMS3oViiduTDouEU=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=DBHSes8sPGMUWg/FtVk2ls3e+wAH4/jWSDR/u0l7R3Dhc4jLw4v7Y1xs/xioHW2ZB\n\tFT4oYBYE2aqQe4uTZHxDuLqS/4sTqKeadh2lhYoljTXFXoitURswvCu7LLN96bBvY7\n\tlZ4/nqIp9pU/vdgNVi1PQpKgqbjx6tO137U0jmQY=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20211228215951.32396-3-laurent.pinchart@ideasonboard.com>","References":"<20211228215951.32396-1-laurent.pinchart@ideasonboard.com>\n\t<20211228215951.32396-3-laurent.pinchart@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 10 Jan 2022 16:41:08 +0000","Message-ID":"<164183286883.10801.17460041103638502773@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v1 2/5] v4l2: v4l2_camera_file: Store\n\tfile description","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22003,"web_url":"https://patchwork.libcamera.org/comment/22003/","msgid":"<YdxkYvuckQPv6CFU@pendragon.ideasonboard.com>","date":"2022-01-10T16:52:50","subject":"Re: [libcamera-devel] [PATCH v1 2/5] v4l2: v4l2_camera_file: Store\n\tfile description","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nOn Mon, Jan 10, 2022 at 04:41:08PM +0000, Kieran Bingham wrote:\n> Quoting Laurent Pinchart (2021-12-28 21:59:48)\n> > Create a string that describe the file from the path and file\n> > descriptor. This will be used in log messages to clearly identify which\n> > file an operation is related to.\n> > \n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  src/v4l2/v4l2_camera_file.cpp    | 28 +++++++++++++++++++++++++++-\n> >  src/v4l2/v4l2_camera_file.h      |  8 +++++++-\n> >  src/v4l2/v4l2_compat_manager.cpp |  4 +++-\n> >  3 files changed, 37 insertions(+), 3 deletions(-)\n> > \n> > diff --git a/src/v4l2/v4l2_camera_file.cpp b/src/v4l2/v4l2_camera_file.cpp\n> > index a07679b587ce..0a41587ca90b 100644\n> > --- a/src/v4l2/v4l2_camera_file.cpp\n> > +++ b/src/v4l2/v4l2_camera_file.cpp\n> > @@ -7,20 +7,46 @@\n> >  \n> >  #include \"v4l2_camera_file.h\"\n> >  \n> > +#include <fcntl.h>\n> > +#include <stdlib.h>\n> > +#include <unistd.h>\n> > +\n> >  #include <linux/videodev2.h>\n> >  \n> >  #include \"v4l2_camera_proxy.h\"\n> >  \n> >  using namespace libcamera;\n> >  \n> > -V4L2CameraFile::V4L2CameraFile(int efd, bool nonBlocking, V4L2CameraProxy *proxy)\n> > +V4L2CameraFile::V4L2CameraFile(int dirfd, const char *path, int efd,\n> > +                              bool nonBlocking, V4L2CameraProxy *proxy)\n> >         : proxy_(proxy), nonBlocking_(nonBlocking), efd_(efd),\n> >           priority_(V4L2_PRIORITY_DEFAULT)\n> >  {\n> >         proxy_->open(this);\n> > +\n> > +       if (path[0] != '/') {\n> > +               if (dirfd == AT_FDCWD) {\n> > +                       char *cwd = getcwd(nullptr, 0);\n> > +                       if (cwd) {\n> > +                               description_ = std::string(cwd) + \"/\";\n> > +                               free(cwd);\n> > +                       } else {\n> > +                               description_ = std::string(\"(unreachable)/\");\n> \n> I would have thought this could have been './' but I don't expect it to\n> fail in these circumstances. Though saying that, man getcwd() does state\n> that the nullptr,0 parameters are a glibc specific extension - so we\n> could end up with this failing in fact.\n\nI've checked uclibc, musl and bionic, and they all implement the\nextension, so I think we're good.\n\n> So (unreachable)/ is probably fine, but we could also at that point\n> allocate our own memory to actaully obtain it... (or .. use '.').\n\nThe \"(unreachable)\" name, by the way, comes from Linux 2.6.36 that uses\nthat prefix when the current directory is not below the root directory\nof the current process. In any case, I don't ever expect users to see\nthis.\n\n> Anyway, I don't think that's too important here, as it's probably an\n> edge case (until someone tests otherwise).\n> \n> So,\n> \n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> > +                       }\n> > +               } else {\n> > +                       description_ = \"(dirfd:\" + std::to_string(dirfd) + \")/\";\n> > +               }\n> > +       }\n> > +\n> > +       description_ += std::string(path) + \" (fd:\" + std::to_string(efd) + \")\";\n> >  }\n> >  \n> >  V4L2CameraFile::~V4L2CameraFile()\n> >  {\n> >         proxy_->close(this);\n> >  }\n> > +\n> > +const std::string &V4L2CameraFile::description() const\n> > +{\n> > +       return description_;\n> > +}\n> > diff --git a/src/v4l2/v4l2_camera_file.h b/src/v4l2/v4l2_camera_file.h\n> > index 6c4cb5d89dbf..1a7b6a63ae95 100644\n> > --- a/src/v4l2/v4l2_camera_file.h\n> > +++ b/src/v4l2/v4l2_camera_file.h\n> > @@ -7,6 +7,8 @@\n> >  \n> >  #pragma once\n> >  \n> > +#include <string>\n> > +\n> >  #include <linux/videodev2.h>\n> >  \n> >  class V4L2CameraProxy;\n> > @@ -14,7 +16,8 @@ class V4L2CameraProxy;\n> >  class V4L2CameraFile\n> >  {\n> >  public:\n> > -       V4L2CameraFile(int efd, bool nonBlocking, V4L2CameraProxy *proxy);\n> > +       V4L2CameraFile(int dirfd, const char *path, int efd, bool nonBlocking,\n> > +                      V4L2CameraProxy *proxy);\n> >         ~V4L2CameraFile();\n> >  \n> >         V4L2CameraProxy *proxy() const { return proxy_; }\n> > @@ -25,9 +28,12 @@ public:\n> >         enum v4l2_priority priority() const { return priority_; }\n> >         void setPriority(enum v4l2_priority priority) { priority_ = priority; }\n> >  \n> > +       const std::string &description() const;\n> > +\n> >  private:\n> >         V4L2CameraProxy *proxy_;\n> >  \n> > +       std::string description_;\n> >         bool nonBlocking_;\n> >         int efd_;\n> >         enum v4l2_priority priority_;\n> > diff --git a/src/v4l2/v4l2_compat_manager.cpp b/src/v4l2/v4l2_compat_manager.cpp\n> > index c64cdb862489..585046e97e4b 100644\n> > --- a/src/v4l2/v4l2_compat_manager.cpp\n> > +++ b/src/v4l2/v4l2_compat_manager.cpp\n> > @@ -156,7 +156,9 @@ int V4L2CompatManager::openat(int dirfd, const char *path, int oflag, mode_t mod\n> >                 return efd;\n> >  \n> >         V4L2CameraProxy *proxy = proxies_[ret].get();\n> > -       files_.emplace(efd, std::make_shared<V4L2CameraFile>(efd, oflag & O_NONBLOCK, proxy));\n> > +       files_.emplace(efd, std::make_shared<V4L2CameraFile>(dirfd, path, efd,\n> > +                                                            oflag & O_NONBLOCK,\n> > +                                                            proxy));\n> >  \n> >         LOG(V4L2Compat, Debug) << \"Opened \" << path << \" -> fd \" << efd;\n> >         return efd;","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id E0453BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 10 Jan 2022 16:53:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4284660935;\n\tMon, 10 Jan 2022 17:53:01 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BEE2D6021A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 10 Jan 2022 17:52:59 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 31772A50;\n\tMon, 10 Jan 2022 17:52:59 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"BVZKtX8U\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1641833579;\n\tbh=kywdXPDya+BZaaEH4lEFNYBKYmUesIgVln/zndZL65U=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=BVZKtX8UrWoLZBN0HHG9/FRZz62gH3CcjPfo65BM5girR4uVFTacV3WIBwy/DLufK\n\tuaG/KMyEs8C+IdzTXHRlJ8tJIbkytYJmBklbB6oz+RyTm/j0RJy7gKJOiIQ94WUItH\n\tUypLgY0xDZE9nFFDiQ3KcVKI5MAaEu96XZREGqgg=","Date":"Mon, 10 Jan 2022 18:52:50 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<YdxkYvuckQPv6CFU@pendragon.ideasonboard.com>","References":"<20211228215951.32396-1-laurent.pinchart@ideasonboard.com>\n\t<20211228215951.32396-3-laurent.pinchart@ideasonboard.com>\n\t<164183286883.10801.17460041103638502773@Monstersaurus>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<164183286883.10801.17460041103638502773@Monstersaurus>","Subject":"Re: [libcamera-devel] [PATCH v1 2/5] v4l2: v4l2_camera_file: Store\n\tfile description","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22029,"web_url":"https://patchwork.libcamera.org/comment/22029/","msgid":"<20220114104037.GD4255@pyrite.rasen.tech>","date":"2022-01-14T10:40:37","subject":"Re: [libcamera-devel] [PATCH v1 2/5] v4l2: v4l2_camera_file: Store\n\tfile description","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Laurent,\n\nOn Tue, Dec 28, 2021 at 11:59:48PM +0200, Laurent Pinchart wrote:\n> Create a string that describe the file from the path and file\n> descriptor. This will be used in log messages to clearly identify which\n> file an operation is related to.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/v4l2/v4l2_camera_file.cpp    | 28 +++++++++++++++++++++++++++-\n>  src/v4l2/v4l2_camera_file.h      |  8 +++++++-\n>  src/v4l2/v4l2_compat_manager.cpp |  4 +++-\n>  3 files changed, 37 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/v4l2/v4l2_camera_file.cpp b/src/v4l2/v4l2_camera_file.cpp\n> index a07679b587ce..0a41587ca90b 100644\n> --- a/src/v4l2/v4l2_camera_file.cpp\n> +++ b/src/v4l2/v4l2_camera_file.cpp\n> @@ -7,20 +7,46 @@\n>  \n>  #include \"v4l2_camera_file.h\"\n>  \n> +#include <fcntl.h>\n> +#include <stdlib.h>\n> +#include <unistd.h>\n> +\n>  #include <linux/videodev2.h>\n>  \n>  #include \"v4l2_camera_proxy.h\"\n>  \n>  using namespace libcamera;\n>  \n> -V4L2CameraFile::V4L2CameraFile(int efd, bool nonBlocking, V4L2CameraProxy *proxy)\n> +V4L2CameraFile::V4L2CameraFile(int dirfd, const char *path, int efd,\n> +\t\t\t       bool nonBlocking, V4L2CameraProxy *proxy)\n>  \t: proxy_(proxy), nonBlocking_(nonBlocking), efd_(efd),\n>  \t  priority_(V4L2_PRIORITY_DEFAULT)\n>  {\n>  \tproxy_->open(this);\n> +\n> +\tif (path[0] != '/') {\n> +\t\tif (dirfd == AT_FDCWD) {\n> +\t\t\tchar *cwd = getcwd(nullptr, 0);\n> +\t\t\tif (cwd) {\n> +\t\t\t\tdescription_ = std::string(cwd) + \"/\";\n> +\t\t\t\tfree(cwd);\n> +\t\t\t} else {\n> +\t\t\t\tdescription_ = std::string(\"(unreachable)/\");\n> +\t\t\t}\n> +\t\t} else {\n> +\t\t\tdescription_ = \"(dirfd:\" + std::to_string(dirfd) + \")/\";\n> +\t\t}\n> +\t}\n> +\n> +\tdescription_ += std::string(path) + \" (fd:\" + std::to_string(efd) + \")\";\n>  }\n>  \n>  V4L2CameraFile::~V4L2CameraFile()\n>  {\n>  \tproxy_->close(this);\n>  }\n> +\n> +const std::string &V4L2CameraFile::description() const\n> +{\n> +\treturn description_;\n> +}\n> diff --git a/src/v4l2/v4l2_camera_file.h b/src/v4l2/v4l2_camera_file.h\n> index 6c4cb5d89dbf..1a7b6a63ae95 100644\n> --- a/src/v4l2/v4l2_camera_file.h\n> +++ b/src/v4l2/v4l2_camera_file.h\n> @@ -7,6 +7,8 @@\n>  \n>  #pragma once\n>  \n> +#include <string>\n> +\n>  #include <linux/videodev2.h>\n>  \n>  class V4L2CameraProxy;\n> @@ -14,7 +16,8 @@ class V4L2CameraProxy;\n>  class V4L2CameraFile\n>  {\n>  public:\n> -\tV4L2CameraFile(int efd, bool nonBlocking, V4L2CameraProxy *proxy);\n> +\tV4L2CameraFile(int dirfd, const char *path, int efd, bool nonBlocking,\n> +\t\t       V4L2CameraProxy *proxy);\n>  \t~V4L2CameraFile();\n>  \n>  \tV4L2CameraProxy *proxy() const { return proxy_; }\n> @@ -25,9 +28,12 @@ public:\n>  \tenum v4l2_priority priority() const { return priority_; }\n>  \tvoid setPriority(enum v4l2_priority priority) { priority_ = priority; }\n>  \n> +\tconst std::string &description() const;\n> +\n>  private:\n>  \tV4L2CameraProxy *proxy_;\n>  \n> +\tstd::string description_;\n>  \tbool nonBlocking_;\n>  \tint efd_;\n>  \tenum v4l2_priority priority_;\n> diff --git a/src/v4l2/v4l2_compat_manager.cpp b/src/v4l2/v4l2_compat_manager.cpp\n> index c64cdb862489..585046e97e4b 100644\n> --- a/src/v4l2/v4l2_compat_manager.cpp\n> +++ b/src/v4l2/v4l2_compat_manager.cpp\n> @@ -156,7 +156,9 @@ int V4L2CompatManager::openat(int dirfd, const char *path, int oflag, mode_t mod\n>  \t\treturn efd;\n>  \n>  \tV4L2CameraProxy *proxy = proxies_[ret].get();\n> -\tfiles_.emplace(efd, std::make_shared<V4L2CameraFile>(efd, oflag & O_NONBLOCK, proxy));\n> +\tfiles_.emplace(efd, std::make_shared<V4L2CameraFile>(dirfd, path, efd,\n> +\t\t\t\t\t\t\t     oflag & O_NONBLOCK,\n> +\t\t\t\t\t\t\t     proxy));\n>  \n>  \tLOG(V4L2Compat, Debug) << \"Opened \" << path << \" -> fd \" << efd;\n>  \treturn efd;\n> -- \n> Regards,\n> \n> Laurent Pinchart\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 67B23BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 14 Jan 2022 10:40:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B3EE86017D;\n\tFri, 14 Jan 2022 11:40:48 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9FDAB6017D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Jan 2022 11:40:46 +0100 (CET)","from pyrite.rasen.tech (h175-177-042-148.catv02.itscom.jp\n\t[175.177.42.148])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3254BA2A;\n\tFri, 14 Jan 2022 11:40:44 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"vm086+cj\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1642156846;\n\tbh=IFYzreUCTJ9p7UpWihFZWOMesuQziEFNcVZDuJVG5yU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=vm086+cjbA5ucXymgg+NssGeYB+s28augDSB/RGfTk77ORrBBiGyWrFTbKpT+QT5V\n\tn6IIcN0nN1wZfuUHnorhiwGiR0tHpnYQeGt8fOzDT31tP+lE4/CYqszipBRXg9j/Dv\n\t8GSjilAFNFqIe21B4M1TStJZXXsQzi1hTA6jXxrc=","Date":"Fri, 14 Jan 2022 19:40:37 +0900","From":"paul.elder@ideasonboard.com","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20220114104037.GD4255@pyrite.rasen.tech>","References":"<20211228215951.32396-1-laurent.pinchart@ideasonboard.com>\n\t<20211228215951.32396-3-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20211228215951.32396-3-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v1 2/5] v4l2: v4l2_camera_file: Store\n\tfile description","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]