get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 812792,
    "url": "http://patchwork.ozlabs.org/api/patches/812792/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/lede/patch/20170912111250.31576-20-sojkam1@fel.cvut.cz/",
    "project": {
        "id": 54,
        "url": "http://patchwork.ozlabs.org/api/projects/54/?format=api",
        "name": "LEDE development",
        "link_name": "lede",
        "list_id": "lede-dev.lists.infradead.org",
        "list_email": "lede-dev@lists.infradead.org",
        "web_url": "http://lede-project.org/",
        "scm_url": "",
        "webscm_url": "http://git.lede-project.org/",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170912111250.31576-20-sojkam1@fel.cvut.cz>",
    "list_archive_url": null,
    "date": "2017-09-12T11:12:49",
    "name": "[LEDE-DEV,procd,17/17] utrace: Switch all logging to ulog",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "db11468a06a88b0063d1bd404447fae6ab9486e4",
    "submitter": {
        "id": 14651,
        "url": "http://patchwork.ozlabs.org/api/people/14651/?format=api",
        "name": "Michal Sojka",
        "email": "sojkam1@fel.cvut.cz"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/lede/patch/20170912111250.31576-20-sojkam1@fel.cvut.cz/mbox/",
    "series": [
        {
            "id": 2665,
            "url": "http://patchwork.ozlabs.org/api/series/2665/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/lede/list/?series=2665",
            "date": "2017-09-12T11:12:36",
            "name": "[LEDE-DEV,procd,01/17] utrace: Fix environment initialization",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/2665/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/812792/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/812792/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133;\n\thelo=bombadil.infradead.org;\n\tenvelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"epA5UBTE\"; \n\tdkim-atps=neutral"
        ],
        "Received": [
            "from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xs2Ph6Y1Dz9s7g\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 21:19:36 +1000 (AEST)",
            "from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1drjE2-0001jx-5h; Tue, 12 Sep 2017 11:19:30 +0000",
            "from smtpx.feld.cvut.cz ([147.32.192.33])\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1drj97-0004fd-Vs\n\tfor lede-dev@lists.infradead.org; Tue, 12 Sep 2017 11:14:31 +0000",
            "from localhost (unknown [192.168.200.7])\n\tby smtpx.feld.cvut.cz (Postfix) with ESMTP id 2E5E3DC3E6;\n\tTue, 12 Sep 2017 13:13:17 +0200 (CEST)",
            "from smtpx.feld.cvut.cz ([192.168.200.6])\n\tby localhost (styx.feld.cvut.cz [192.168.200.7]) (amavisd-new,\n\tport 10054)\n\twith ESMTP id v30ixsQDqqHs; Tue, 12 Sep 2017 13:13:15 +0200 (CEST)",
            "from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\n\tby smtpx.feld.cvut.cz (Postfix) with ESMTP id 99EF3DC3F0;\n\tTue, 12 Sep 2017 13:13:13 +0200 (CEST)",
            "from wsh by steelpick.2x.cz with local (Exim 4.89)\n\t(envelope-from <sojkam1@fel.cvut.cz>)\n\tid 1drj7x-0008Ew-K2; Tue, 12 Sep 2017 13:13:13 +0200"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe:\n\tList-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References:\n\tIn-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=hTCLplZkLV7Z5aDDhbuw07XQ5d5KlAd6gUA2qDqMOLI=;\n\tb=epA5UBTEDX8qzo\n\tECS81S1cqHTEM5r6Zob//oGPdvLLYE4LYteIjKymCBh1PKwdMAPu66VHkD0eKLTWFdj6N/u0DcxNA\n\tv5X+HwnYzmVB2tuSZW642+eebOxKcPqCP5R0s4sB7+CtgdDX4SvBhVyLlhzOp/pdgd/QdJTB6uIap\n\tW8m0jsF9KVprGtC0PXAe/nnJ84ICd3e+mtAybs1Sn/nodJedWHlj80+RyR8dY+kYnDUM0EoWXrwf6\n\t+G9nQe+p6gCC0nWzw/NhpsYp3nE49oZfHY0yl6fU2BicbvGfNwlwGt6nDGH2VV30ccyahyaLdbL17\n\tyOVoTRhV2mXO39hwIsPQ==;",
        "X-Virus-Scanned": "IMAP STYX AMAVIS",
        "From": "Michal Sojka <sojkam1@fel.cvut.cz>",
        "To": "lede-dev@lists.infradead.org",
        "Date": "Tue, 12 Sep 2017 13:12:49 +0200",
        "Message-Id": "<20170912111250.31576-20-sojkam1@fel.cvut.cz>",
        "X-Mailer": "git-send-email 2.14.1",
        "In-Reply-To": "<20170912111250.31576-1-sojkam1@fel.cvut.cz>",
        "References": "<20170912111250.31576-1-sojkam1@fel.cvut.cz>",
        "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ",
        "X-CRM114-CacheID": "sfid-20170912_041426_350976_E6467017 ",
        "X-CRM114-Status": "GOOD (  10.66  )",
        "X-Spam-Score": "-4.2 (----)",
        "X-Spam-Report": "SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-4.2 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\n\tmedium trust [147.32.192.33 listed in list.dnswl.org]\n\t-0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay\n\tdomain\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]",
        "Subject": "[LEDE-DEV] [PATCH procd 17/17] utrace: Switch all logging to ulog",
        "X-BeenThere": "lede-dev@lists.infradead.org",
        "X-Mailman-Version": "2.1.21",
        "Precedence": "list",
        "List-Id": "<lede-dev.lists.infradead.org>",
        "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/lede-dev>,\n\t<mailto:lede-dev-request@lists.infradead.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.infradead.org/pipermail/lede-dev/>",
        "List-Post": "<mailto:lede-dev@lists.infradead.org>",
        "List-Help": "<mailto:lede-dev-request@lists.infradead.org?subject=help>",
        "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/lede-dev>,\n\t<mailto:lede-dev-request@lists.infradead.org?subject=subscribe>",
        "Cc": "Michal Sojka <sojkam1@fel.cvut.cz>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "\"Lede-dev\" <lede-dev-bounces@lists.infradead.org>",
        "Errors-To": "lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"
    },
    "content": "This unifies all logs messages produced by utrace and removes\nduplicated functionality.\n\nSigned-off-by: Michal Sojka <sojkam1@fel.cvut.cz>\n---\n trace/trace.c | 49 +++++++++++++++++++------------------------------\n 1 file changed, 19 insertions(+), 30 deletions(-)",
    "diff": "diff --git a/trace/trace.c b/trace/trace.c\nindex 8228edf..2621430 100644\n--- a/trace/trace.c\n+++ b/trace/trace.c\n@@ -25,7 +25,6 @@\n #include <errno.h>\n #include <string.h>\n #include <syslog.h>\n-#include <err.h>\n \n #ifndef PTRACE_EVENT_STOP\n /* PTRACE_EVENT_STOP is defined in linux/ptrace.h, but this header\n@@ -33,6 +32,7 @@\n #define PTRACE_EVENT_STOP 128\n #endif\n \n+#include <libubox/ulog.h>\n #include <libubox/uloop.h>\n #include <libubox/blobmsg.h>\n #include <libubox/blobmsg_json.h>\n@@ -62,21 +62,6 @@ enum mode {\n \tSECCOMP_TRACE,\n } mode = UTRACE;\n \n-#define PROC_NAME(mode) (mode == UTRACE ? \"utrace\" : \"seccomp-trace\")\n-\n-#define INFO(fmt, ...) do { \\\n-\tfprintf(stderr, \"%s: \"fmt, PROC_NAME(mode), ## __VA_ARGS__); \\\n-} while (0)\n-\n-#define ERROR(fmt, ...) do { \\\n-\tsyslog(LOG_ERR, \"%s: \"fmt, PROC_NAME(mode), ## __VA_ARGS__); \\\n-\tfprintf(stderr, \"%s: \"fmt, PROC_NAME(mode), ## __VA_ARGS__);  \\\n-} while (0)\n-\n-#define LOGERR(fmt, ...) do { \\\n-\tsyslog(LOG_ERR, \"%s: \"fmt, PROC_NAME(mode), ## __VA_ARGS__); \\\n-} while (0)\n-\n struct tracee {\n \tstruct uloop_process proc;\n \tint in_syscall;\n@@ -148,7 +133,7 @@ static void print_syscalls(int policy, const char *json)\n \t\t\t\t       sc, syscall_name(sc), sorted[i].count);\n \t\t\tblobmsg_add_string(&b, NULL, syscall_name(sc));\n \t\t} else {\n-\t\t\tERROR(\"no name found for syscall(%d)\\n\", sc);\n+\t\t\tULOG_ERR(\"no name found for syscall(%d)\\n\", sc);\n \t\t}\n \t}\n \tblobmsg_close_array(&b, c);\n@@ -158,9 +143,9 @@ static void print_syscalls(int policy, const char *json)\n \t\tif (fp) {\n \t\t\tfprintf(fp, \"%s\", blobmsg_format_json_indent(b.head, true, 0));\n \t\t\tfclose(fp);\n-\t\t\tINFO(\"saving syscall trace to %s\\n\", json);\n+\t\t\tULOG_INFO(\"saving syscall trace to %s\\n\", json);\n \t\t} else {\n-\t\t\tERROR(\"failed to open %s\\n\", json);\n+\t\t\tULOG_ERR(\"failed to open %s\\n\", json);\n \t\t}\n \t} else {\n \t\tprintf(\"%s\\n\",\n@@ -186,11 +171,11 @@ static void report_seccomp_vialation(pid_t pid, unsigned syscall)\n \tint i = syscall_index(syscall);\n \tif (i >= 0) {\n \t\tsyscall_count[i]++;\n-\t\tLOGERR(\"%s[%u] tried to call non-whitelisted syscall: %s (see %s)\\n\",\n-\t\t       buf, pid,  syscall_name(syscall), json);\n+\t\tULOG_ERR(\"%s[%u] tried to call non-whitelisted syscall: %s (see %s)\\n\",\n+\t\t\t buf, pid,  syscall_name(syscall), json);\n \t} else {\n-\t\tLOGERR(\"%s[%u] tried to call non-whitelisted syscall: %d (see %s)\\n\",\n-\t\t       buf, pid,  syscall, json);\n+\t\tULOG_ERR(\"%s[%u] tried to call non-whitelisted syscall: %d (see %s)\\n\",\n+\t\t\t buf, pid,  syscall, json);\n \t}\n }\n \n@@ -332,7 +317,7 @@ int main(int argc, char **argv, char **envp)\n \t\tmemcpy(&_envp[newenv], envp, envc * sizeof(char *));\n \n \t\tret = execve(_argv[0], _argv, _envp);\n-\t\tERROR(\"failed to exec %s: %s\\n\", _argv[0], strerror(errno));\n+\t\tULOG_ERR(\"failed to exec %s: %s\\n\", _argv[0], strerror(errno));\n \n \t\tfree(_argv);\n \t\tfree(_envp);\n@@ -344,7 +329,7 @@ int main(int argc, char **argv, char **envp)\n \n \twaitpid(child, &status, WUNTRACED);\n \tif (!WIFSTOPPED(status)) {\n-\t\tERROR(\"failed to start %s\\n\", *argv);\n+\t\tULOG_ERR(\"failed to start %s\\n\", *argv);\n \t\treturn -1;\n \t}\n \n@@ -359,10 +344,14 @@ int main(int argc, char **argv, char **envp)\n \t\tptrace_restart = PTRACE_CONT;\n \t\tbreak;\n \t}\n-\tif (ptrace(PTRACE_SEIZE, child, 0, ptrace_options) == -1)\n-\t\terr(1, \"PTRACE_SEIZE\");\n-\tif (ptrace(ptrace_restart, child, 0, SIGCONT) == -1)\n-\t\terr(1, \"ptrace restart\");\n+\tif (ptrace(PTRACE_SEIZE, child, 0, ptrace_options) == -1) {\n+\t\tULOG_ERR(\"PTRACE_SEIZE: %s\\n\", strerror(errno));\n+\t\treturn -1;\n+\t}\n+\tif (ptrace(ptrace_restart, child, 0, SIGCONT) == -1) {\n+\t\tULOG_ERR(\"ptrace_restart: %s\\n\", strerror(errno));\n+\t\treturn -1;\n+\t}\n \n \tuloop_init();\n \ttracer.proc.pid = child;\n@@ -377,7 +366,7 @@ int main(int argc, char **argv, char **envp)\n \tcase UTRACE:\n \t\tif (!json)\n \t\t\tif (asprintf(&json, \"/tmp/%s.%u.json\", basename(*argv), child) < 0)\n-\t\t\t\tERROR(\"failed to allocate output path: %s\\n\", strerror(errno));\n+\t\t\t\tULOG_ERR(\"failed to allocate output path: %s\\n\", strerror(errno));\n \t\tbreak;\n \tcase SECCOMP_TRACE:\n \t\tif (!violation_count)\n",
    "prefixes": [
        "LEDE-DEV",
        "procd",
        "17/17"
    ]
}