[{"id":21327,"web_url":"https://patchwork.libcamera.org/comment/21327/","msgid":"<CAO5uPHOTkE83Eraz2KbMNBKCzYC4ijouQpWe2p09ioemOGGxtA@mail.gmail.com>","date":"2021-11-29T14:05:51","subject":"Re: [libcamera-devel] [PATCH v3 07/17] libcamera: base:\n\tfile_descriptor: Return UniqueFD from dup()","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"Hi Laurent, thank you for the patch.\n\nOn Mon, Nov 29, 2021 at 8:58 AM Laurent Pinchart\n<laurent.pinchart@ideasonboard.com> wrote:\n>\n> The dup() function returns a duplicate of the file descriptor. Wrapping\n> it in a FileDescriptor isn't wrong as such, but it prevents from using\n> it in contexts where a UniqueFD is needed. As the duplicate is\n> guaranteed to have a single owner when created, return it as a UniqueFD\n> instead. A FileDescriptor can easily be created from the UniqueFD if\n> desired.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nI think this is a correct change.\nAlthough I have no idea when dup() should be used.\nIn fact, there seems to be no code calling FileDescriptor::dup().\nDo you have any idea?\n\nThanks,\n-Hiro\n> ---\n>  include/libcamera/base/file_descriptor.h |  2 +-\n>  src/libcamera/base/file_descriptor.cpp   | 22 ++++++++++++++--------\n>  2 files changed, 15 insertions(+), 9 deletions(-)\n>\n> diff --git a/include/libcamera/base/file_descriptor.h b/include/libcamera/base/file_descriptor.h\n> index 74292eba04f5..12a43f95d414 100644\n> --- a/include/libcamera/base/file_descriptor.h\n> +++ b/include/libcamera/base/file_descriptor.h\n> @@ -28,7 +28,7 @@ public:\n>\n>         bool isValid() const { return fd_ != nullptr; }\n>         int fd() const { return fd_ ? fd_->fd() : -1; }\n> -       FileDescriptor dup() const;\n> +       UniqueFD dup() const;\n>\n>  private:\n>         class Descriptor\n> diff --git a/src/libcamera/base/file_descriptor.cpp b/src/libcamera/base/file_descriptor.cpp\n> index da696b2501cd..a83bf52c31e6 100644\n> --- a/src/libcamera/base/file_descriptor.cpp\n> +++ b/src/libcamera/base/file_descriptor.cpp\n> @@ -222,17 +222,23 @@ FileDescriptor &FileDescriptor::operator=(FileDescriptor &&other)\n>   * \\brief Duplicate a FileDescriptor\n>   *\n>   * Duplicating a FileDescriptor creates a duplicate of the wrapped file\n> - * descriptor and returns a new FileDescriptor instance that wraps the\n> - * duplicate. The fd() function of the original and duplicate instances will\n> - * return different values. The duplicate instance will not be affected by\n> - * destruction of the original instance or its copies.\n> + * descriptor and returns a UniqueFD that owns the duplicate. The fd() function\n> + * of the original and the get() function of the duplicate will return different\n> + * values. The duplicate instance will not be affected by destruction of the\n> + * original instance or its copies.\n>   *\n> - * \\return A new FileDescriptor instance wrapping a duplicate of the original\n> - * file descriptor\n> + * \\return A UniqueFD owning a duplicate of the original file descriptor\n>   */\n> -FileDescriptor FileDescriptor::dup() const\n> +UniqueFD FileDescriptor::dup() const\n>  {\n> -       return FileDescriptor(fd());\n> +       int dupFd = ::dup(fd());\n> +       if (dupFd == -1) {\n> +               int ret = -errno;\n> +               LOG(FileDescriptor, Error)\n> +                       << \"Failed to dup() fd: \" << strerror(-ret);\n> +       }\n> +\n> +       return UniqueFD(dupFd);\n>  }\n>\n>  FileDescriptor::Descriptor::Descriptor(int fd, bool duplicate)\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 08ED9BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Nov 2021 14:06:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AD862605A4;\n\tMon, 29 Nov 2021 15:06:07 +0100 (CET)","from mail-ed1-x535.google.com (mail-ed1-x535.google.com\n\t[IPv6:2a00:1450:4864:20::535])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 695D060592\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 15:06:05 +0100 (CET)","by mail-ed1-x535.google.com with SMTP id r25so7101437edq.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 06:06:05 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"N5ywPXs1\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=52VxTXkwZCRYsSQ9NRCYD8o3vAMqP9J19BuF7XiQkpA=;\n\tb=N5ywPXs1huz+YGYqvp3vmIj/TV6IqhjMuxudK6ckSdOTmxQ7HfEyubQlqvgk9qeh4q\n\tTRX2qyidU2p/UnlU/Oeky/9gRNXfpeqoMi0Amo8jnDihBBwdcyMGQHK3jVleVraBs9s6\n\tEPDhnmaPAkh3HVs37ivQ2yqijEteTInZI5WVY=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=52VxTXkwZCRYsSQ9NRCYD8o3vAMqP9J19BuF7XiQkpA=;\n\tb=bP4mKe6Tl93Z4gqqcrD0Fl1urFs6r0gobut7ygWjGKHlxFnr2S9qSQIoNcNOve3HZP\n\tjyms6OYw4jUkxGwlkJRMnCtlxX2viI3YIBHpjKXpSKsUCx1gGuB5X7iZox2u6s8EDzCA\n\tWfO3GGmc6U3jokXRiLLJvC4UJ6poQW7oNHH/QrwaV6lWN0CMXGfJt3RGefl56tcxSbA+\n\tdXIncNl3FoDkhCX13lfjFPf9oiBcv5d+yM28bQXRMzleUxOZz5ghzAqgu5nhAvwK7PTQ\n\txL5LOAeVk1iIxlaoveWd0vltgUP2dGGuVQ1XjAOxAa1X/tYgk+rqRMWdMUE24XRJtcUh\n\t6HOg==","X-Gm-Message-State":"AOAM530nf4nY82Hj6VzCf5Fc5qw8u3Exf6YQlSgFwyuUeCShlzdxgM5w\n\tdkucW0IEODDWj8+2lsz5Qj7ZBuB10kcOc8n/97f28w==","X-Google-Smtp-Source":"ABdhPJyvFHfN6m0PMQ3KzlMkFU+zfn7TfIqFKyu5Nl69bYDM68Gq7EClsjUpi9KU5LGPs6S1CbazuMPBFPyE5s+QwyY=","X-Received":"by 2002:a05:6402:1395:: with SMTP id\n\tb21mr76155013edv.299.1638194762601; \n\tMon, 29 Nov 2021 06:06:02 -0800 (PST)","MIME-Version":"1.0","References":"<20211128235752.10836-1-laurent.pinchart@ideasonboard.com>\n\t<20211128235752.10836-8-laurent.pinchart@ideasonboard.com>","In-Reply-To":"<20211128235752.10836-8-laurent.pinchart@ideasonboard.com>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Mon, 29 Nov 2021 23:05:51 +0900","Message-ID":"<CAO5uPHOTkE83Eraz2KbMNBKCzYC4ijouQpWe2p09ioemOGGxtA@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v3 07/17] libcamera: base:\n\tfile_descriptor: Return UniqueFD from dup()","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":21336,"web_url":"https://patchwork.libcamera.org/comment/21336/","msgid":"<20211129151233.gx57nc6ikbwkgfsy@uno.localdomain>","date":"2021-11-29T15:12:33","subject":"Re: [libcamera-devel] [PATCH v3 07/17] libcamera: base:\n\tfile_descriptor: Return UniqueFD from dup()","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent\n\nOn Mon, Nov 29, 2021 at 01:57:42AM +0200, Laurent Pinchart wrote:\n> The dup() function returns a duplicate of the file descriptor. Wrapping\n> it in a FileDescriptor isn't wrong as such, but it prevents from using\n> it in contexts where a UniqueFD is needed. As the duplicate is\n> guaranteed to have a single owner when created, return it as a UniqueFD\n> instead. A FileDescriptor can easily be created from the UniqueFD if\n> desired.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  include/libcamera/base/file_descriptor.h |  2 +-\n>  src/libcamera/base/file_descriptor.cpp   | 22 ++++++++++++++--------\n>  2 files changed, 15 insertions(+), 9 deletions(-)\n>\n> diff --git a/include/libcamera/base/file_descriptor.h b/include/libcamera/base/file_descriptor.h\n> index 74292eba04f5..12a43f95d414 100644\n> --- a/include/libcamera/base/file_descriptor.h\n> +++ b/include/libcamera/base/file_descriptor.h\n> @@ -28,7 +28,7 @@ public:\n>\n>  \tbool isValid() const { return fd_ != nullptr; }\n>  \tint fd() const { return fd_ ? fd_->fd() : -1; }\n> -\tFileDescriptor dup() const;\n> +\tUniqueFD dup() const;\n>\n>  private:\n>  \tclass Descriptor\n> diff --git a/src/libcamera/base/file_descriptor.cpp b/src/libcamera/base/file_descriptor.cpp\n> index da696b2501cd..a83bf52c31e6 100644\n> --- a/src/libcamera/base/file_descriptor.cpp\n> +++ b/src/libcamera/base/file_descriptor.cpp\n> @@ -222,17 +222,23 @@ FileDescriptor &FileDescriptor::operator=(FileDescriptor &&other)\n>   * \\brief Duplicate a FileDescriptor\n>   *\n>   * Duplicating a FileDescriptor creates a duplicate of the wrapped file\n> - * descriptor and returns a new FileDescriptor instance that wraps the\n> - * duplicate. The fd() function of the original and duplicate instances will\n> - * return different values. The duplicate instance will not be affected by\n> - * destruction of the original instance or its copies.\n> + * descriptor and returns a UniqueFD that owns the duplicate. The fd() function\n> + * of the original and the get() function of the duplicate will return different\n\nJust noticed that we now have:\n        SharedFD::fd()\n        UniqueFD::get()\n\nShould the two be named the same ?\n\n> + * values. The duplicate instance will not be affected by destruction of the\n> + * original instance or its copies.\n>   *\n> - * \\return A new FileDescriptor instance wrapping a duplicate of the original\n> - * file descriptor\n> + * \\return A UniqueFD owning a duplicate of the original file descriptor\n>   */\n> -FileDescriptor FileDescriptor::dup() const\n> +UniqueFD FileDescriptor::dup() const\n>  {\n> -\treturn FileDescriptor(fd());\n> +\tint dupFd = ::dup(fd());\n> +\tif (dupFd == -1) {\n> +\t\tint ret = -errno;\n\nAs we don't need to return ret this can simply be\n                in ret = errno;\n\n> +\t\tLOG(FileDescriptor, Error)\n> +\t\t\t<< \"Failed to dup() fd: \" << strerror(-ret);\n\nand\n                                                  << strerror(ret);\n\n> +\t}\n> +\n> +\treturn UniqueFD(dupFd);\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n   j\n\n>  }\n>\n>  FileDescriptor::Descriptor::Descriptor(int fd, bool duplicate)\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 ECE5BBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Nov 2021 15:11:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 43DFC605A5;\n\tMon, 29 Nov 2021 16:11:43 +0100 (CET)","from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 72FCB6059E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 16:11:41 +0100 (CET)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id D1D06100012;\n\tMon, 29 Nov 2021 15:11:40 +0000 (UTC)"],"Date":"Mon, 29 Nov 2021 16:12:33 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20211129151233.gx57nc6ikbwkgfsy@uno.localdomain>","References":"<20211128235752.10836-1-laurent.pinchart@ideasonboard.com>\n\t<20211128235752.10836-8-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211128235752.10836-8-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 07/17] libcamera: base:\n\tfile_descriptor: Return UniqueFD from dup()","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":21355,"web_url":"https://patchwork.libcamera.org/comment/21355/","msgid":"<YaUDlpE857oj6h4N@pendragon.ideasonboard.com>","date":"2021-11-29T16:45:10","subject":"Re: [libcamera-devel] [PATCH v3 07/17] libcamera: base:\n\tfile_descriptor: Return UniqueFD from dup()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Mon, Nov 29, 2021 at 04:12:33PM +0100, Jacopo Mondi wrote:\n> On Mon, Nov 29, 2021 at 01:57:42AM +0200, Laurent Pinchart wrote:\n> > The dup() function returns a duplicate of the file descriptor. Wrapping\n> > it in a FileDescriptor isn't wrong as such, but it prevents from using\n> > it in contexts where a UniqueFD is needed. As the duplicate is\n> > guaranteed to have a single owner when created, return it as a UniqueFD\n> > instead. A FileDescriptor can easily be created from the UniqueFD if\n> > desired.\n> >\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  include/libcamera/base/file_descriptor.h |  2 +-\n> >  src/libcamera/base/file_descriptor.cpp   | 22 ++++++++++++++--------\n> >  2 files changed, 15 insertions(+), 9 deletions(-)\n> >\n> > diff --git a/include/libcamera/base/file_descriptor.h b/include/libcamera/base/file_descriptor.h\n> > index 74292eba04f5..12a43f95d414 100644\n> > --- a/include/libcamera/base/file_descriptor.h\n> > +++ b/include/libcamera/base/file_descriptor.h\n> > @@ -28,7 +28,7 @@ public:\n> >\n> >  \tbool isValid() const { return fd_ != nullptr; }\n> >  \tint fd() const { return fd_ ? fd_->fd() : -1; }\n> > -\tFileDescriptor dup() const;\n> > +\tUniqueFD dup() const;\n> >\n> >  private:\n> >  \tclass Descriptor\n> > diff --git a/src/libcamera/base/file_descriptor.cpp b/src/libcamera/base/file_descriptor.cpp\n> > index da696b2501cd..a83bf52c31e6 100644\n> > --- a/src/libcamera/base/file_descriptor.cpp\n> > +++ b/src/libcamera/base/file_descriptor.cpp\n> > @@ -222,17 +222,23 @@ FileDescriptor &FileDescriptor::operator=(FileDescriptor &&other)\n> >   * \\brief Duplicate a FileDescriptor\n> >   *\n> >   * Duplicating a FileDescriptor creates a duplicate of the wrapped file\n> > - * descriptor and returns a new FileDescriptor instance that wraps the\n> > - * duplicate. The fd() function of the original and duplicate instances will\n> > - * return different values. The duplicate instance will not be affected by\n> > - * destruction of the original instance or its copies.\n> > + * descriptor and returns a UniqueFD that owns the duplicate. The fd() function\n> > + * of the original and the get() function of the duplicate will return different\n> \n> Just noticed that we now have:\n>         SharedFD::fd()\n>         UniqueFD::get()\n> \n> Should the two be named the same ?\n\nI think it would make sense, yes. But that brings a question: which of\nthe two should we use ? :-)\n\n> > + * values. The duplicate instance will not be affected by destruction of the\n> > + * original instance or its copies.\n> >   *\n> > - * \\return A new FileDescriptor instance wrapping a duplicate of the original\n> > - * file descriptor\n> > + * \\return A UniqueFD owning a duplicate of the original file descriptor\n> >   */\n> > -FileDescriptor FileDescriptor::dup() const\n> > +UniqueFD FileDescriptor::dup() const\n> >  {\n> > -\treturn FileDescriptor(fd());\n> > +\tint dupFd = ::dup(fd());\n> > +\tif (dupFd == -1) {\n> > +\t\tint ret = -errno;\n> \n> As we don't need to return ret this can simply be\n>                 in ret = errno;\n> \n> > +\t\tLOG(FileDescriptor, Error)\n> > +\t\t\t<< \"Failed to dup() fd: \" << strerror(-ret);\n> \n> and\n>                                                   << strerror(ret);\n\nIndeed. I'm tempted to keep the current pattern though, to avoid making\nthis a special case, but if you think it would be better, I'll change\nit.\n\n> > +\t}\n> > +\n> > +\treturn UniqueFD(dupFd);\n> \n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> \n> >  }\n> >\n> >  FileDescriptor::Descriptor::Descriptor(int fd, bool duplicate)","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 C6513BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Nov 2021 16:45:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 288DF605A6;\n\tMon, 29 Nov 2021 17:45:36 +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 5478460592\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 17:45:34 +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 B49FE2A5;\n\tMon, 29 Nov 2021 17:45:33 +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=\"Su7w+j+a\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1638204333;\n\tbh=1bzJyD+6Gs5wFRvgA2UiKeESBSSuNa8PzBPs1QVC+2Y=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Su7w+j+aMF/zBRCN81iZPnBVcziuHDofHyn5fjwSziY3aVybhCnCFLkX5t7y2qef3\n\tRjKPgOdCn3L3iMVrMiu2/XUdGWfExi6kGLwAwiaoG2rs6Ar2gJC/EU32IWODy3DEOD\n\tWj+wEqnIgPfcYRk3QixAto1H7qY2zY64VRx/JMgE=","Date":"Mon, 29 Nov 2021 18:45:10 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YaUDlpE857oj6h4N@pendragon.ideasonboard.com>","References":"<20211128235752.10836-1-laurent.pinchart@ideasonboard.com>\n\t<20211128235752.10836-8-laurent.pinchart@ideasonboard.com>\n\t<20211129151233.gx57nc6ikbwkgfsy@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211129151233.gx57nc6ikbwkgfsy@uno.localdomain>","Subject":"Re: [libcamera-devel] [PATCH v3 07/17] libcamera: base:\n\tfile_descriptor: Return UniqueFD from dup()","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":21366,"web_url":"https://patchwork.libcamera.org/comment/21366/","msgid":"<20211129172427.2fcfbq65fcmd63nj@uno.localdomain>","date":"2021-11-29T17:24:27","subject":"Re: [libcamera-devel] [PATCH v3 07/17] libcamera: base:\n\tfile_descriptor: Return UniqueFD from dup()","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Mon, Nov 29, 2021 at 06:45:10PM +0200, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> On Mon, Nov 29, 2021 at 04:12:33PM +0100, Jacopo Mondi wrote:\n> > On Mon, Nov 29, 2021 at 01:57:42AM +0200, Laurent Pinchart wrote:\n> > > The dup() function returns a duplicate of the file descriptor. Wrapping\n> > > it in a FileDescriptor isn't wrong as such, but it prevents from using\n> > > it in contexts where a UniqueFD is needed. As the duplicate is\n> > > guaranteed to have a single owner when created, return it as a UniqueFD\n> > > instead. A FileDescriptor can easily be created from the UniqueFD if\n> > > desired.\n> > >\n> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > > ---\n> > >  include/libcamera/base/file_descriptor.h |  2 +-\n> > >  src/libcamera/base/file_descriptor.cpp   | 22 ++++++++++++++--------\n> > >  2 files changed, 15 insertions(+), 9 deletions(-)\n> > >\n> > > diff --git a/include/libcamera/base/file_descriptor.h b/include/libcamera/base/file_descriptor.h\n> > > index 74292eba04f5..12a43f95d414 100644\n> > > --- a/include/libcamera/base/file_descriptor.h\n> > > +++ b/include/libcamera/base/file_descriptor.h\n> > > @@ -28,7 +28,7 @@ public:\n> > >\n> > >  \tbool isValid() const { return fd_ != nullptr; }\n> > >  \tint fd() const { return fd_ ? fd_->fd() : -1; }\n> > > -\tFileDescriptor dup() const;\n> > > +\tUniqueFD dup() const;\n> > >\n> > >  private:\n> > >  \tclass Descriptor\n> > > diff --git a/src/libcamera/base/file_descriptor.cpp b/src/libcamera/base/file_descriptor.cpp\n> > > index da696b2501cd..a83bf52c31e6 100644\n> > > --- a/src/libcamera/base/file_descriptor.cpp\n> > > +++ b/src/libcamera/base/file_descriptor.cpp\n> > > @@ -222,17 +222,23 @@ FileDescriptor &FileDescriptor::operator=(FileDescriptor &&other)\n> > >   * \\brief Duplicate a FileDescriptor\n> > >   *\n> > >   * Duplicating a FileDescriptor creates a duplicate of the wrapped file\n> > > - * descriptor and returns a new FileDescriptor instance that wraps the\n> > > - * duplicate. The fd() function of the original and duplicate instances will\n> > > - * return different values. The duplicate instance will not be affected by\n> > > - * destruction of the original instance or its copies.\n> > > + * descriptor and returns a UniqueFD that owns the duplicate. The fd() function\n> > > + * of the original and the get() function of the duplicate will return different\n> >\n> > Just noticed that we now have:\n> >         SharedFD::fd()\n> >         UniqueFD::get()\n> >\n> > Should the two be named the same ?\n>\n> I think it would make sense, yes. But that brings a question: which of\n> the two should we use ? :-)\n\nfd.fd() is awful :)\nAlso *_ptr<> have a .get() function, so....\n\n>\n> > > + * values. The duplicate instance will not be affected by destruction of the\n> > > + * original instance or its copies.\n> > >   *\n> > > - * \\return A new FileDescriptor instance wrapping a duplicate of the original\n> > > - * file descriptor\n> > > + * \\return A UniqueFD owning a duplicate of the original file descriptor\n> > >   */\n> > > -FileDescriptor FileDescriptor::dup() const\n> > > +UniqueFD FileDescriptor::dup() const\n> > >  {\n> > > -\treturn FileDescriptor(fd());\n> > > +\tint dupFd = ::dup(fd());\n> > > +\tif (dupFd == -1) {\n> > > +\t\tint ret = -errno;\n> >\n> > As we don't need to return ret this can simply be\n> >                 in ret = errno;\n> >\n> > > +\t\tLOG(FileDescriptor, Error)\n> > > +\t\t\t<< \"Failed to dup() fd: \" << strerror(-ret);\n> >\n> > and\n> >                                                   << strerror(ret);\n>\n> Indeed. I'm tempted to keep the current pattern though, to avoid making\n> this a special case, but if you think it would be better, I'll change\n> it.\n>\n\nI know, it's a stupid detail, whatever is fine!\n\n> > > +\t}\n> > > +\n> > > +\treturn UniqueFD(dupFd);\n> >\n> > Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> >\n> > >  }\n> > >\n> > >  FileDescriptor::Descriptor::Descriptor(int fd, bool duplicate)\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","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 D80D5BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Nov 2021 17:23:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 99A18605A4;\n\tMon, 29 Nov 2021 18:23:36 +0100 (CET)","from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C968D60592\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 18:23:34 +0100 (CET)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay10.mail.gandi.net (Postfix) with ESMTPSA id 5DC8D240014;\n\tMon, 29 Nov 2021 17:23:34 +0000 (UTC)"],"Date":"Mon, 29 Nov 2021 18:24:27 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20211129172427.2fcfbq65fcmd63nj@uno.localdomain>","References":"<20211128235752.10836-1-laurent.pinchart@ideasonboard.com>\n\t<20211128235752.10836-8-laurent.pinchart@ideasonboard.com>\n\t<20211129151233.gx57nc6ikbwkgfsy@uno.localdomain>\n\t<YaUDlpE857oj6h4N@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<YaUDlpE857oj6h4N@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 07/17] libcamera: base:\n\tfile_descriptor: Return UniqueFD from dup()","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":21372,"web_url":"https://patchwork.libcamera.org/comment/21372/","msgid":"<YaUVK6y/zBZTeN0G@pendragon.ideasonboard.com>","date":"2021-11-29T18:00:11","subject":"Re: [libcamera-devel] [PATCH v3 07/17] libcamera: base:\n\tfile_descriptor: Return UniqueFD from dup()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Hiro,\n\nOn Mon, Nov 29, 2021 at 11:05:51PM +0900, Hirokazu Honda wrote:\n> On Mon, Nov 29, 2021 at 8:58 AM Laurent Pinchart wrote:\n> >\n> > The dup() function returns a duplicate of the file descriptor. Wrapping\n> > it in a FileDescriptor isn't wrong as such, but it prevents from using\n> > it in contexts where a UniqueFD is needed. As the duplicate is\n> > guaranteed to have a single owner when created, return it as a UniqueFD\n> > instead. A FileDescriptor can easily be created from the UniqueFD if\n> > desired.\n> >\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> I think this is a correct change.\n> Although I have no idea when dup() should be used.\n> In fact, there seems to be no code calling FileDescriptor::dup().\n> Do you have any idea?\n\nYou're right, it's not used. There's a place where it would be useful\nthough, I'll give it a try in v4.\n\n> > ---\n> >  include/libcamera/base/file_descriptor.h |  2 +-\n> >  src/libcamera/base/file_descriptor.cpp   | 22 ++++++++++++++--------\n> >  2 files changed, 15 insertions(+), 9 deletions(-)\n> >\n> > diff --git a/include/libcamera/base/file_descriptor.h b/include/libcamera/base/file_descriptor.h\n> > index 74292eba04f5..12a43f95d414 100644\n> > --- a/include/libcamera/base/file_descriptor.h\n> > +++ b/include/libcamera/base/file_descriptor.h\n> > @@ -28,7 +28,7 @@ public:\n> >\n> >         bool isValid() const { return fd_ != nullptr; }\n> >         int fd() const { return fd_ ? fd_->fd() : -1; }\n> > -       FileDescriptor dup() const;\n> > +       UniqueFD dup() const;\n> >\n> >  private:\n> >         class Descriptor\n> > diff --git a/src/libcamera/base/file_descriptor.cpp b/src/libcamera/base/file_descriptor.cpp\n> > index da696b2501cd..a83bf52c31e6 100644\n> > --- a/src/libcamera/base/file_descriptor.cpp\n> > +++ b/src/libcamera/base/file_descriptor.cpp\n> > @@ -222,17 +222,23 @@ FileDescriptor &FileDescriptor::operator=(FileDescriptor &&other)\n> >   * \\brief Duplicate a FileDescriptor\n> >   *\n> >   * Duplicating a FileDescriptor creates a duplicate of the wrapped file\n> > - * descriptor and returns a new FileDescriptor instance that wraps the\n> > - * duplicate. The fd() function of the original and duplicate instances will\n> > - * return different values. The duplicate instance will not be affected by\n> > - * destruction of the original instance or its copies.\n> > + * descriptor and returns a UniqueFD that owns the duplicate. The fd() function\n> > + * of the original and the get() function of the duplicate will return different\n> > + * values. The duplicate instance will not be affected by destruction of the\n> > + * original instance or its copies.\n> >   *\n> > - * \\return A new FileDescriptor instance wrapping a duplicate of the original\n> > - * file descriptor\n> > + * \\return A UniqueFD owning a duplicate of the original file descriptor\n> >   */\n> > -FileDescriptor FileDescriptor::dup() const\n> > +UniqueFD FileDescriptor::dup() const\n> >  {\n> > -       return FileDescriptor(fd());\n> > +       int dupFd = ::dup(fd());\n> > +       if (dupFd == -1) {\n> > +               int ret = -errno;\n> > +               LOG(FileDescriptor, Error)\n> > +                       << \"Failed to dup() fd: \" << strerror(-ret);\n> > +       }\n> > +\n> > +       return UniqueFD(dupFd);\n> >  }\n> >\n> >  FileDescriptor::Descriptor::Descriptor(int fd, bool duplicate)","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 4B96EBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Nov 2021 18:00:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6BE51605A4;\n\tMon, 29 Nov 2021 19:00:37 +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 D534E60592\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 19:00:35 +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 4F0F52A5;\n\tMon, 29 Nov 2021 19:00:35 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"NaE5Frn6\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1638208835;\n\tbh=sNwveVdYV2z0XNNkXLgCI4UlIx6UB9FR82Bfrr+tLu0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=NaE5Frn6xr5dnX7ATJqpiuJunFFf8RUL519E1vt4kkLf/2Twn8EP7suq/Jq7vP1PN\n\tWwN3aH2xmRV3ZKEUAbgDB4axshC6w+70feS+D+A+T/uTGo/4uhE+jI/uXbdRBcoP5u\n\tq6J/9c5oYHn6xxXFvxKBKXDadZUM2JbgQ30uA74k=","Date":"Mon, 29 Nov 2021 20:00:11 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Hirokazu Honda <hiroh@chromium.org>","Message-ID":"<YaUVK6y/zBZTeN0G@pendragon.ideasonboard.com>","References":"<20211128235752.10836-1-laurent.pinchart@ideasonboard.com>\n\t<20211128235752.10836-8-laurent.pinchart@ideasonboard.com>\n\t<CAO5uPHOTkE83Eraz2KbMNBKCzYC4ijouQpWe2p09ioemOGGxtA@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<CAO5uPHOTkE83Eraz2KbMNBKCzYC4ijouQpWe2p09ioemOGGxtA@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v3 07/17] libcamera: base:\n\tfile_descriptor: Return UniqueFD from dup()","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":21373,"web_url":"https://patchwork.libcamera.org/comment/21373/","msgid":"<YaUWXWg6BZZmhool@pendragon.ideasonboard.com>","date":"2021-11-29T18:05:17","subject":"Re: [libcamera-devel] [PATCH v3 07/17] libcamera: base:\n\tfile_descriptor: Return UniqueFD from dup()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Mon, Nov 29, 2021 at 06:24:27PM +0100, Jacopo Mondi wrote:\n> On Mon, Nov 29, 2021 at 06:45:10PM +0200, Laurent Pinchart wrote:\n> > On Mon, Nov 29, 2021 at 04:12:33PM +0100, Jacopo Mondi wrote:\n> > > On Mon, Nov 29, 2021 at 01:57:42AM +0200, Laurent Pinchart wrote:\n> > > > The dup() function returns a duplicate of the file descriptor. Wrapping\n> > > > it in a FileDescriptor isn't wrong as such, but it prevents from using\n> > > > it in contexts where a UniqueFD is needed. As the duplicate is\n> > > > guaranteed to have a single owner when created, return it as a UniqueFD\n> > > > instead. A FileDescriptor can easily be created from the UniqueFD if\n> > > > desired.\n> > > >\n> > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > > > ---\n> > > >  include/libcamera/base/file_descriptor.h |  2 +-\n> > > >  src/libcamera/base/file_descriptor.cpp   | 22 ++++++++++++++--------\n> > > >  2 files changed, 15 insertions(+), 9 deletions(-)\n> > > >\n> > > > diff --git a/include/libcamera/base/file_descriptor.h b/include/libcamera/base/file_descriptor.h\n> > > > index 74292eba04f5..12a43f95d414 100644\n> > > > --- a/include/libcamera/base/file_descriptor.h\n> > > > +++ b/include/libcamera/base/file_descriptor.h\n> > > > @@ -28,7 +28,7 @@ public:\n> > > >\n> > > >  \tbool isValid() const { return fd_ != nullptr; }\n> > > >  \tint fd() const { return fd_ ? fd_->fd() : -1; }\n> > > > -\tFileDescriptor dup() const;\n> > > > +\tUniqueFD dup() const;\n> > > >\n> > > >  private:\n> > > >  \tclass Descriptor\n> > > > diff --git a/src/libcamera/base/file_descriptor.cpp b/src/libcamera/base/file_descriptor.cpp\n> > > > index da696b2501cd..a83bf52c31e6 100644\n> > > > --- a/src/libcamera/base/file_descriptor.cpp\n> > > > +++ b/src/libcamera/base/file_descriptor.cpp\n> > > > @@ -222,17 +222,23 @@ FileDescriptor &FileDescriptor::operator=(FileDescriptor &&other)\n> > > >   * \\brief Duplicate a FileDescriptor\n> > > >   *\n> > > >   * Duplicating a FileDescriptor creates a duplicate of the wrapped file\n> > > > - * descriptor and returns a new FileDescriptor instance that wraps the\n> > > > - * duplicate. The fd() function of the original and duplicate instances will\n> > > > - * return different values. The duplicate instance will not be affected by\n> > > > - * destruction of the original instance or its copies.\n> > > > + * descriptor and returns a UniqueFD that owns the duplicate. The fd() function\n> > > > + * of the original and the get() function of the duplicate will return different\n> > >\n> > > Just noticed that we now have:\n> > >         SharedFD::fd()\n> > >         UniqueFD::get()\n> > >\n> > > Should the two be named the same ?\n> >\n> > I think it would make sense, yes. But that brings a question: which of\n> > the two should we use ? :-)\n> \n> fd.fd() is awful :)\n> Also *_ptr<> have a .get() function, so....\n\nI usually prefer explicit names, but in this case I agree that get() is\nlikely better. I'll rename fd() to get().\n\n> > > > + * values. The duplicate instance will not be affected by destruction of the\n> > > > + * original instance or its copies.\n> > > >   *\n> > > > - * \\return A new FileDescriptor instance wrapping a duplicate of the original\n> > > > - * file descriptor\n> > > > + * \\return A UniqueFD owning a duplicate of the original file descriptor\n> > > >   */\n> > > > -FileDescriptor FileDescriptor::dup() const\n> > > > +UniqueFD FileDescriptor::dup() const\n> > > >  {\n> > > > -\treturn FileDescriptor(fd());\n> > > > +\tint dupFd = ::dup(fd());\n> > > > +\tif (dupFd == -1) {\n> > > > +\t\tint ret = -errno;\n> > >\n> > > As we don't need to return ret this can simply be\n> > >                 in ret = errno;\n> > >\n> > > > +\t\tLOG(FileDescriptor, Error)\n> > > > +\t\t\t<< \"Failed to dup() fd: \" << strerror(-ret);\n> > >\n> > > and\n> > >                                                   << strerror(ret);\n> >\n> > Indeed. I'm tempted to keep the current pattern though, to avoid making\n> > this a special case, but if you think it would be better, I'll change\n> > it.\n> >\n> \n> I know, it's a stupid detail, whatever is fine!\n> \n> > > > +\t}\n> > > > +\n> > > > +\treturn UniqueFD(dupFd);\n> > >\n> > > Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n> > >\n> > > >  }\n> > > >\n> > > >  FileDescriptor::Descriptor::Descriptor(int fd, bool duplicate)","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 8A25CBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Nov 2021 18:05:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C892F605A6;\n\tMon, 29 Nov 2021 19:05:43 +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 7CBE460592\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 19:05:42 +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 DD2DD1265;\n\tMon, 29 Nov 2021 19:05:41 +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=\"VK2kUOpg\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1638209142;\n\tbh=iI0MMMByHGJfs1rRefwfPzozNcyrqc32g+6UE9w8dSE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=VK2kUOpgnRDrtrISvFrPxYXOqEkJ5bNheUPefMxDURsMtM4Hx5hMf6jDtEjC7EsdX\n\tmj9qHGoAbNche16lq/VPM3wR6JhzLtUNGmhUw/xh4st/dUpC8wKMjdQU2RhriK2nJY\n\tpWldcZ+7uaZqSfy5MXIu46lQkCP5PhUPZbIXzJ/o=","Date":"Mon, 29 Nov 2021 20:05:17 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YaUWXWg6BZZmhool@pendragon.ideasonboard.com>","References":"<20211128235752.10836-1-laurent.pinchart@ideasonboard.com>\n\t<20211128235752.10836-8-laurent.pinchart@ideasonboard.com>\n\t<20211129151233.gx57nc6ikbwkgfsy@uno.localdomain>\n\t<YaUDlpE857oj6h4N@pendragon.ideasonboard.com>\n\t<20211129172427.2fcfbq65fcmd63nj@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211129172427.2fcfbq65fcmd63nj@uno.localdomain>","Subject":"Re: [libcamera-devel] [PATCH v3 07/17] libcamera: base:\n\tfile_descriptor: Return UniqueFD from dup()","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>"}}]