Show a patch.

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

{
    "id": 4042,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/4042/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/4042/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20200616105633.57717-1-paul.elder@ideasonboard.com>",
    "date": "2020-06-16T10:56:32",
    "name": "[libcamera-devel,1/2] v4l2: v4l2_compat: Intercept open64, openat64, and mmap64",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d7f35bdfc96f761113f90c103f47eb34858f487b",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/4042/mbox/",
    "series": [
        {
            "id": 1005,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1005/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1005",
            "date": "2020-06-16T10:56:32",
            "name": "[libcamera-devel,1/2] v4l2: v4l2_compat: Intercept open64, openat64, and mmap64",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1005/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/4042/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/4042/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<paul.elder@ideasonboard.com>",
        "Received": [
            "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 359D360103\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Jun 2020 12:56:50 +0200 (CEST)",
            "from jade.flets-east.jp (unknown\n\t[IPv6:2400:4051:61:600:2807:bdfa:f6a:8e53])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A855EF9;\n\tTue, 16 Jun 2020 12:56:48 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"f2sSYjgB\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1592305009;\n\tbh=AyJUpuO7xIQEbVwetyq8zpT70KS2EuanO7DTVYdpNP4=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=f2sSYjgB/hveJtnBh/gfz0nZ/kYW92QegX1pBQReLhAd0sBjJGJpRlFDP0x45XATO\n\t+LnWvl6W0j5yjjIDFunTFmskuBh3cizhD6hIxL/992H9V/LIszGyzUifuutGbD9D2G\n\t76CaiBYaZBacy8lOT13og2NZfEmXvne2sjZ48F3k=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 16 Jun 2020 19:56:32 +0900",
        "Message-Id": "<20200616105633.57717-1-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 1/2] v4l2: v4l2_compat: Intercept open64, \n\topenat64, and mmap64",
        "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>",
        "X-List-Received-Date": "Tue, 16 Jun 2020 10:56:50 -0000"
    },
    "content": "Some applications (eg. Firefox, Google Chrome, Skype) use import open64,\nopenat64, and mmap64 instead of their non-64 versions that we currently\nintercept. Intercept these calls as well.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n src/v4l2/meson.build             |  1 +\n src/v4l2/v4l2_camera_proxy.cpp   |  2 +-\n src/v4l2/v4l2_camera_proxy.h     |  3 ++-\n src/v4l2/v4l2_compat.cpp         | 29 ++++++++++++++++++++++++++++-\n src/v4l2/v4l2_compat_manager.cpp |  2 +-\n src/v4l2/v4l2_compat_manager.h   |  5 +++--\n 6 files changed, 36 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/src/v4l2/meson.build b/src/v4l2/meson.build\nindex 0fb941e..f2e4aaf 100644\n--- a/src/v4l2/meson.build\n+++ b/src/v4l2/meson.build\n@@ -15,6 +15,7 @@ v4l2_compat_cpp_args = [\n     # file operations, disable transparent large file support.\n     '-U_FILE_OFFSET_BITS',\n     '-D_FILE_OFFSET_BITS=32',\n+    '-D_LARGEFILE64_SOURCE',\n     '-fvisibility=hidden',\n ]\n \ndiff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex 17477ab..59af209 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -75,7 +75,7 @@ void V4L2CameraProxy::close()\n }\n \n void *V4L2CameraProxy::mmap(void *addr, size_t length, int prot, int flags,\n-\t\t\t    off_t offset)\n+\t\t\t    __off64_t offset)\n {\n \tLOG(V4L2Compat, Debug) << \"Servicing mmap\";\n \ndiff --git a/src/v4l2/v4l2_camera_proxy.h b/src/v4l2/v4l2_camera_proxy.h\nindex 7c65c88..b5a9801 100644\n--- a/src/v4l2/v4l2_camera_proxy.h\n+++ b/src/v4l2/v4l2_camera_proxy.h\n@@ -11,6 +11,7 @@\n #include <linux/videodev2.h>\n #include <map>\n #include <memory>\n+#include <sys/mman.h>\n #include <sys/types.h>\n #include <vector>\n \n@@ -28,7 +29,7 @@ public:\n \tint open(bool nonBlocking);\n \tvoid dup();\n \tvoid close();\n-\tvoid *mmap(void *addr, size_t length, int prot, int flags, off_t offset);\n+\tvoid *mmap(void *addr, size_t length, int prot, int flags, __off64_t offset);\n \tint munmap(void *addr, size_t length);\n \n \tint ioctl(unsigned long request, void *arg);\ndiff --git a/src/v4l2/v4l2_compat.cpp b/src/v4l2/v4l2_compat.cpp\nindex 2a9a176..ead36e6 100644\n--- a/src/v4l2/v4l2_compat.cpp\n+++ b/src/v4l2/v4l2_compat.cpp\n@@ -38,6 +38,16 @@ LIBCAMERA_PUBLIC int open(const char *path, int oflag, ...)\n \t\t\t\t\t\t     oflag, mode);\n }\n \n+LIBCAMERA_PUBLIC int open64(const char *path, int oflag, ...)\n+{\n+\tmode_t mode = 0;\n+\tif (oflag & O_CREAT || oflag & O_TMPFILE)\n+\t\textract_va_arg(mode_t, mode, oflag);\n+\n+\treturn V4L2CompatManager::instance()->openat(AT_FDCWD, path,\n+\t\t\t\t\t\t     oflag | O_LARGEFILE, mode);\n+}\n+\n /* _FORTIFY_SOURCE redirects open to __open_2 */\n LIBCAMERA_PUBLIC int __open_2(const char *path, int oflag)\n {\n@@ -53,6 +63,16 @@ LIBCAMERA_PUBLIC int openat(int dirfd, const char *path, int oflag, ...)\n \treturn V4L2CompatManager::instance()->openat(dirfd, path, oflag, mode);\n }\n \n+LIBCAMERA_PUBLIC int openat64(int dirfd, const char *path, int oflag, ...)\n+{\n+\tmode_t mode = 0;\n+\tif (oflag & O_CREAT || oflag & O_TMPFILE)\n+\t\textract_va_arg(mode_t, mode, oflag);\n+\n+\treturn V4L2CompatManager::instance()->openat(dirfd, path,\n+\t\t\t\t\t\t     oflag | O_LARGEFILE, mode);\n+}\n+\n LIBCAMERA_PUBLIC int __openat_2(int dirfd, const char *path, int oflag)\n {\n \treturn openat(dirfd, path, oflag);\n@@ -69,7 +89,14 @@ LIBCAMERA_PUBLIC int close(int fd)\n }\n \n LIBCAMERA_PUBLIC void *mmap(void *addr, size_t length, int prot, int flags,\n-\t\t\t    int fd, off_t offset)\n+\t\t\t    int fd, __off_t offset)\n+{\n+\treturn V4L2CompatManager::instance()->mmap(addr, length, prot, flags,\n+\t\t\t\t\t\t   fd, offset);\n+}\n+\n+LIBCAMERA_PUBLIC void *mmap64(void *addr, size_t length, int prot, int flags,\n+\t\t\t      int fd, __off64_t offset)\n {\n \treturn V4L2CompatManager::instance()->mmap(addr, length, prot, flags,\n \t\t\t\t\t\t   fd, offset);\ndiff --git a/src/v4l2/v4l2_compat_manager.cpp b/src/v4l2/v4l2_compat_manager.cpp\nindex 56533c4..f928760 100644\n--- a/src/v4l2/v4l2_compat_manager.cpp\n+++ b/src/v4l2/v4l2_compat_manager.cpp\n@@ -200,7 +200,7 @@ int V4L2CompatManager::close(int fd)\n }\n \n void *V4L2CompatManager::mmap(void *addr, size_t length, int prot, int flags,\n-\t\t\t      int fd, off_t offset)\n+\t\t\t      int fd, __off64_t offset)\n {\n \tV4L2CameraProxy *proxy = getProxy(fd);\n \tif (!proxy)\ndiff --git a/src/v4l2/v4l2_compat_manager.h b/src/v4l2/v4l2_compat_manager.h\nindex 14338a5..baf23ae 100644\n--- a/src/v4l2/v4l2_compat_manager.h\n+++ b/src/v4l2/v4l2_compat_manager.h\n@@ -11,6 +11,7 @@\n #include <fcntl.h>\n #include <map>\n #include <memory>\n+#include <sys/mman.h>\n #include <sys/types.h>\n #include <vector>\n \n@@ -30,7 +31,7 @@ public:\n \t\tusing close_func_t = int (*)(int fd);\n \t\tusing ioctl_func_t = int (*)(int fd, unsigned long request, ...);\n \t\tusing mmap_func_t = void *(*)(void *addr, size_t length, int prot,\n-\t\t\t\t\t      int flags, int fd, off_t offset);\n+\t\t\t\t\t      int flags, int fd, __off64_t offset);\n \t\tusing munmap_func_t = int (*)(void *addr, size_t length);\n \n \t\topenat_func_t openat;\n@@ -51,7 +52,7 @@ public:\n \tint dup(int oldfd);\n \tint close(int fd);\n \tvoid *mmap(void *addr, size_t length, int prot, int flags,\n-\t\t   int fd, off_t offset);\n+\t\t   int fd, __off64_t offset);\n \tint munmap(void *addr, size_t length);\n \tint ioctl(int fd, unsigned long request, void *arg);\n \n",
    "prefixes": [
        "libcamera-devel",
        "1/2"
    ]
}