From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7ED6F42D82; Wed, 28 Jun 2023 19:58:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A92CE42D1D; Wed, 28 Jun 2023 19:58:39 +0200 (CEST) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mails.dpdk.org (Postfix) with ESMTP id 75B9F42B8B for ; Wed, 28 Jun 2023 19:58:35 +0200 (CEST) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1b852785a65so5035ad.0 for ; Wed, 28 Jun 2023 10:58:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1687975114; x=1690567114; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=q5LcU2GuyWyfjdj1xNxQ3NqciqeusB9CJaomlTrvuhs=; b=Gb42C8uMGzQJjUHkIDz2KMa4kHrZTCBZezP00DJojlwrktFB9u4/5WABxIwS44XDRV ac/6FvsblnfJj2+wjbKAJ12YsUtiV+jucVdiyV3WBUtavcxjpSDMARfIOtfLJokg0vOu YDiCrRKpJ6lIzV6HWXCh0yG2J5Per6GQGoGg4JUuBAWvdURT5kSlJtvRoQGdow500sbF jKteYGqjcOJbS+VuwpFOWPJ+myyJ/qR3CuicaykEK2+JQ4NtJQvA8sSNZqcwi+UL/FuL LE1nkI06NA+yVXAHGRkDHKe/UqSjLoAr5mH+OMARWGUyOngGCCBKkctqr6Fvw4W2tKZP keZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687975114; x=1690567114; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q5LcU2GuyWyfjdj1xNxQ3NqciqeusB9CJaomlTrvuhs=; b=gY/kxCCYjovrV/DLtaN6omzM2zvDB5lAENcJQZ17gi14BlgUL8pVr5UtLOy1TYiQyw N+2fwn/1Uh2SeN5lX7K2BUfzL5d9+Ohfx3VjSGtq2uFcPMayqy4qxompsKeibm7ghnXY e9U9kHM74rxXkiNB0v1YQZEJki9kR9mXlCvMDAivxJc+j8RWYgvpE6pHmHB1fzGbP8hN iurUkuO2jDQziKS4GZh1HX4xrnaGL7tOlpfYBxUrdLFryYFUBittOEpaAwgekURl5FIX ePeagj31P+CFFQ/OIjKr1B4vCqpuabVpTZy+tBckOzoVwRFNrsbXqPlLBwVkXl+Ce882 GAwg== X-Gm-Message-State: AC+VfDzYdsC+KqwaUjc4IxYIl5HxaIzxAOBV7MaAx+CMgohdzlbpiGss aI9HuWr5YVjLF0InwgYyCRXOA/IjlchM5KorYpSdkQ== X-Google-Smtp-Source: ACHHUZ7vk/YdIkDFrkzZwPeTDfy58QrGXNGQih+oIaryoXiE9IZRFY9y15NmOWVkq3X4hpmxVyUUFw== X-Received: by 2002:a17:903:1cf:b0:1b6:a91d:bd1f with SMTP id e15-20020a17090301cf00b001b6a91dbd1fmr2412884plh.6.1687975114482; Wed, 28 Jun 2023 10:58:34 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id g11-20020a170902868b00b001b80d399730sm5047875plo.242.2023.06.28.10.58.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 10:58:33 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v5 4/6] eal: skip stdio on console logging Date: Wed, 28 Jun 2023 10:58:25 -0700 Message-Id: <20230628175827.471909-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230628175827.471909-1-stephen@networkplumber.org> References: <20200814173441.23086-1-stephen@networkplumber.org> <20230628175827.471909-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org There is no need to use stdio when logging to console. Using the write system call directly avoids unnecessary copy to stdio output buffer. Signed-off-by: Stephen Hemminger --- lib/eal/unix/eal_log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/eal/unix/eal_log.c b/lib/eal/unix/eal_log.c index 93cf04fae043..7921417b050a 100644 --- a/lib/eal/unix/eal_log.c +++ b/lib/eal/unix/eal_log.c @@ -6,6 +6,7 @@ #include #include #include +#include #include @@ -23,8 +24,7 @@ console_log_write(__rte_unused void *c, const char *buf, size_t size) ssize_t ret; /* write on stderr */ - ret = fwrite(buf, 1, size, stderr); - fflush(stderr); + ret = write(STDERR_FILENO, buf, size); /* Syslog error levels are from 0 to 7, so subtract 1 to convert */ syslog(rte_log_cur_msg_loglevel() - 1, "%.*s", (int)size, buf); -- 2.39.2