From patchwork Fri Oct 23 04:19:53 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasanth Ramesh X-Patchwork-Id: 28568 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id E4A17C3261 for ; Fri, 23 Oct 2026 04:20:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 137B368F9C; Fri, 23 Oct 2026 06:20:11 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cMW2UbW3"; dkim-atps=neutral Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 592F468E07 for ; Fri, 23 Oct 2026 06:20:09 +0200 (CEST) Received: by mail-pj1-x1036.google.com with SMTP id 98e67ed59e1d1-398b3c37877so284568a91.0 for ; Thu, 22 Oct 2026 21:20:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1792729207; x=1793334007; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=/A7l44jRyY42r6s8qOrxQ/1iwBzYyDqf1AQfwX3mCxM=; b=cMW2UbW3+EM12FQCdibWR96Bk//mbVW4dvD3/T6dHiK8KX4Aj0ar8COoCXTD3dXNR4 9Hpo2MosZNGXc3zbNlmQOSHgAttxUykTNvGiPN8Sb0p+XoxCwsNOs6sl/YH/U8abuZ5r kmnLpmDrOd74Q6PkAqmnR74U/vHEWyEQdrO4JjbHkfnqP1O4LiPaK0g5rctEQt5Ixhvz 0rRH9lXsICbTo1K/VyP9R6+goM71VB76LJfqlgqwVy6nAi3XzHd9uKAoNA4+1imiK/Jk UmW0SRsiFtK+YhfMyU6ZmrAYPuOPzx70A6z2mhRy6oJDC6wLu8gVNypuinXw7drnhXi9 J81g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792729207; x=1793334007; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=/A7l44jRyY42r6s8qOrxQ/1iwBzYyDqf1AQfwX3mCxM=; b=2u84nRM4sh65oys2DNovULQYrB6OS2ZDtvGx/miDDeseOgzqAbzY3dy+w96oTOYnka Hsi56D8U3nd5a6n72ZG3xIWAAz15vjUMZO93zgf4tSwqVNv0c8TGoWOfhFVp/1lpBw6F 0X1mcDPuBDX/mlR5PwBZfGbcW9HEe023q8EPQJZmQ2jiFQ61pmYPcMV9NP83f63LfZvN RUEds8SEjJP9X+ETo3Aza0NIgyed67+kXtRDIsJRkeU0GXmA9EaW1AevkQDtU2XYSDBH XQYwDhCfLTrjVMJcCiqDmIaSnIToXE6eJ9TfUAUbSsl+TkABYYs6yAASFEF7YtfbtaAu 7JNQ== X-Gm-Message-State: AFq9FYJijXsC/1btCwkUKu2kVzgaEzHdIpxg+pukd/UcRyG9P19P+aqI J6h6sl+6nR5CXUhK0RDnDnJTnxMamlCYyb2HoEIDOOa84h1nJMwNHiW1Qbip3zX0 X-Gm-Gg: AYBFou2v7g1Yq7fAx0ieHjgg0YuPgq7jhPyRcw8e8XZjN/IS0VdgBlETMO1Q/Bf2ze2 LCv5qjvO9QgKJJQD/0E0SGR6Zze87WD++hfVKipGSHgAb6Bzo3fgqpFvEUilH7Qk0b5oUTm9/X/ yXLs5sQgornei3yv4qoEUHE0jGKssvXnYY/ocE+Z/woin6IFOD40G73gr2JcDdgINVW8IhaQvoq Ah7EKm0J92u+O4lb0kQNwp/HMAqZ3PU4/bd/nfV3Z6pB3CMaWD0ak4i1X3B+ra+J3zIXyzvvtA7 Mq1cdZpUsuPFtCVp8forsz0UitBYIVM6070nve8pqVVVf0nljWh82ZnUkPMXBUNZ/nNbHIzaduU ap8Cy9y+9vZ7kapf9HIw3BwqvD1qJi1MqI630lWwoGVp4ICmvze64FEy+H6u4a+lriI67SQjsmc euiEwXh7gDIOuKDFzQn9+vlLJFlZ9XQXVW04ez3cGHw/XGNxhRQ0r7B+AxfSBJmP1yh6TY6uEmu baiPxc5ISFmJzsNCcpZDSsnD1nOHgE6Em7KJavYg8wJFfshQ0HOf0c51jKdAjF4WcrLE8HOwUcj qf4Q8csonVuw4CnQ X-Received: by 2002:a17:90b:2d8c:b0:3ad:4bfc:1e77 with SMTP id 98e67ed59e1d1-3adce150b14mr830267a91.66.1792729207401; Thu, 22 Oct 2026 21:20:07 -0700 (PDT) Received: from prasanth.alps.lineo.co.jp (vpn1.lineo.co.jp. [203.141.200.204]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3ada47f8ff1sm7070741a91.0.2026.10.22.21.20.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Oct 2026 21:20:06 -0700 (PDT) From: Prasanth R To: libcamera-devel@lists.libcamera.org Cc: laurent.pinchart@ideasonboard.com, paul.elder@ideasonboard.com, kieran.bingham@ideasonboard.com, barnabas.pocze@ideasonboard.com, Prasanth R Subject: [PATCH v2 1/2] v4l2: v4l2_compat: Handle __ioctl_time64 Date: Fri, 23 Oct 2026 13:19:53 +0900 Message-Id: <20261023041954.913108-1-ragaprasanth@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Paul Elder On 32-bit systems, ioctl is redirected to __ioctl_time64, so the latter needs to be intercepted and handled as well. Add support for this. Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/290 Signed-off-by: Paul Elder Reviewed-by: Kieran Bingham Tested-by: Prasanth R Signed-off-by: Prasanth R --- src/v4l2/v4l2_compat.cpp | 21 +++++++++++++++++++++ src/v4l2/v4l2_compat_manager.cpp | 10 ++++++++++ src/v4l2/v4l2_compat_manager.h | 2 ++ 3 files changed, 33 insertions(+) diff --git a/src/v4l2/v4l2_compat.cpp b/src/v4l2/v4l2_compat.cpp index ff833f57..10421cef 100644 --- a/src/v4l2/v4l2_compat.cpp +++ b/src/v4l2/v4l2_compat.cpp @@ -165,4 +165,25 @@ LIBCAMERA_PUBLIC int ioctl(int fd, unsigned long request, ...) return V4L2CompatManager::instance()->ioctl(fd, request, arg); } +/* + * __USE_TIME64_REDIRECTS redirects ioctl to __ioctl_time64. Disable the + * -Wmissing-declarations warnings, as the functions won't be declared if + * __USE_TIME64_REDIRECTS is not in use. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmissing-declarations" + +#if HAVE_POSIX_IOCTL +LIBCAMERA_PUBLIC int __ioctl_time64(int fd, int request, ...) +#else +LIBCAMERA_PUBLIC int __ioctl_time64(int fd, unsigned long request, ...) +#endif +{ + void *arg; + extract_va_arg(void *, arg, request); + + return V4L2CompatManager::instance()->ioctl_time64(fd, request, arg); +} + +#pragma GCC diagnostic pop } diff --git a/src/v4l2/v4l2_compat_manager.cpp b/src/v4l2/v4l2_compat_manager.cpp index b07f865f..65cce7e1 100644 --- a/src/v4l2/v4l2_compat_manager.cpp +++ b/src/v4l2/v4l2_compat_manager.cpp @@ -46,6 +46,7 @@ V4L2CompatManager::V4L2CompatManager() get_symbol(fops_.dup, "dup"); get_symbol(fops_.close, "close"); get_symbol(fops_.ioctl, "ioctl"); + get_symbol(fops_.ioctl_time64, "__ioctl_time64"); get_symbol(fops_.mmap, "mmap64"); get_symbol(fops_.munmap, "munmap"); } @@ -243,3 +244,12 @@ int V4L2CompatManager::ioctl(int fd, unsigned long request, void *arg) return file->proxy()->ioctl(file.get(), request, arg); } + +int V4L2CompatManager::ioctl_time64(int fd, unsigned long request, void *arg) +{ + std::shared_ptr file = cameraFile(fd); + if (!file) + return fops_.ioctl_time64(fd, request, arg); + + return file->proxy()->ioctl(file.get(), request, arg); +} diff --git a/src/v4l2/v4l2_compat_manager.h b/src/v4l2/v4l2_compat_manager.h index 13673d60..1093505a 100644 --- a/src/v4l2/v4l2_compat_manager.h +++ b/src/v4l2/v4l2_compat_manager.h @@ -34,6 +34,7 @@ public: dup_func_t dup; close_func_t close; ioctl_func_t ioctl; + ioctl_func_t ioctl_time64; mmap_func_t mmap; munmap_func_t munmap; }; @@ -50,6 +51,7 @@ public: int fd, off64_t offset); int munmap(void *addr, size_t length); int ioctl(int fd, unsigned long request, void *arg); + int ioctl_time64(int fd, unsigned long request, void *arg); private: V4L2CompatManager();