get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 97080,
    "url": "https://patches.dpdk.org/api/patches/97080/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1629321579-10788-2-git-send-email-navasile@linux.microsoft.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1629321579-10788-2-git-send-email-navasile@linux.microsoft.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1629321579-10788-2-git-send-email-navasile@linux.microsoft.com",
    "date": "2021-08-18T21:19:34",
    "name": "[v4,1/6] eal: add function that sets thread name",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "cc0c6b0fd2636872bd8566eb699a358212f68a13",
    "submitter": {
        "id": 1668,
        "url": "https://patches.dpdk.org/api/people/1668/?format=api",
        "name": "Narcisa Ana Maria Vasile",
        "email": "navasile@linux.microsoft.com"
    },
    "delegate": {
        "id": 24651,
        "url": "https://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1629321579-10788-2-git-send-email-navasile@linux.microsoft.com/mbox/",
    "series": [
        {
            "id": 18338,
            "url": "https://patches.dpdk.org/api/series/18338/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=18338",
            "date": "2021-08-18T21:19:34",
            "name": "Enable the internal EAL thread API",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/18338/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/97080/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/97080/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 01F84A0C55;\n\tWed, 18 Aug 2021 23:19:46 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 9F9DF4067E;\n\tWed, 18 Aug 2021 23:19:46 +0200 (CEST)",
            "from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n by mails.dpdk.org (Postfix) with ESMTP id 468E440140\n for <dev@dpdk.org>; Wed, 18 Aug 2021 23:19:45 +0200 (CEST)",
            "by linux.microsoft.com (Postfix, from userid 1059)\n id 83D0620C3344; Wed, 18 Aug 2021 14:19:44 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 linux.microsoft.com 83D0620C3344",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;\n s=default; t=1629321584;\n bh=fTkgT9GzywJJ+3FBFczeYLkvATkUz/9rXe7kllHa4UM=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=bWcA0BsYzdIJyHNmOoXPENjtqM/3E+BJKQtrYeBugA4LImRUmW9BgRml32sdmB81b\n w3GJLHQt+iqPQjC31hr025vLw+COp2iZuYPpPbSsK+aRgPfIY+W14jonqFmJfYywhl\n lpOunKYigxE0Rjye9A5tdXT4UCNYm7sULfMb2dSA=",
        "From": "Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>",
        "To": "dev@dpdk.org, thomas@monjalon.net, dmitry.kozliuk@gmail.com,\n khot@microsoft.com, navasile@microsoft.com, dmitrym@microsoft.com,\n roretzla@microsoft.com, talshn@nvidia.com, ocardona@microsoft.com",
        "Cc": "bruce.richardson@intel.com, david.marchand@redhat.com,\n pallavi.kadam@intel.com",
        "Date": "Wed, 18 Aug 2021 14:19:34 -0700",
        "Message-Id": "<1629321579-10788-2-git-send-email-navasile@linux.microsoft.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1629321579-10788-1-git-send-email-navasile@linux.microsoft.com>",
        "References": "<1629294247-5207-7-git-send-email-navasile@linux.microsoft.com>\n <1629321579-10788-1-git-send-email-navasile@linux.microsoft.com>",
        "Subject": "[dpdk-dev] [PATCH v4 1/6] eal: add function that sets thread name",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Narcisa Vasile <navasile@microsoft.com>\n\nImplement function that sets the name of a thread.\nOn Windows, SetThreadDescription() is used. Use GetProcAddress()\nto obtain the address of the function for MinGW compatibility.\n\nSigned-off-by: Narcisa Vasile <navasile@microsoft.com>\n---\n lib/eal/common/rte_thread.c  | 17 ++++++++\n lib/eal/include/rte_thread.h | 16 ++++++++\n lib/eal/version.map          |  1 +\n lib/eal/windows/rte_thread.c | 76 ++++++++++++++++++++++++++++++++++++\n 4 files changed, 110 insertions(+)",
    "diff": "diff --git a/lib/eal/common/rte_thread.c b/lib/eal/common/rte_thread.c\nindex 3fdb267337..c91ed3d433 100644\n--- a/lib/eal/common/rte_thread.c\n+++ b/lib/eal/common/rte_thread.c\n@@ -373,6 +373,23 @@ rte_thread_barrier_destroy(rte_thread_barrier *barrier)\n \treturn ret;\n }\n \n+int\n+rte_thread_name_set(rte_thread_t thread_id, const char *name)\n+{\n+\tint ret = ENOSYS;\n+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)\n+#if __GLIBC_PREREQ(2, 12)\n+\tchar truncated[16];\n+\n+\tmemcpy(truncated, name, sizeof(truncated));\n+\tret = pthread_setname_np((pthread_t)thread_id.opaque_id, truncated);\n+#endif\n+#endif\n+\tRTE_SET_USED(thread_id);\n+\tRTE_SET_USED(name);\n+\treturn ret;\n+}\n+\n int\n rte_thread_key_create(rte_thread_key *key, void (*destructor)(void *))\n {\ndiff --git a/lib/eal/include/rte_thread.h b/lib/eal/include/rte_thread.h\nindex 40da83467b..2f6258e336 100644\n--- a/lib/eal/include/rte_thread.h\n+++ b/lib/eal/include/rte_thread.h\n@@ -439,6 +439,22 @@ int rte_thread_barrier_wait(rte_thread_barrier *barrier);\n __rte_experimental\n int rte_thread_barrier_destroy(rte_thread_barrier *barrier);\n \n+/**\n+ * Set the name of the thread represented by 'thread_id'.\n+ *\n+ * @param thread_id\n+ *   The id of the thread.\n+ *\n+ * @param name\n+ *   Thread name to set.\n+ *\n+ * @return\n+ *   On success, return 0.\n+ *   On failure, return a positive errno-style error number.\n+ */\n+__rte_experimental\n+int rte_thread_name_set(rte_thread_t thread_id, const char *name);\n+\n /**\n  * Create a TLS data key visible to all threads in the process.\n  * the created key is later used to get/set a value.\ndiff --git a/lib/eal/version.map b/lib/eal/version.map\nindex 541dc13053..7ce8dcea07 100644\n--- a/lib/eal/version.map\n+++ b/lib/eal/version.map\n@@ -446,6 +446,7 @@ EXPERIMENTAL {\n \trte_thread_barrier_init;\n \trte_thread_barrier_wait;\n \trte_thread_barrier_destroy;\n+\trte_thread_name_set;\n };\n \n INTERNAL {\ndiff --git a/lib/eal/windows/rte_thread.c b/lib/eal/windows/rte_thread.c\nindex b2ff16f51f..f30c5f0f57 100644\n--- a/lib/eal/windows/rte_thread.c\n+++ b/lib/eal/windows/rte_thread.c\n@@ -556,6 +556,82 @@ rte_thread_barrier_destroy(rte_thread_barrier *barrier)\n \treturn 0;\n }\n \n+typedef HRESULT\n+(*SetThreadDescription_type)(HANDLE thread_handle, PCWSTR thread_description);\n+\n+static SetThreadDescription_type SetThreadDescription_ptr;\n+HMODULE kernel32_handle;\n+\n+RTE_INIT(rte_thread_description_ptr_init)\n+{\n+\tstatic const char library_name[] = \"kernel32.dll\";\n+\tstatic const char function[] = \"SetThreadDescription\";\n+\n+\tkernel32_handle = LoadLibraryA(library_name);\n+\tif (kernel32_handle == NULL) {\n+\t\t(void)thread_log_last_error(\"LoadLibraryA(\\\"kernel32.dll\\\")\");\n+\t\treturn;\n+\t}\n+\n+\tSetThreadDescription_ptr = (SetThreadDescription_type)(\n+\t\t\t(void *)GetProcAddress(kernel32_handle, function));\n+\tif (SetThreadDescription_ptr == NULL) {\n+\t\t(void)thread_log_last_error(\"GetProcAddress(\\\"kernel32.dll\\\", \\\"SetThreadDescription\\\")\");\n+\t\tFreeLibrary(kernel32_handle);\n+\t\tkernel32_handle = NULL;\n+\t\treturn;\n+\t}\n+}\n+\n+RTE_FINI(rte_thread_description_ptr_free)\n+{\n+\tif (kernel32_handle != NULL)\n+\t\tFreeLibrary(kernel32_handle);\n+\tkernel32_handle = NULL;\n+\tSetThreadDescription_ptr = NULL;\n+}\n+\n+int\n+rte_thread_name_set(rte_thread_t thread_id, const char *name)\n+{\n+\tint ret = 0;\n+\tsize_t count;\n+\tHRESULT hr;\n+\tHANDLE thread_handle = NULL;\n+\tWCHAR w_name[16];\n+\n+\tthread_handle = OpenThread(THREAD_SET_LIMITED_INFORMATION, FALSE,\n+\t\t\tthread_id.opaque_id);\n+\tif (thread_handle == NULL) {\n+\t\tret = thread_log_last_error(\"OpenThread()\");\n+\t\tgoto cleanup;\n+\t}\n+\n+\tcount = mbstowcs(w_name, name, RTE_DIM(w_name));\n+\tif (count == (size_t) (-1)) {\n+\t\tRTE_LOG(DEBUG, EAL, \"Invalid thread name!\\n\");\n+\t\tret = EINVAL;\n+\t\tgoto cleanup;\n+\t}\n+\n+\tif (SetThreadDescription_ptr == NULL) {\n+\t\tRTE_LOG(DEBUG, EAL, \"Invalid function pointer to SetThreadDescription()!\\n\");\n+\t\tret = EINVAL;\n+\t\tgoto cleanup;\n+\t}\n+\n+\thr = SetThreadDescription_ptr(thread_handle, w_name);\n+\tif (FAILED(hr)) {\n+\t\tret = thread_log_last_error(\"SetThreadDescription()\");\n+\t\tgoto cleanup;\n+\t}\n+\n+cleanup:\n+\tif (thread_handle != NULL)\n+\t\tCloseHandle(thread_handle);\n+\treturn ret;\n+}\n+\n int\n rte_thread_key_create(rte_thread_key *key,\n \t\t__rte_unused void (*destructor)(void *))\n",
    "prefixes": [
        "v4",
        "1/6"
    ]
}