From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id 710865A004F for ; Tue, 18 Jun 2024 08:02:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718690575; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VwbqLhE4wqC15739PdH9NekSBx8dvTWsn/CD+X8v5bU=; b=PP+PzpabYn3PVlMufqPRBIEl0v77CMY6w+FBRSXUdy7LCyg7TGIwXdaKUwDnLawVqByMCC f6TCCdEjrL2zyppXRXjqet6Mq2+5Uu6uhTgBU4s+xL73VvMO43mGGI1lWzqtX8IlwPbaV5 dN5JF6BqhZ/H3r+90UybrE35en/pW1M= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-439-eyS675MPNDaUt4_DSWmXhA-1; Tue, 18 Jun 2024 02:02:54 -0400 X-MC-Unique: eyS675MPNDaUt4_DSWmXhA-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-6b4f761c9a6so3039666d6.3 for ; Mon, 17 Jun 2024 23:02:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718690572; x=1719295372; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=VwbqLhE4wqC15739PdH9NekSBx8dvTWsn/CD+X8v5bU=; b=Fs1I9gKTUW8mzreZWombLxhn2+c3pbrPd55adVG73arAOtA9SVrSyS/jk31JphZBhJ 5QevFQ1PxhQee+hBGG56pi7OVTSDwPdGzr50NDM/5chIChjiVve/7eJlI8s3X2xhupHH sJEwWtRv7jrkJ6J/lMC33AperPIe6ZgT5kMCBAd+V+rpSh6gXq5MYMtfgEvaK59gKBt9 Tj3LZNXdmBV+ygOBJl7mM4lcg+xheKBjUWy+f2dRs6rluXpBB34+/Nmxfdg0fOLK6oOA OmkBmW/719zMU8hRTOcJSBiD1qWy85kHBLP6eMI9BJilwlUOX1nT2h4qsThiNiljpeiN Q5Hg== X-Gm-Message-State: AOJu0YzmzbtMDv2zFAQybj2WKuI25pd3aPUwRhN2iCsQPk2LeVmdwMWb P4ZG2WC54paAqDQBuBHLsT6QV5aGd6FiPk47M7jL8vsKtQ3tlxz7jZLiii5XDNyMAQGS8tg4XMn fZwRfv/ZhOREISvEX3ST3hUg64hh2XQyn8nVenyIk13ObLCFwO1fYOgG9ZiXR X-Received: by 2002:ad4:4381:0:b0:6b0:718b:dfd0 with SMTP id 6a1803df08f44-6b2afc76b1amr112073376d6.6.1718690572513; Mon, 17 Jun 2024 23:02:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4Z/T+T8NqA8qus9KsDwjUrmtbqdt/ABhgumA4HsL6KQqkyE7IsiCZhJKbu6keajHQXPyFlw== X-Received: by 2002:ad4:4381:0:b0:6b0:718b:dfd0 with SMTP id 6a1803df08f44-6b2afc76b1amr112073206d6.6.1718690572097; Mon, 17 Jun 2024 23:02:52 -0700 (PDT) Received: from maya.cloud.tilaa.com (maya.cloud.tilaa.com. [164.138.29.33]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-441f2fcc3f9sm53342031cf.59.2024.06.17.23.02.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jun 2024 23:02:51 -0700 (PDT) Date: Tue, 18 Jun 2024 08:02:16 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 4/6] log: Add _perror() logging function variants Message-ID: <20240618080216.2d873da2@elisabeth> In-Reply-To: References: <20240617120319.1206857-1-sbrivio@redhat.com> <20240617120319.1206857-5-sbrivio@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 5Y7L5RNWNUXMDBDSNCVSMYD6PMTGAMGZ X-Message-ID-Hash: 5Y7L5RNWNUXMDBDSNCVSMYD6PMTGAMGZ X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top, Yalan Zhang X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Tue, 18 Jun 2024 10:46:36 +1000 David Gibson wrote: > On Mon, Jun 17, 2024 at 02:03:17PM +0200, Stefano Brivio wrote: > > In many places, we have direct perror() calls, which completely bypass > > logging functions and log files. > > > > They are definitely convenient: offer similar convenience with > > _perror() logging variants, so that we can drop those direct perror() > > calls. > > > > Signed-off-by: Stefano Brivio > > Hm, for anything bigger than like a screenful of code, I generally > find an explicit message with strerror(errno) more useful than > perror() or equivalents, but I guess if you think these are useful. Okay, yes, it probably makes sense to have more descriptive messages as you suggest in the comment to 5/6, but even then, we still have a lot of cases like this one (from 6/6): - warn("lseek() failed on /proc/net file: %s", strerror(errno)); + warn_perror("lseek() failed on /proc/net file"); where these _perror() variants make for tidier code, I find, regardless of the error message itself. -- Stefano