From nobody Sun May 19 15:05:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1682492908; cv=none; d=zohomail.com; s=zohoarc; b=IcMFHFBYVH7yrWCilXc2snGOAMLAvGR9xvMcOUEygr5Zday546MQR54UEPQb7BNt1ShZB8M5OWJyhI9y0wsqPOQbID/sUpFjNvZ9Kz+DUxe+Wn8iMmIyU8PD95O3h/6DjLuBj620exgek4KcmJrpQpdXGQsRdXWZCD+aCfsHzi8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682492908; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=zwJ2e58/lHr3XqYRikmno9KiTPT2rWRgWb/gttXHjHs=; b=Iv1NhY1bu4jLKSVdhdCtQPMiwWJf/tXl8miq+1HN+m81bN2wcuYqgVJ7r9RyEM1b5cTnzjWopSqxTqp3Z9jZYVMlBHCZwJFixCzPcgfyCwrtIXdOG72afWAY94dQXo3q0HacHPUzan6cMtSjwVgciAi9FjxS/GECLVhAocxgZp0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1682492907809486.54430145488845; Wed, 26 Apr 2023 00:08:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1prZFN-0007Jv-T9; Wed, 26 Apr 2023 03:07:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1prZFK-0007Ix-Nk for qemu-devel@nongnu.org; Wed, 26 Apr 2023 03:07:22 -0400 Received: from todd.t-8ch.de ([2a01:4f8:c010:41de::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1prZF5-00070o-FM for qemu-devel@nongnu.org; Wed, 26 Apr 2023 03:07:22 -0400 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=t-8ch.de; s=mail; t=1682492821; bh=UZxcXItwy0Yvs9deS2R3M84nAYIPOOsY34BW4MbvsGA=; h=From:To:Cc:Subject:Date:From; b=A22GVXdh1QSnRjve3e+uAAdZAATPOBgZNJujCSLM8NzVgGEbZsCHgpK7f4GHWWcos 4cOEEPnqWIewQnzIhAikxsXYQoducU2NzwgqN+icxYulpbmdiTe8fBr6JOjrjwpYCR DxrtuHA+L0RgCOcSVZmU2tDgEY09tWS3jgiD5vcg= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , "Laurent Vivier" Subject: [PATCH] linux-user: report ENOTTY for unknown ioctls Date: Wed, 26 Apr 2023 09:06:59 +0200 Message-Id: <20230426070659.80649-1-thomas@t-8ch.de> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a01:4f8:c010:41de::1; envelope-from=thomas@t-8ch.de; helo=todd.t-8ch.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @t-8ch.de) X-ZM-MESSAGEID: 1682492910842100001 The correct error number for unknown ioctls is ENOTTY. ENOSYS would mean that the ioctl() syscall itself is not implemented, which is very improbable and unexpected for userspace. ENOTTY means "Inappropriate ioctl for device". This is what the kernel returns on unknown ioctls, what qemu is trying to express and what userspace is prepared to handle. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- linux-user/syscall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 69f740ff98c8..c5955313a063 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5747,7 +5747,7 @@ static abi_long do_ioctl(int fd, int cmd, abi_long ar= g) if (ie->target_cmd =3D=3D 0) { qemu_log_mask( LOG_UNIMP, "Unsupported ioctl: cmd=3D0x%04lx\n", (long)cmd= ); - return -TARGET_ENOSYS; + return -TARGET_ENOTTY; } if (ie->target_cmd =3D=3D cmd) break; @@ -5759,7 +5759,7 @@ static abi_long do_ioctl(int fd, int cmd, abi_long ar= g) } else if (!ie->host_cmd) { /* Some architectures define BSD ioctls in their headers that are not implemented in Linux. */ - return -TARGET_ENOSYS; + return -TARGET_ENOTTY; } =20 switch(arg_type[0]) { @@ -5817,7 +5817,7 @@ static abi_long do_ioctl(int fd, int cmd, abi_long ar= g) qemu_log_mask(LOG_UNIMP, "Unsupported ioctl type: cmd=3D0x%04lx type=3D%d\n", (long)cmd, arg_type[0]); - ret =3D -TARGET_ENOSYS; + ret =3D -TARGET_ENOTTY; break; } return ret; base-commit: a14b8206c5edcbbad1c71256ea9b44c3b382a9f5 --=20 2.40.1