Show a patch.

GET /api/patches/20748/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 20748,
    "url": "https://patchwork.libcamera.org/api/patches/20748/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/20748/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20240802072416.25297-3-umang.jain@ideasonboard.com>",
    "date": "2024-08-02T07:24:16",
    "name": "[2/2] libcamera: dma_buf_allocator: Retry ::ioctl on EINTR",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "ba003d581c4bd6c95b86ceaa92cd4a972a2f2014",
    "submitter": {
        "id": 86,
        "url": "https://patchwork.libcamera.org/api/people/86/?format=api",
        "name": "Umang Jain",
        "email": "umang.jain@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/20748/mbox/",
    "series": [
        {
            "id": 4473,
            "url": "https://patchwork.libcamera.org/api/series/4473/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4473",
            "date": "2024-08-02T07:24:14",
            "name": "Retry ::ioctl() on EINTR",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4473/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/20748/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/20748/checks/",
    "tags": {},
    "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 91E4ABDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  2 Aug 2024 07:24:29 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6988A63383;\n\tFri,  2 Aug 2024 09:24:26 +0200 (CEST)",
            "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 EF9B26337E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  2 Aug 2024 09:24:22 +0200 (CEST)",
            "from fedora.local (unknown\n\t[IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 71FA7524;\n\tFri,  2 Aug 2024 09:23:33 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"owPlY1Pn\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1722583414;\n\tbh=NiNB3UOEiuqEFx0eijvV1Pfkasb+IKE4PLlUAkQroYk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=owPlY1Pne+WLvNKmN6yHrpsWHW6ABcHRhIlcUUPodbl251XUNffZFSIRSgXMz1pJL\n\tlMLNhSvnXUoB1csfXLHQIXwbpbbBe8V2/0K7WbLKuwPXC27iIr6AzWSMQpfAfkBXbG\n\tP6L0eN0nIBtkfxnjeKThG4CUAb8OFxdpHZh+2bOo=",
        "From": "Umang Jain <umang.jain@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Umang Jain <umang.jain@ideasonboard.com>",
        "Subject": "[PATCH 2/2] libcamera: dma_buf_allocator: Retry ::ioctl on EINTR",
        "Date": "Fri,  2 Aug 2024 12:54:16 +0530",
        "Message-ID": "<20240802072416.25297-3-umang.jain@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.45.2",
        "In-Reply-To": "<20240802072416.25297-1-umang.jain@ideasonboard.com>",
        "References": "<20240802072416.25297-1-umang.jain@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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>"
    },
    "content": "V4L userspace API documentation clearly mentions the handling of\nEINTR on ioctl(). Align with the xioctl() reference provided in [1].\n\nRetry the ::ioctl() if failed with errno == EINTR. Use a do..while{}\nto check the return value of ::ioctl() and errno value. If the return\nvalue is found to be -1, and errno is set with EINTR, the ioctl() call\nshould be retried.\n\n[1]: https://docs.kernel.org/userspace-api/media/v4l/capture.c.html\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/libcamera/dma_buf_allocator.cpp | 18 +++++++++++++++---\n 1 file changed, 15 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/src/libcamera/dma_buf_allocator.cpp b/src/libcamera/dma_buf_allocator.cpp\nindex be6efb89..5b469b19 100644\n--- a/src/libcamera/dma_buf_allocator.cpp\n+++ b/src/libcamera/dma_buf_allocator.cpp\n@@ -128,6 +128,8 @@ DmaBufAllocator::~DmaBufAllocator() = default;\n  */\n UniqueFD DmaBufAllocator::allocFromUDmaBuf(const char *name, std::size_t size)\n {\n+\tint ret;\n+\n \t/* Size must be a multiple of the page size. Round it up. */\n \tstd::size_t pageMask = sysconf(_SC_PAGESIZE) - 1;\n \tsize = (size + pageMask) & ~pageMask;\n@@ -144,7 +146,10 @@ UniqueFD DmaBufAllocator::allocFromUDmaBuf(const char *name, std::size_t size)\n \tcreate.offset = 0;\n \tcreate.size = size;\n \n-\tint ret = ::ioctl(providerHandle_.get(), UDMABUF_CREATE, &create);\n+\tdo {\n+\t\tret = ::ioctl(providerHandle_.get(), UDMABUF_CREATE, &create);\n+\t} while (ret == -1 && errno == EINTR);\n+\n \tif (ret < 0) {\n \t\tret = errno;\n \t\tLOG(DmaBufAllocator, Error)\n@@ -165,7 +170,10 @@ UniqueFD DmaBufAllocator::allocFromHeap(const char *name, std::size_t size)\n \talloc.len = size;\n \talloc.fd_flags = O_CLOEXEC | O_RDWR;\n \n-\tret = ::ioctl(providerHandle_.get(), DMA_HEAP_IOCTL_ALLOC, &alloc);\n+\tdo {\n+\t\tret = ::ioctl(providerHandle_.get(), DMA_HEAP_IOCTL_ALLOC, &alloc);\n+\t} while (ret == -1 && errno == EINTR);\n+\n \tif (ret < 0) {\n \t\tLOG(DmaBufAllocator, Error)\n \t\t\t<< \"dma-heap allocation failure for \" << name;\n@@ -173,7 +181,11 @@ UniqueFD DmaBufAllocator::allocFromHeap(const char *name, std::size_t size)\n \t}\n \n \tUniqueFD allocFd(alloc.fd);\n-\tret = ::ioctl(allocFd.get(), DMA_BUF_SET_NAME, name);\n+\n+\tdo {\n+\t\tret = ::ioctl(allocFd.get(), DMA_BUF_SET_NAME, name);\n+\t} while (ret == -1 && errno == EINTR);\n+\n \tif (ret < 0) {\n \t\tLOG(DmaBufAllocator, Error)\n \t\t\t<< \"dma-heap naming failure for \" << name;\n",
    "prefixes": [
        "2/2"
    ]
}