get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 138990,
    "url": "http://patches.dpdk.org/api/patches/138990/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240330030429.4630-11-stephen@networkplumber.org/",
    "project": {
        "id": 1,
        "url": "http://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": "<20240330030429.4630-11-stephen@networkplumber.org>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240330030429.4630-11-stephen@networkplumber.org",
    "date": "2024-03-30T03:00:53",
    "name": "[v19,10/15] log: drop syslog support, and make code common",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "1de57c950ee771b0d6085d713561c35b4cb5b3d6",
    "submitter": {
        "id": 27,
        "url": "http://patches.dpdk.org/api/people/27/?format=api",
        "name": "Stephen Hemminger",
        "email": "stephen@networkplumber.org"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20240330030429.4630-11-stephen@networkplumber.org/mbox/",
    "series": [
        {
            "id": 31647,
            "url": "http://patches.dpdk.org/api/series/31647/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31647",
            "date": "2024-03-30T03:00:44",
            "name": "Logging unification and improvements",
            "version": 19,
            "mbox": "http://patches.dpdk.org/series/31647/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/138990/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/138990/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 0FC8743D8B;\n\tSat, 30 Mar 2024 04:05:52 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 29167427E9;\n\tSat, 30 Mar 2024 04:05:00 +0100 (CET)",
            "from mail-pf1-f179.google.com (mail-pf1-f179.google.com\n [209.85.210.179])\n by mails.dpdk.org (Postfix) with ESMTP id 5A517406B6\n for <dev@dpdk.org>; Sat, 30 Mar 2024 04:04:49 +0100 (CET)",
            "by mail-pf1-f179.google.com with SMTP id\n d2e1a72fcca58-6ea9a60f7f5so2098737b3a.3\n for <dev@dpdk.org>; Fri, 29 Mar 2024 20:04:49 -0700 (PDT)",
            "from hermes.local (204-195-123-203.wavecable.com. [204.195.123.203])\n by smtp.gmail.com with ESMTPSA id\n o3-20020a056a00214300b006e6288ef4besm3655486pfk.54.2024.03.29.20.04.48\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 29 Mar 2024 20:04:48 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1711767888;\n x=1712372688; darn=dpdk.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=DyES1Rd7PjLKXezWsT8D1+VxR7yrYboVhk48nlLmRG0=;\n b=ratFwOhLtjFbbdWQIAhBPXrlztlxAkNKpEq8510lim0vwS9OqvlQ+7HRtkR474nQdQ\n IPpdxWNY+wtNnbJMVljrIfuZFiFQ5iDFoUmCDlLofu1hg9nj+E0egkkglAzIZXUE1qEw\n RiUUAQ79y5EA6tEVsbDNmp5uheN2CeHjOk8E6ayviTNuUKBl21N8noBVCp8KbsfG8mL1\n vO7OdwlMx20rD4z2K1ooAIyLzjMjw1Kw0soQiGcTKUHN2cFRQnH2sx+kwdSL+EpMrHC8\n A1BpiFVW0W0XPUDu/OU+CVQVOTpakEZZjs8LN4Ci0QG+pRkkagA1IqNZu0XVw9nrgZZa\n 8X8Q==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1711767888; x=1712372688;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=DyES1Rd7PjLKXezWsT8D1+VxR7yrYboVhk48nlLmRG0=;\n b=hE7h2//+UCp2NT9uuJW87nN6gvybXBMh4JbpIOYQxCK/2a8S0O0ESgxdIZm9c16DF4\n k6ZcPGQfoaj55DX4GadNXYhSblmGCcmXBZ+EeprdEcnB/reAxGZPHZK9zGDUvCA2a29i\n rcsiUVtIZDk18PfZnQ/BzoouOHhIG1E+UkhWDqYuHP7kQrTRY8qlPBgGHr4HiPoxTUy2\n Gat+qPl0GGtVeHXyoh8SeSdFmPuNpUK95zcCnjMkZ+WsPxBa/wLcdpGz8h8CGADCJcX5\n qgiqe8gFE7GSOn928XAPF6/STxcq8LUrTIDuxunUu/J7H1iuUhGEnMW3Q1t3Bjy8j0E+\n iEmQ==",
        "X-Gm-Message-State": "AOJu0YwgoECPOhHUsyWrAb9TCTGUDUweAButurqnXGprJDsZkigVeNvl\n Om7PNWHH1NdP2zKR1dlOeQaya60wRNancEKjiZRldCurFRnXK3dZLR2EKpBRc0i5SODLe9XfcF+\n O",
        "X-Google-Smtp-Source": "\n AGHT+IHUyJ35ukuB9xNZJdGT34qqiVQt2PxTJmei+EvRYKqcCAUJWVKkzSF+M3ME7jhQQjZBjsWifQ==",
        "X-Received": "by 2002:a05:6a00:1705:b0:6ea:baf6:5720 with SMTP id\n h5-20020a056a00170500b006eabaf65720mr4229586pfc.3.1711767888506;\n Fri, 29 Mar 2024 20:04:48 -0700 (PDT)",
        "From": "Stephen Hemminger <stephen@networkplumber.org>",
        "To": "dev@dpdk.org",
        "Cc": "Stephen Hemminger <stephen@networkplumber.org>",
        "Subject": "[PATCH v19 10/15] log: drop syslog support, and make code common",
        "Date": "Fri, 29 Mar 2024 20:00:53 -0700",
        "Message-ID": "<20240330030429.4630-11-stephen@networkplumber.org>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20240330030429.4630-1-stephen@networkplumber.org>",
        "References": "<20200814173441.23086-1-stephen@networkplumber.org>\n <20240330030429.4630-1-stephen@networkplumber.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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"
    },
    "content": "This patch makes the log setup code common across all platforms.\n\nDrops syslog support for now, will come back in later patch.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n---\n app/test/test_eal_flags.c           |  11 ++-\n lib/eal/common/eal_common_options.c |   3 -\n lib/log/log.c                       |  41 +++++------\n lib/log/log_freebsd.c               |  11 ---\n lib/log/log_internal.h              |   6 --\n lib/log/log_linux.c                 | 102 ----------------------------\n lib/log/log_windows.c               |  22 ------\n lib/log/meson.build                 |   5 +-\n lib/log/version.map                 |   1 -\n 9 files changed, 23 insertions(+), 179 deletions(-)\n delete mode 100644 lib/log/log_freebsd.c\n delete mode 100644 lib/log/log_linux.c\n delete mode 100644 lib/log/log_windows.c",
    "diff": "diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c\nindex 6cb4b06757..36e3185a10 100644\n--- a/app/test/test_eal_flags.c\n+++ b/app/test/test_eal_flags.c\n@@ -984,11 +984,10 @@ test_misc_flags(void)\n \tconst char *argv1[] = {prgname, prefix, mp_flag, \"--no-pci\"};\n \t/* With -v */\n \tconst char *argv2[] = {prgname, prefix, mp_flag, \"-v\"};\n+\t/* With empty --syslog */\n+\tconst char *argv3[] = {prgname, prefix, mp_flag, \"--syslog\"};\n \t/* With valid --syslog */\n-\tconst char *argv3[] = {prgname, prefix, mp_flag,\n-\t\t\t\"--syslog\", \"syslog\"};\n-\t/* With empty --syslog (should fail) */\n-\tconst char *argv4[] = {prgname, prefix, mp_flag, \"--syslog\"};\n+\tconst char *argv4[] = {prgname, prefix, mp_flag, \"--syslog\", \"always\"};\n \t/* With invalid --syslog */\n \tconst char *argv5[] = {prgname, prefix, mp_flag, \"--syslog\", \"error\"};\n \t/* With no-sh-conf, also use no-huge to ensure this test runs on BSD */\n@@ -1083,8 +1082,8 @@ test_misc_flags(void)\n \t\tprintf(\"Error - process did not run ok with --syslog flag\\n\");\n \t\tgoto fail;\n \t}\n-\tif (launch_proc(argv4) == 0) {\n-\t\tprintf(\"Error - process run ok with empty --syslog flag\\n\");\n+\tif (launch_proc(argv4) != 0) {\n+\t\tprintf(\"Error - process did not with --syslog always flag\\n\");\n \t\tgoto fail;\n \t}\n \tif (launch_proc(argv5) == 0) {\ndiff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c\nindex 661b2db211..9ab512e8a1 100644\n--- a/lib/eal/common/eal_common_options.c\n+++ b/lib/eal/common/eal_common_options.c\n@@ -2212,9 +2212,6 @@ eal_common_usage(void)\n \t       \"                      (can be used multiple times)\\n\"\n \t       \"  --\"OPT_VMWARE_TSC_MAP\"    Use VMware TSC map instead of native RDTSC\\n\"\n \t       \"  --\"OPT_PROC_TYPE\"         Type of this process (primary|secondary|auto)\\n\"\n-#ifndef RTE_EXEC_ENV_WINDOWS\n-\t       \"  --\"OPT_SYSLOG\"            Set syslog facility\\n\"\n-#endif\n \t       \"  --\"OPT_LOG_LEVEL\"=<level> Set global log level\\n\"\n \t       \"  --\"OPT_LOG_LEVEL\"=<type-match>:<level>\\n\"\n \t       \"                      Set specific log level\\n\"\ndiff --git a/lib/log/log.c b/lib/log/log.c\nindex 4b24e145b6..3fe86ddcd7 100644\n--- a/lib/log/log.c\n+++ b/lib/log/log.c\n@@ -57,9 +57,6 @@ TAILQ_HEAD(rte_eal_opt_loglevel_list, rte_eal_opt_loglevel);\n static struct rte_eal_opt_loglevel_list opt_loglevel_list =\n \tTAILQ_HEAD_INITIALIZER(opt_loglevel_list);\n \n-/* Stream to use for logging if rte_logs.file is NULL */\n-static FILE *default_log_stream;\n-\n /**\n  * This global structure stores some information about the message\n  * that is currently being processed by one lcore\n@@ -72,8 +69,6 @@ struct log_cur_msg {\n  /* per core log */\n static RTE_DEFINE_PER_LCORE(struct log_cur_msg, log_cur_msg);\n \n-/* default logs */\n-\n /* Change the stream that will be used by logging system */\n int\n rte_openlog_stream(FILE *f)\n@@ -87,17 +82,7 @@ rte_log_get_stream(void)\n {\n \tFILE *f = rte_logs.file;\n \n-\tif (f == NULL) {\n-\t\t/*\n-\t\t * Grab the current value of stderr here, rather than\n-\t\t * just initializing default_log_stream to stderr. This\n-\t\t * ensures that we will always use the current value\n-\t\t * of stderr, even if the application closes and\n-\t\t * reopens it.\n-\t\t */\n-\t\treturn default_log_stream != NULL ? default_log_stream : stderr;\n-\t}\n-\treturn f;\n+\treturn (f == NULL) ? stderr : f;\n }\n \n /* Set global log level */\n@@ -507,14 +492,19 @@ rte_log(uint32_t level, uint32_t logtype, const char *format, ...)\n \treturn ret;\n }\n \n+/* Placeholder */\n+int\n+eal_log_syslog(const char *mode __rte_unused)\n+{\n+\treturn -1;\n+}\n+\n /*\n- * Called by environment-specific initialization functions.\n+ * Called by rte_eal_init\n  */\n void\n-eal_log_set_default(FILE *default_log)\n+eal_log_init(const char *id __rte_unused)\n {\n-\tdefault_log_stream = default_log;\n-\n #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG\n \tRTE_LOG(NOTICE, EAL,\n \t\t\"Debug dataplane logs available - lower performance\\n\");\n@@ -527,8 +517,11 @@ eal_log_set_default(FILE *default_log)\n void\n rte_eal_log_cleanup(void)\n {\n-\tif (default_log_stream) {\n-\t\tfclose(default_log_stream);\n-\t\tdefault_log_stream = NULL;\n-\t}\n+\tFILE *log_stream = rte_logs.file;\n+\n+\t/* don't close stderr on the application */\n+\tif (log_stream != NULL)\n+\t\tfclose(log_stream);\n+\n+\trte_logs.file = NULL;\n }\ndiff --git a/lib/log/log_freebsd.c b/lib/log/log_freebsd.c\ndeleted file mode 100644\nindex 33a0925c43..0000000000\n--- a/lib/log/log_freebsd.c\n+++ /dev/null\n@@ -1,11 +0,0 @@\n-/* SPDX-License-Identifier: BSD-3-Clause\n- * Copyright(c) 2023 Intel Corporation\n- */\n-\n-#include <rte_common.h>\n-#include \"log_internal.h\"\n-\n-void\n-eal_log_init(__rte_unused const char *id)\n-{\n-}\ndiff --git a/lib/log/log_internal.h b/lib/log/log_internal.h\nindex d5fabd7ef7..3c46328e7b 100644\n--- a/lib/log/log_internal.h\n+++ b/lib/log/log_internal.h\n@@ -16,12 +16,6 @@\n __rte_internal\n void eal_log_init(const char *id);\n \n-/*\n- * Determine where log data is written when no call to rte_openlog_stream.\n- */\n-__rte_internal\n-void eal_log_set_default(FILE *default_log);\n-\n /*\n  * Save a log option for later.\n  */\ndiff --git a/lib/log/log_linux.c b/lib/log/log_linux.c\ndeleted file mode 100644\nindex 6d7dc8f3ab..0000000000\n--- a/lib/log/log_linux.c\n+++ /dev/null\n@@ -1,102 +0,0 @@\n-/* SPDX-License-Identifier: BSD-3-Clause\n- * Copyright(c) 2010-2014 Intel Corporation\n- */\n-\n-#include <stdio.h>\n-#include <string.h>\n-#include <sys/types.h>\n-#include <syslog.h>\n-\n-#include <rte_common.h>\n-#include <rte_log.h>\n-\n-#include \"log_internal.h\"\n-\n-static int log_facility = LOG_DAEMON;\n-\n-static const struct {\n-\tconst char *name;\n-\tint value;\n-} facilitys[] = {\n-\t{ \"auth\", LOG_AUTH },\n-\t{ \"cron\", LOG_CRON },\n-\t{ \"daemon\", LOG_DAEMON },\n-\t{ \"ftp\", LOG_FTP },\n-\t{ \"kern\", LOG_KERN },\n-\t{ \"lpr\", LOG_LPR },\n-\t{ \"mail\", LOG_MAIL },\n-\t{ \"news\", LOG_NEWS },\n-\t{ \"syslog\", LOG_SYSLOG },\n-\t{ \"user\", LOG_USER },\n-\t{ \"uucp\", LOG_UUCP },\n-\t{ \"local0\", LOG_LOCAL0 },\n-\t{ \"local1\", LOG_LOCAL1 },\n-\t{ \"local2\", LOG_LOCAL2 },\n-\t{ \"local3\", LOG_LOCAL3 },\n-\t{ \"local4\", LOG_LOCAL4 },\n-\t{ \"local5\", LOG_LOCAL5 },\n-\t{ \"local6\", LOG_LOCAL6 },\n-\t{ \"local7\", LOG_LOCAL7 },\n-};\n-\n-int\n-eal_log_syslog(const char *name)\n-{\n-\tunsigned int i;\n-\n-\tfor (i = 0; i < RTE_DIM(facilitys); i++) {\n-\t\tif (!strcmp(name, facilitys[i].name)) {\n-\t\t\tlog_facility = facilitys[i].value;\n-\t\t\treturn 0;\n-\t\t}\n-\t}\n-\treturn -1;\n-}\n-\n-/*\n- * default log function\n- */\n-static ssize_t\n-console_log_write(__rte_unused void *c, const char *buf, size_t size)\n-{\n-\tssize_t ret;\n-\n-\t/* write on stderr */\n-\tret = fwrite(buf, 1, size, stderr);\n-\tfflush(stderr);\n-\n-\t/* Syslog error levels are from 0 to 7, so subtract 1 to convert */\n-\tsyslog(rte_log_cur_msg_loglevel() - 1, \"%.*s\", (int)size, buf);\n-\n-\treturn ret;\n-}\n-\n-static int\n-console_log_close(__rte_unused void *c)\n-{\n-\tcloselog();\n-\treturn 0;\n-}\n-\n-static cookie_io_functions_t console_log_func = {\n-\t.write = console_log_write,\n-\t.close = console_log_close,\n-};\n-\n-/*\n- * set the log to default function, called during eal init process,\n- * once memzones are available.\n- */\n-void\n-eal_log_init(const char *id)\n-{\n-\tFILE *log_stream;\n-\n-\topenlog(id, LOG_NDELAY | LOG_PID, log_facility);\n-\n-\tlog_stream = fopencookie(NULL, \"w+\", console_log_func);\n-\tif (log_stream != NULL)\n-\t\teal_log_set_default(log_stream);\n-\telse\n-\t\teal_log_set_default(stderr);\n-}\ndiff --git a/lib/log/log_windows.c b/lib/log/log_windows.c\ndeleted file mode 100644\nindex d7c30e4cfa..0000000000\n--- a/lib/log/log_windows.c\n+++ /dev/null\n@@ -1,22 +0,0 @@\n-/* SPDX-License-Identifier: BSD-3-Clause\n- * Copyright(c) 2017-2018 Intel Corporation\n- */\n-\n-#include <rte_common.h>\n-#include <rte_log.h>\n-#include \"log_internal.h\"\n-\n-int\n-eal_log_syslog(const char *name __rte_unused)\n-{\n-\treturn -1; /* not used */\n-}\n-\n-/* set the log to default function, called during eal init process. */\n-void\n-eal_log_init(__rte_unused const char *id)\n-{\n-\trte_openlog_stream(stderr);\n-\n-\teal_log_set_default(stderr);\n-}\ndiff --git a/lib/log/meson.build b/lib/log/meson.build\nindex 0d4319b36f..891f77a237 100644\n--- a/lib/log/meson.build\n+++ b/lib/log/meson.build\n@@ -2,8 +2,5 @@\n # Copyright(c) 2023 Intel Corporation\n \n includes += global_inc\n-sources = files(\n-        'log.c',\n-        'log_' + exec_env + '.c',\n-)\n+sources = files('log.c')\n headers = files('rte_log.h')\ndiff --git a/lib/log/version.map b/lib/log/version.map\nindex 9c6c49bf06..32b9680c31 100644\n--- a/lib/log/version.map\n+++ b/lib/log/version.map\n@@ -29,7 +29,6 @@ INTERNAL {\n \teal_log_level2str;\n \teal_log_save_pattern;\n \teal_log_save_regexp;\n-\teal_log_set_default;\n \teal_log_syslog;\n \trte_eal_log_cleanup;\n };\n",
    "prefixes": [
        "v19",
        "10/15"
    ]
}