Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/138975/?format=api
http://patchwork.dpdk.org/api/patches/138975/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20240328235156.5768-11-stephen@networkplumber.org/", "project": { "id": 1, "url": "http://patchwork.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": "<20240328235156.5768-11-stephen@networkplumber.org>", "list_archive_url": "https://inbox.dpdk.org/dev/20240328235156.5768-11-stephen@networkplumber.org", "date": "2024-03-28T23:49:40", "name": "[v18,10/15] log: drop syslog support, and make code common", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "88bddb052e2bd8809ec4573e897aad8c91ec8098", "submitter": { "id": 27, "url": "http://patchwork.dpdk.org/api/people/27/?format=api", "name": "Stephen Hemminger", "email": "stephen@networkplumber.org" }, "delegate": { "id": 1, "url": "http://patchwork.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20240328235156.5768-11-stephen@networkplumber.org/mbox/", "series": [ { "id": 31646, "url": "http://patchwork.dpdk.org/api/series/31646/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=31646", "date": "2024-03-28T23:49:30", "name": "Logging unification and improvements", "version": 18, "mbox": "http://patchwork.dpdk.org/series/31646/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/138975/comments/", "check": "warning", "checks": "http://patchwork.dpdk.org/api/patches/138975/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 2B97543D73;\n\tFri, 29 Mar 2024 00:53:18 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 190A342D89;\n\tFri, 29 Mar 2024 00:52:26 +0100 (CET)", "from mail-pf1-f177.google.com (mail-pf1-f177.google.com\n [209.85.210.177])\n by mails.dpdk.org (Postfix) with ESMTP id 13EAC427E0\n for <dev@dpdk.org>; Fri, 29 Mar 2024 00:52:16 +0100 (CET)", "by mail-pf1-f177.google.com with SMTP id\n d2e1a72fcca58-6e8f51d0bf0so1352818b3a.3\n for <dev@dpdk.org>; Thu, 28 Mar 2024 16:52:16 -0700 (PDT)", "from hermes.local (204-195-123-203.wavecable.com. [204.195.123.203])\n by smtp.gmail.com with ESMTPSA id\n g21-20020a631115000000b005df58c83e89sm1875650pgl.84.2024.03.28.16.52.14\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 28 Mar 2024 16:52:14 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1711669935;\n x=1712274735; 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=1/x8ncg9xdOGd9rk7YaJdxnL7XVS6cGgMwNAwMjCJwM=;\n b=G9R1SOXgNYt9suQPkH0y91qTm3XK0pdgc988hXHJzNbWZad4UQ3VseH6Od3hDyaMrn\n Wu2CSJ0xf88BKJTJ7Cv3uf+PQTI7wePe0vZe4R4NG71aKeEFsZDGMIGgVuU8ZpvRwr+s\n BarYgLrCPkuoG3fEbcIY2udpV2db68NopIanZTt07iL7ktUeywvrH64ngZsFoRHtJKm9\n IxW7ebxd1A4ciDNnoyrkf8YEgHerHPa3IruvBjVKeZe3KOfCKi5Kxm2QvMktS4oh51WS\n VhUvcdUpEj0fMNgD4FA76GyHI8VNGqdcqO1o3JVoDo8VcRbY+Q4w/k0oYm3SmfC517KV\n mRLA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1711669935; x=1712274735;\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=1/x8ncg9xdOGd9rk7YaJdxnL7XVS6cGgMwNAwMjCJwM=;\n b=b2GKI2phwtFW2SI+1jymCIOK5ME7ovAWQd7/zQ1PQmoy2YYq12mXzJaTMZzhWYwyE4\n xfAzMC9EYxIpgiwFLP2Pj/UV937PpAulusSbvu33NxyiHg6liOVRxVGs+J53x8e5SNFl\n jmPK8+tSLzKriOS01v861noyEPZ26pCHbJ8w11V+I216tLYIWLC3DsCN7DHNOoHjDOlH\n HVPDv8TXk7+NxOfUVR+2b1opInoZqxgH08p7Pxp2jDxjFaMi4CTiWPLpwIM+FbvUn39c\n IfWin3T+BPy9EK+eQOTF8G3wwO1+F+qHdTYPyunJFLBEvtFjnfurSyfcI7tIeOnWe20e\n +TgA==", "X-Gm-Message-State": "AOJu0YwKnDuIMDgjWJvt3QYc7EdBjP9lRu/cE4AtkmP/SKKIVYnbgwDa\n 3oO3+L1MlGrVGd/IxsDgea5q1gEAbS3J+5OLoUePTexi4E1XtqY5FmhX4WGPPwwoYrtF8EPnaF2\n J", "X-Google-Smtp-Source": "\n AGHT+IEAgR+F9JKbR5pB5vGCppq51KmOza6DIn6owHZBGg3jsuWa2/Q5oBU3M1+P7+wxrILfVOFFOA==", "X-Received": "by 2002:a05:6a00:190b:b0:6e6:b9a8:5cfc with SMTP id\n y11-20020a056a00190b00b006e6b9a85cfcmr798978pfi.31.1711669935175;\n Thu, 28 Mar 2024 16:52:15 -0700 (PDT)", "From": "Stephen Hemminger <stephen@networkplumber.org>", "To": "dev@dpdk.org", "Cc": "Stephen Hemminger <stephen@networkplumber.org>", "Subject": "[PATCH v18 10/15] log: drop syslog support, and make code common", "Date": "Thu, 28 Mar 2024 16:49:40 -0700", "Message-ID": "<20240328235156.5768-11-stephen@networkplumber.org>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20240328235156.5768-1-stephen@networkplumber.org>", "References": "<20200814173441.23086-1-stephen@networkplumber.org>\n <20240328235156.5768-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 | 29 +++++---\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 8 files changed, 26 insertions(+), 153 deletions(-)\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 255f757d94..f597da2e39 100644\n--- a/lib/log/log.c\n+++ b/lib/log/log.c\n@@ -70,12 +70,13 @@ 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 {\n+\tif (rte_logs.file != NULL)\n+\t\tfclose(rte_logs.file);\n+\n \trte_logs.file = f;\n \treturn 0;\n }\n@@ -505,13 +506,20 @@ 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+\tdefault_log_stream = stderr;\n \n #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG\n \tRTE_LOG(NOTICE, EAL,\n@@ -525,8 +533,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_log_get_stream();\n+\n+\t/* don't close stderr on the application */\n+\tif (log_stream != stderr)\n+\t\tfclose(log_stream);\n+\n+\trte_logs.file = NULL;\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": [ "v18", "10/15" ] }{ "id": 138975, "url": "