Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2222537/?format=api
{ "id": 2222537, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2222537/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260412-ioctl-v1-16-1d998a460560@bsdimp.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.2/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260412-ioctl-v1-16-1d998a460560@bsdimp.com>", "list_archive_url": null, "date": "2026-04-12T16:02:39", "name": "[16/17] bsd-user: Add do_bsd_ioctl main function", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "f3a9dadc52f5ad7108b9cd32825dbc7b5b71398a", "submitter": { "id": 1896, "url": "http://patchwork.ozlabs.org/api/1.2/people/1896/?format=api", "name": "Warner Losh", "email": "imp@bsdimp.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260412-ioctl-v1-16-1d998a460560@bsdimp.com/mbox/", "series": [ { "id": 499616, "url": "http://patchwork.ozlabs.org/api/1.2/series/499616/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=499616", "date": "2026-04-12T16:02:24", "name": "bsd-user: upstream ioctl", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/499616/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2222537/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2222537/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=bsdimp-com.20251104.gappssmtp.com\n header.i=@bsdimp-com.20251104.gappssmtp.com header.a=rsa-sha256\n header.s=20251104 header.b=RK8lJwj7;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4ftwPg34LRz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 13 Apr 2026 02:05:59 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wBxIH-0006Xc-As; Sun, 12 Apr 2026 12:04:17 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <imp@bsdimp.com>) id 1wBxI1-0006Rx-6K\n for qemu-devel@nongnu.org; Sun, 12 Apr 2026 12:04:04 -0400", "from mail-oo1-xc33.google.com ([2607:f8b0:4864:20::c33])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <imp@bsdimp.com>) id 1wBxHz-0004Xn-1Z\n for qemu-devel@nongnu.org; Sun, 12 Apr 2026 12:04:00 -0400", "by mail-oo1-xc33.google.com with SMTP id\n 006d021491bc7-67c250805ccso1183309eaf.1\n for <qemu-devel@nongnu.org>; Sun, 12 Apr 2026 09:03:55 -0700 (PDT)", "from rebo.bsdimp.com ([50.253.99.174])\n by smtp.gmail.com with ESMTPSA id\n 586e51a60fabf-423ddbee0fesm6457006fac.17.2026.04.12.09.03.52\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 12 Apr 2026 09:03:53 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=bsdimp-com.20251104.gappssmtp.com; s=20251104; t=1776009834; x=1776614634;\n darn=nongnu.org;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:from:to:cc:subject:date:message-id\n :reply-to; bh=BIEcMXAa7oyuBcQ1J23D6kVpY/4XNgxRO50EvsP93+M=;\n b=RK8lJwj73nQsd2tuVFCLxAIEGBG8Eogg/wD/pjIbgbuxl6TfN46GNXdbtmXvx5y8m5\n lxg5bSej+mituFeDIL5KtKRizdC4VQL79hkrOIBi37fCZ8bV4PVB33PV3ZV7Ve5OFDRc\n pKcwpxgReAJDv5U8+tM5t/j3Pk+ITaxeVz4/Z1b6YyOABXLr94CEBVI3iAUG8cYo3cSX\n tuXY1GLArp01jep436Bnx9GT3pwYeLiU7yBEcon/dl6FNgqWUMhjzsWxIlDvwltQQXkY\n coVZo+Vv5v2FZ5YP0rkyck4ylb2iUxxjXQz6vf0sEe7IbZpp+xi9xNLvFO6GEjvWbe+r\n pvWQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776009834; x=1776614634;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=BIEcMXAa7oyuBcQ1J23D6kVpY/4XNgxRO50EvsP93+M=;\n b=lWfXTpDj/q6Kz1OZxgBniQwP/Ox59oedScTfPCcwQ77/YOwa1L3DTZtc17ZL0/y0vq\n Pyf196iCHIire7+XyoegoBDv4gd7SxUx5YGPrfm1R4fqfQejnhFbTV1zQgFW8N5y9pdG\n QN843b7utt81KGZJMF2f55UBkn7RE7idsgi0/0/KLF0pu0F+JOx1UhI2lyPGQGSAXxMP\n UZUnxI9zCnbCFOvzv3UlLuE+zLdbE4BJ2Kt/mecbnTYvN6QjwxKYMXru2/Pt03LJWNfJ\n QaoJZEvx7ZM8bSe7xVa/XMqeiKSmb0w/vjdA7pHSEBvKlELPuu3FxRF678U8Trl+DFP/\n i70w==", "X-Gm-Message-State": "AOJu0YxzEaISqcmR08bKIQUVFWkaOHlGymRAmDGX5CvF1Stiidh2ye46\n ahHIgrLzqA/LTp6yeJF1H0fwmaguCCZRbglcxxfYethPIYk4D1aTN027uGUFZw/c0lO06qpzNke\n M41SrkyY=", "X-Gm-Gg": "AeBDiesAhuxz8tpHV+2kyH8plgfkPkUJcHZJrGfw3ovzjx6nZcdploYcN99xk9/t4dF\n wuhYg350gWRaDChaOsIPlo43hzTbmQ0wYqxfiHSUS5/9JNIeCVFVnX33phomCcnQkQucEtaWK4O\n sv58wB7a8oWiPNiUo1sRMfqvG66/O1Htcu05hv/Y6NKFMZLrZ5Kuw98v+SAYxNRc3fV6TRMqCtl\n xnpJhUsSMQSvo/hvV/5rWxvscwXVJ2404HaSvBisOvl0oUiHWqZLBFbuAaIkuucC8Xe6vEH0xZE\n 7R5i6FEpKaZRIUACm8FvvaIjk8/1R7f3YPNUXsTeZwMBszvcmgf4zybShZbp0JVVMr2uYjauadG\n WpqSGa0960KjtoQ5UVopbGITQwmA6T8khfOb9uQzQjTv8sP23nkDv3fWlKNsPoSFvNltC+LMPU6\n GUSgdxm9my5Q==", "X-Received": "by 2002:a05:6820:2e83:b0:67f:c06c:a5f0 with SMTP id\n 006d021491bc7-68be7de42cdmr3645688eaf.35.1776009834336;\n Sun, 12 Apr 2026 09:03:54 -0700 (PDT)", "From": "Warner Losh <imp@bsdimp.com>", "Date": "Sun, 12 Apr 2026 10:02:39 -0600", "Subject": "[PATCH 16/17] bsd-user: Add do_bsd_ioctl main function", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20260412-ioctl-v1-16-1d998a460560@bsdimp.com>", "References": "<20260412-ioctl-v1-0-1d998a460560@bsdimp.com>", "In-Reply-To": "<20260412-ioctl-v1-0-1d998a460560@bsdimp.com>", "To": "qemu-devel@nongnu.org", "Cc": "Kyle Evans <kevans@freebsd.org>, Warner Losh <imp@bsdimp.com>,\n \"Stacey D. Son\" <sson@freebsd.org>", "X-Mailer": "b4 0.14.3", "X-Developer-Signature": "v=1; a=openpgp-sha256; l=3864; i=imp@bsdimp.com;\n h=from:subject:message-id; bh=ocknaMBKcFWF+U0DHJKsIdFpogAJcD7isOX+33qY5G8=;\n b=owEBbQKS/ZANAwAKAWwc0Sh9sBEAAcsmYgBp28IhHUkBoyDFzbO2lOco3V8FQv16713r/rc7J\n H9WPM0sOwqJAjMEAAEKAB0WIQQgNfiUsAqjz3zN4bdsHNEofbARAAUCadvCIQAKCRBsHNEofbAR\n ABygD/9wMlcksw+1NQMBkZiGmx49UoshOnoxqLoVi8U1UHrg6hX7sZyqVsdR0KusixoVCyJ1U/Z\n 7YSb8Pben0xF8spqMQLpa6FqlWeWEyc6++zJffO7Tji0P4qGbPHmdsrVil6BfltdCQvAa2J2jyF\n x2O7uX2iHcxqEvFQJ75sn3pu+9PlBYiJ/StGbRem7P9AOkNGaES460T/qNzHQCynb9xgREDwH8b\n EShVk2HgQ4H4kor4P2KN5oVWGz+ZkRHeP77hX98S/oyXliIXYrT0B4FZv9ZC6XEv3cU68YrNX1u\n qHgRSux86Dn6/ThV3OwoCqQKzZhFcPl9y8B+WcvEqUVMaIAG+FUy3mYMFSo4OQhatQq7caxzYiq\n 3UpXPHiPUVWfFgw1m42Qk9FbD1BcEP5Q40lN0nqAfopxD/JWKN4dEkBSdrzVT6JT8w0SQrsf2uv\n kSM6aswJGPYQs4u2mUkYwdTIbIVamf0Q+dMUPgEbDgVTzqV2AbuShpbPXf4io7vFuP1L3jgvxRI\n on/UPqUAAst16HL1NKy8E0vBAW5wPjuleUVuZxCxNC31mapUgRYvMz/Znn7ajyHeeI5zHl/8//p\n BRubmXGp0h6sPXCfmS76bfXTAiiNhzBhn8WEbb8knVIYKMTJbPU8mMACb3AgpqeRIzaWyGoLAfK\n HZzqJWiXSKOjbeg==", "X-Developer-Key": "i=imp@bsdimp.com; a=openpgp;\n fpr=2035F894B00AA3CF7CCDE1B76C1CD1287DB01100", "Received-SPF": "none client-ip=2607:f8b0:4864:20::c33;\n envelope-from=imp@bsdimp.com; helo=mail-oo1-xc33.google.com", "X-Spam_score_int": "-18", "X-Spam_score": "-1.9", "X-Spam_bar": "-", "X-Spam_report": "(-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_NONE=0.001 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": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "Add main ioctl emulation dispatcher that handles table-driven\nioctl translation with thunk-based structure conversion. Supports\nTYPE_NULL, TYPE_INT, and TYPE_PTR argument types with read, write,\nand read-write access modes.\n\nSigned-off-by: Stacey D. Son <sson@freebsd.org>\nSigned-off-by: Warner Losh <imp@bsdimp.com>\n---\n bsd-user/bsd-ioctl.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 100 insertions(+)", "diff": "diff --git a/bsd-user/bsd-ioctl.c b/bsd-user/bsd-ioctl.c\nindex aa0153bbaa..ae3ac7ae24 100644\n--- a/bsd-user/bsd-ioctl.c\n+++ b/bsd-user/bsd-ioctl.c\n@@ -294,3 +294,103 @@ static abi_long do_ioctl_in6_ifreq_sockaddr_int(const IOCTLEntry *ie,\n \n return ret;\n }\n+\n+abi_long do_bsd_ioctl(int fd, abi_long cmd, abi_long arg)\n+{\n+ const IOCTLEntry *ie;\n+ const argtype *arg_type;\n+ abi_long ret;\n+ uint8_t buf_temp[MAX_STRUCT_SIZE];\n+ int target_size;\n+ void *argptr;\n+\n+ ie = ioctl_entries;\n+ for (;;) {\n+ if (ie->target_cmd == 0) {\n+ gemu_log(\"QEMU unsupported ioctl: \");\n+ log_unsupported_ioctl(cmd);\n+ return -TARGET_ENOSYS;\n+ }\n+ if (ie->target_cmd == cmd) {\n+ break;\n+ }\n+ ie++;\n+ }\n+ arg_type = ie->arg_type;\n+#if defined(DEBUG)\n+ gemu_log(\"ioctl: cmd=0x%04lx (%s)\\n\", (long)cmd, ie->name);\n+#endif\n+ if (ie->do_ioctl) {\n+ return ie->do_ioctl(ie, buf_temp, fd, cmd, arg);\n+ }\n+\n+ switch (arg_type[0]) {\n+ case TYPE_NULL:\n+ /* no argument */\n+ ret = get_errno(safe_ioctl(fd, ie->host_cmd));\n+ break;\n+\n+ case TYPE_PTRVOID:\n+ case TYPE_INT:\n+ /* int argument */\n+ ret = get_errno(safe_ioctl(fd, ie->host_cmd, arg));\n+ break;\n+\n+ case TYPE_PTR:\n+ arg_type++;\n+ target_size = thunk_type_size(arg_type, 0);\n+ switch (ie->access) {\n+ case IOC_R:\n+ ret = get_errno(safe_ioctl(fd, ie->host_cmd, buf_temp));\n+ if (!is_error(ret)) {\n+ argptr = lock_user(VERIFY_WRITE, arg,\n+ target_size, 0);\n+ if (!argptr) {\n+ return -TARGET_EFAULT;\n+ }\n+ thunk_convert(argptr, buf_temp, arg_type,\n+ THUNK_TARGET);\n+ unlock_user(argptr, arg, target_size);\n+ }\n+ break;\n+\n+ case IOC_W:\n+ argptr = lock_user(VERIFY_READ, arg, target_size, 1);\n+ if (!argptr) {\n+ return -TARGET_EFAULT;\n+ }\n+ thunk_convert(buf_temp, argptr, arg_type, THUNK_HOST);\n+ unlock_user(argptr, arg, 0);\n+ ret = get_errno(safe_ioctl(fd, ie->host_cmd, buf_temp));\n+ break;\n+\n+ case IOC_RW:\n+ /* fallthrough */\n+ default:\n+ argptr = lock_user(VERIFY_READ, arg, target_size, 1);\n+ if (!argptr) {\n+ return -TARGET_EFAULT;\n+ }\n+ thunk_convert(buf_temp, argptr, arg_type, THUNK_HOST);\n+ unlock_user(argptr, arg, 0);\n+ ret = get_errno(safe_ioctl(fd, ie->host_cmd, buf_temp));\n+ if (!is_error(ret)) {\n+ argptr = lock_user(VERIFY_WRITE, arg, target_size, 0);\n+ if (!argptr) {\n+ return -TARGET_EFAULT;\n+ }\n+ thunk_convert(argptr, buf_temp, arg_type, THUNK_TARGET);\n+ unlock_user(argptr, arg, target_size);\n+ }\n+ break;\n+ }\n+ break;\n+\n+ default:\n+ gemu_log(\"QEMU unknown ioctl: type=%d \", arg_type[0]);\n+ log_unsupported_ioctl(cmd);\n+ ret = -TARGET_ENOSYS;\n+ break;\n+ }\n+ return ret;\n+}\n", "prefixes": [ "16/17" ] }