get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2230290,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2230290/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260429-ioctl-v2-16-288639bc2427@bsdimp.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.1/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": ""
    },
    "msgid": "<20260429-ioctl-v2-16-288639bc2427@bsdimp.com>",
    "date": "2026-04-29T14:45:22",
    "name": "[v2,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.1/people/1896/?format=api",
        "name": "Warner Losh",
        "email": "imp@bsdimp.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260429-ioctl-v2-16-288639bc2427@bsdimp.com/mbox/",
    "series": [
        {
            "id": 502085,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/502085/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502085",
            "date": "2026-04-29T14:45:07",
            "name": "bsd-user: upstream ioctl",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/502085/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2230290/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2230290/checks/",
    "tags": {},
    "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=l0OD4eOG;\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 4g5KtC2WSHz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 00:48:19 +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 1wI6CG-0005C3-Il; Wed, 29 Apr 2026 10:47:28 -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 1wI6C9-0004qM-9j\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 10:47:21 -0400",
            "from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334])\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 1wI6C4-0004fz-8z\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 10:47:17 -0400",
            "by mail-ot1-x334.google.com with SMTP id\n 46e09a7af769-7dea1272943so943393a34.0\n for <qemu-devel@nongnu.org>; Wed, 29 Apr 2026 07:47:15 -0700 (PDT)",
            "from rebo.bsdimp.com ([50.253.99.174])\n by smtp.gmail.com with ESMTPSA id\n 006d021491bc7-6966b93d58csm1313984eaf.0.2026.04.29.07.47.14\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 29 Apr 2026 07:47:14 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=bsdimp-com.20251104.gappssmtp.com; s=20251104; t=1777474035; x=1778078835;\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=l0OD4eOGXTsvfRqxJ9Y0Axz7LOJ34L+Jf4Xu1e51qQn9Z6DoMdY6XPjltTkqfPX5K5\n SpjfPW+G5FhKrcm7DSkXLvea/mvD8kc2Z7wYy5BIxuFHwlyaNDWzLWlMm/JVHxG5VLZp\n 68WSYmbUWDGf5E9TqzT4xdnOpMyK1fRia3/y1HnB9iaOhC9Nx+7OhtwLpWEoTI20UAKN\n NzgfWbp3KS8zDWQtK5g9Cpsy5cSLjU4eKcCdPTFEsP+6uG0tLvAVGqycw0T6lW/IDrQR\n gJpHXnAVAuf64c2Sg61dWVUueSTABGVP9EbhU6X+o4ltP9gIdngJUNc1HzHPpFsRZ6tw\n acbA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777474035; x=1778078835;\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=URVgyCcd3kYFOeWAAhzY9fua/kpStosNn+8q0FiemuxPe3FClCBZQhB2OEoddv932N\n bykkBNJXmXuwJLz7h0HS1c77RDCyTW30WgNQ2Do5E3UuC5xUc7/ZsOZw9/NrJAw2JyEa\n AIeOJTtaf1kndVbG1QWtfXyI7TinwIlOLzRmQjEqe+CawK+CevNfiovN2H7bfXY/P8hl\n uH1PBiwgnKT1ZakELJAXj0hyRvLQxFwldpz9W+O7pQ0nxbWZYnxfKQ5f2QIixF3HpEPT\n hhkZpX8KroViDPbXK9g6ez0jetQnCUSAVNLzOvhtBsY5uQX9dBlyQTtyJjaagsUsDjrF\n 7oRg==",
        "X-Gm-Message-State": "AOJu0YwKvGKO67YZ4iIKfaQuhWyT/kXO11Ql2sbHn0tl+6bLmDJ1izoG\n ctLiZso00GLrqjV6CyTGC30deiOywNQvwa6WmVpp35/02BOa69o+fk6qdQt/BlMvdRw=",
        "X-Gm-Gg": "AeBDieuhQblR58j9tWefynWbiKVSrw0bMfLbrU5vV1Y5xa6hvt1iphNXrobm/vvE7LJ\n ozekIkmUMi7urEomrxK11Q6sw6My9CmxdwW+HsjDqeCPkc5pmOnaQTedkkierZUoyREmQOflUyb\n BM3hm0WLO1Pojnfz8XqznHhGYnH7a83eYLufVJ/8j01v6lm65o9FwpHkzvVWiUPfrOb9RArEmZk\n cBuYKWlvpmeUqFXtA8ODyVRNLXBoSX8uq2LbEgvmR2pjD6Yh+FKjlgVuQU/4ZWg2Xl9J0U0zytO\n pNFvQ1FjMJ2nWPM2qGg6cj1kM7vLfOVSGG+qjLN0Vrgn5uc7sT2sE/mA5pqTn8Hhd0ZVr0fuZ+d\n UQDWSl9dYYUS+ieltn6n9884xHQqX6IdT2tD2+Jd82ZZld4lCFdA7tmQuxydJ8f/6i4QGa7iLRw\n OAldNt+33Lwn2BIH7sVpRH",
        "X-Received": "by 2002:a4a:e904:0:b0:695:818c:e552 with SMTP id\n 006d021491bc7-6965cbeee7fmr4135050eaf.55.1777474035001;\n Wed, 29 Apr 2026 07:47:15 -0700 (PDT)",
        "From": "Warner Losh <imp@bsdimp.com>",
        "Date": "Wed, 29 Apr 2026 08:45:22 -0600",
        "Subject": "[PATCH v2 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": "<20260429-ioctl-v2-16-288639bc2427@bsdimp.com>",
        "References": "<20260429-ioctl-v2-0-288639bc2427@bsdimp.com>",
        "In-Reply-To": "<20260429-ioctl-v2-0-288639bc2427@bsdimp.com>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "Kyle Evans <kevans@freebsd.org>,\n =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>,\n  Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>,\n  Warner Losh <imp@bsdimp.com>, \"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/ZANAwAKAWwc0Sh9sBEAAcsmYgBp8hl+T5MS7QGyCrTdd/e8EOU0/EhE9fdp8NC8q\n EaFfljwq36JAjMEAAEKAB0WIQQgNfiUsAqjz3zN4bdsHNEofbARAAUCafIZfgAKCRBsHNEofbAR\n AHuFD/9Ba1XITWHq0F2MbIDryw7QpfwERJZE5CZeEX60wtNXxhL4wmuBNTLSFgf5fza+PKlJtEK\n TWJ3tD40N1nCOElkrDLfgFENYWVnm2HvN8i3+EvYAnqvLpdcH9rKrFLe5iejFm8nKZH7vMD83sh\n dc1pvoBfVB6oAWGIpMA37IDE1ZqgStRqVgVeCW6z0s/iDuUYmr2X5SqBTMnLfzLKSbO+opkiZRN\n gfvoyVrk7rgrcj6yBGk7SW7NCeMZAYyIi7n2XM+sHVkYsNb/lswRNoc4w+bE7H/zOYJKAUQAIao\n x8octjvT8qu/+CX1PeDErtgBx3jwKYWylhHPe9hKdpft/eIqyxf/Do/mSE7e03Sydeun/LArYNb\n h++cXQ5URSlSbb3ucybzKfw8kl3pwUY6bqpiB0n42hnqH3JH9OmQMTYOafBd+FHO2IFbNL/DxIq\n XICBSQ1PJYxuH56vMXomlGx8SM2g2OejGeY6khXOkmt693aXk8czRDUJr7mj1oGRE2lpbSnFNL8\n Ux+SqaAu2R5p2gT8bdAfhR3Nqi4298kqxFLPT9WtkdpWpiCu0Q7iFNkTP0R4AOgr+OEXWvfUGFq\n 5jfBJrRan0TwUFCBxjm9w+Pf+HjcSg0dkBzMJhWtMttW0+2idDEWTVNItl4a9rYzjbcH8I9eGdT\n +ilq0acqEMFMQtg==",
        "X-Developer-Key": "i=imp@bsdimp.com; a=openpgp;\n fpr=2035F894B00AA3CF7CCDE1B76C1CD1287DB01100",
        "Received-SPF": "none client-ip=2607:f8b0:4864:20::334;\n envelope-from=imp@bsdimp.com; helo=mail-ot1-x334.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": [
        "v2",
        "16/17"
    ]
}