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 B176C42D8D; Thu, 29 Jun 2023 17:59:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A531A42D12; Thu, 29 Jun 2023 17:59:23 +0200 (CEST) Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by mails.dpdk.org (Postfix) with ESMTP id 02BC7427EE for ; Thu, 29 Jun 2023 17:59:21 +0200 (CEST) Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-66f5faba829so614346b3a.3 for ; Thu, 29 Jun 2023 08:59:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1688054360; x=1690646360; 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=IPVc1lS3Y2TP5Wbd8OIZTKngZ1wvW69emU7an/lir2g=; b=BE1XC8u5dGo7hoOi8NQAvehf+qJ0yxTXYU8Rev+Xrc67R9rcyKFGJBz+j0YXaLqGN5 gwo0xTwro6RytzYiv9SFIkWTiehCm9yuoL4dhtfo0QBLurtrYMya/dsspdr0d76DsJJN rPWmODXP473Umd45N0kpmhWAinUKJV0D/R6Qy1lAnN90uFuuv34eGmN5/Y8VB3VMUVmV gaaqyGciSwuFVPiQQoCT/MPps82YpJ9/Onc0ILqYFNr+ut2oCPZHHevDMekpMyPtqwlP aEYdSEt87SyKifspK2nvHpWe7B1zW+lFZPqAWEHd+OCYZ4IzQAjbLoz6S5p8AAlN+/Lo XdBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688054360; x=1690646360; 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=IPVc1lS3Y2TP5Wbd8OIZTKngZ1wvW69emU7an/lir2g=; b=l6/pWbi7kG/WngV1mwjKW7ckq1ieNnhzAgIYVlAfvVxIoKgMIxosdw82grWavKRYFM /0ZomAcjsZ9Ge1FR+ufQmb1FaclMkvsFRMCncbjK4zmtB7karloNxJaTTTUxEqDMJt+O 0BWqP68ltKIoJna2omjI+kMJJLwbEAsWYyLTG8tubqtBimysgZOkABpPfPASU4G/WwH1 cBtFQYmLD8TAxFiHnqQq3ulJU2kxIAIOo8nODfZShIxSJRDLy8wPuhZIpBbKAFY6yV7n UJYFZ/FOqwYJeHfMRIEkw4gBIxMrbf4S3YZuCKI5DAIZt/8M1H2rB2aqHIMqQmuibigj LMow== X-Gm-Message-State: AC+VfDwyawxxAbZEuEK5jsH7D120fgTGhFjcOj8SQLBRx8EFTGRp7LPt f/6HeJjwGBYgp+lhWom3XXNKYU2FsFWWGvaYN8kNmA== X-Google-Smtp-Source: ACHHUZ56P8fO57ptaxZ7uG50PvOQa6Y4hRg9ybYTTTgt4jnD+D98mLQuLS/ztc8hzSJwodp3DGviOA== X-Received: by 2002:a05:6a20:8f0b:b0:123:21f9:625e with SMTP id b11-20020a056a208f0b00b0012321f9625emr276256pzk.0.1688054359846; Thu, 29 Jun 2023 08:59:19 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id c6-20020a63ea06000000b0055b553157a5sm471716pgi.71.2023.06.29.08.59.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jun 2023 08:59:18 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v6 4/6] eal: skip stdio on console logging Date: Thu, 29 Jun 2023 08:58:41 -0700 Message-Id: <20230629155858.75668-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230629155858.75668-1-stephen@networkplumber.org> References: <20200814173441.23086-1-stephen@networkplumber.org> <20230629155858.75668-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 85d817c2d31e..151f30eb6071 100644 --- a/lib/eal/unix/eal_log.c +++ b/lib/eal/unix/eal_log.c @@ -5,6 +5,7 @@ #include #include #include +#include #include @@ -21,8 +22,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