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 E85F742D5F; Mon, 26 Jun 2023 20:43:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AAEE842D10; Mon, 26 Jun 2023 20:42:57 +0200 (CEST) Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by mails.dpdk.org (Postfix) with ESMTP id 83C2542B8C for ; Mon, 26 Jun 2023 20:42:54 +0200 (CEST) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-66f3fc56ef4so1256370b3a.0 for ; Mon, 26 Jun 2023 11:42:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1687804973; x=1690396973; 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=vVW03ARTqWY9Do/0GxaVPJKlzSZSxWklKq2PkjbpES4=; b=qEvpYTmTfrKECiCN0IvpceXWT7oBMJyNb8HnKdet8q92cafWlUvXs0eK9B6ZCgNnkV tmiu60es/FTMizVTMt7pRACBvPXRN9nd0ZvHInEKiw5AMDvoAG6wMpvSGgCWKesi2U6c M48cZ1dCf16Nmnv+y7bU9Hv9tQi3JzkZm3kF1+E8eQawfQ4ZcX5LRoaJ++ltRbmGH3Ai uFwBEZfVTA4Ssll9j+OR9j77AHFXMe0nuyDR4TkMUl/rmRzfkhwNdTe5Hw9QQqdGq7nK 5ZhhZuFB3kZU38RXXhJ/rccB55Ib1dlENJjcSFyCo91awTRhuNtrp6v6YhGZ0HTiKvpe 2pUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687804973; x=1690396973; 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=vVW03ARTqWY9Do/0GxaVPJKlzSZSxWklKq2PkjbpES4=; b=YjW1Aj1qiAfhlSVQg6RxOIoEWfR24BJ0W0qk2UEEI5VOBb7n2VoSi4JYK0GJKjOaf1 tpUVLVHWgOnroPma8Exrh2rga1jgH+RouT9yt6nU2XoQVXZCh2yWncr/3mgZYuEde/rR 0kp1bAMaYTMK8f/oFgUF6+pTxL3RK4X2OaKoZPrmR2FU4AkQg6BplALIV2WeIDwMi0Qo uNIF71MViiDP1v5yOTSECoNUzG/VnFGb4TXbNsOlp8d+UVGJWOR1dWjhZ1VbHetFJYNN N92tS7+2Y932jR32Q5SeEPPbKDBn8+2hM/DKi/+kUDXT4c3GgeApb+RxRPdzIYTT8W2X QA7Q== X-Gm-Message-State: AC+VfDyzijelktd4SfyCuBehFEoGpOe3gcN2aUaV7DGdgj0VSGABNMfx GfFd0/vu3RZQwNLzL8yqodZFR1PyFV5NRTmXZHvUpQ== X-Google-Smtp-Source: ACHHUZ5sei8yL/enBNSLTtcGQFbLLTeKksvKKfbwHsCdn9fMQt4tAQ2tdDffJvup9Ow/O0qTTuHgEA== X-Received: by 2002:a17:90b:350e:b0:262:eb20:2dd8 with SMTP id ls14-20020a17090b350e00b00262eb202dd8mr5702704pjb.20.1687804973455; Mon, 26 Jun 2023 11:42:53 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id h17-20020a17090adb9100b0024e37e0a67dsm4846577pjv.20.2023.06.26.11.42.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 11:42:53 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v4 3/5] eal: skip stdio on console logging Date: Mon, 26 Jun 2023 11:42:14 -0700 Message-Id: <20230626184223.155390-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230626184223.155390-1-stephen@networkplumber.org> References: <20200814173441.23086-1-stephen@networkplumber.org> <20230626184223.155390-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 d44416fd6570..baa721021991 100644 --- a/lib/eal/unix/eal_log.c +++ b/lib/eal/unix/eal_log.c @@ -5,6 +5,7 @@ #include #include #include +#include #include @@ -19,8 +20,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