Patch Detail
Show a patch.
GET /api/patches/2511/?format=api
{ "id": 2511, "url": "https://patchwork.libcamera.org/api/patches/2511/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2511/", "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": "<20200104052423.11245-1-laurent.pinchart@ideasonboard.com>", "date": "2020-01-04T05:24:23", "name": "[libcamera-devel] v4l2: Fix compilation of __open_2() and __openat_2() with gcc", "commit_ref": "abce49655af00e2cfbdfba8cdf2a68d68345f2a1", "pull_url": null, "state": "accepted", "archived": false, "hash": "70c62ac8c223f8f0a5dbb9b7a41fb8bedf253a2e", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/2511/mbox/", "series": [ { "id": 601, "url": "https://patchwork.libcamera.org/api/series/601/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=601", "date": "2020-01-04T05:24:23", "name": "[libcamera-devel] v4l2: Fix compilation of __open_2() and __openat_2() with gcc", "version": 1, "mbox": "https://patchwork.libcamera.org/series/601/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2511/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2511/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EFB7B60461\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 4 Jan 2020 06:24:37 +0100 (CET)", "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7E78030F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 4 Jan 2020 06:24:37 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1578115477;\n\tbh=Ren1tmoDSw4Y3qKw2DZe+7fepqR9TbEYOyaS4EZLRkk=;\n\th=From:To:Subject:Date:From;\n\tb=nSYTf93gbloEJQvzLNgLITgkynyIPW2Ga9N3jur+QnioWpxOJ3ch98D43/oEwm7Xl\n\tnRvGUyqfL/t3XrOZD0o5FLywi8w989y4es5CFT+gYRQ/82AiPVeQ+ENo3KJ+UDz9uw\n\tyOPJA8+SEIaFB9ZSGzhMX8TPdo7vfe7oM4iJPTME=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 4 Jan 2020 07:24:23 +0200", "Message-Id": "<20200104052423.11245-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.24.1", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] v4l2: Fix compilation of __open_2() and\n\t__openat_2() with gcc", "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": "Sat, 04 Jan 2020 05:24:38 -0000" }, "content": "The __open_2() and __openat_2() functions are defined by glibc as taking\n2 and 3 arguments respectively, with variadic arguments for the file\nmode as open() and openat() do. The V4L2 compatibility layer defines\nthem as aliases for open() and openat(), which results in compilation\nfailures with gcc:\n\n../../src/v4l2/v4l2_compat.cpp: In function ‘int __openat_2(int, const char*, int)’:\n../../src/v4l2/v4l2_compat.cpp:58:14: error: invalid conversion from ‘int’ to ‘const char*’ [-fpermissive]\n 58 | return open(dirfd, path, oflag);\n | ^~~~~\n | |\n | int\n../../src/v4l2/v4l2_compat.cpp:31:39: note: initializing argument 1 of ‘int open(const char*, int, ...)’\n 31 | LIBCAMERA_PUBLIC int open(const char *path, int oflag, ...)\n | ~~~~~~~~~~~~^~~~\n../../src/v4l2/v4l2_compat.cpp:58:21: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive]\n 58 | return open(dirfd, path, oflag);\n | ^~~~\n | |\n | const char*\n../../src/v4l2/v4l2_compat.cpp:31:49: note: initializing argument 2 of ‘int open(const char*, int, ...)’\n 31 | LIBCAMERA_PUBLIC int open(const char *path, int oflag, ...)\n |\n\nFix this by defining the two functions as wrappers around open() and\nopenat() without variadic arguments.\n\nFixes: 0ce8f2390b52 (\"v4l2: v4l2_compat: Add V4L2 compatibility layer\")\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/v4l2/v4l2_compat.cpp | 10 ++++++++--\n 1 file changed, 8 insertions(+), 2 deletions(-)", "diff": "diff --git a/src/v4l2/v4l2_compat.cpp b/src/v4l2/v4l2_compat.cpp\nindex 171ebed6f95b..a162037f6dc7 100644\n--- a/src/v4l2/v4l2_compat.cpp\n+++ b/src/v4l2/v4l2_compat.cpp\n@@ -39,7 +39,10 @@ LIBCAMERA_PUBLIC int open(const char *path, int oflag, ...)\n }\n \n /* _FORTIFY_SOURCE redirects open to __open_2 */\n-LIBCAMERA_PUBLIC extern __typeof(open) __open_2 __attribute__ ((alias(\"open\")));\n+LIBCAMERA_PUBLIC int __open_2(const char *path, int oflag)\n+{\n+\treturn open(path, oflag);\n+}\n \n LIBCAMERA_PUBLIC int openat(int dirfd, const char *path, int oflag, ...)\n {\n@@ -50,7 +53,10 @@ 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 extern __typeof(openat) __openat_2 __attribute__ ((alias(\"openat\")));\n+LIBCAMERA_PUBLIC int __openat_2(int dirfd, const char *path, int oflag)\n+{\n+\treturn openat(dirfd, path, oflag);\n+}\n \n LIBCAMERA_PUBLIC int dup(int oldfd)\n {\n", "prefixes": [ "libcamera-devel" ] }