From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=GzEM52Jb; dkim-atps=neutral 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 9C1705A061D for ; Fri, 25 Oct 2024 09:53:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729842800; 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=IEORy2mLGvSHfls0312Q4nlhvD6VswmOlwzroCAv/ag=; b=GzEM52JbsItJi8fH5/ka1EgbsWrYRk0FuPN8YjpmbPNWMeyQXykrM91VOF1qn9REX2XaTB MGSMQxH2dMyDHFiix4MSeAvZo+vSReLMDlN8H5FvQYmUhxhoQ6qamqyuHc3wZRUoWoNZJR h+GY0XlbRNNnvo9zfaI6Guolfy1MXvY= Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-345-ia69gb1APJaCSD1lgbr7Lw-1; Fri, 25 Oct 2024 03:53:18 -0400 X-MC-Unique: ia69gb1APJaCSD1lgbr7Lw-1 Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-20ce0913e67so20894075ad.1 for ; Fri, 25 Oct 2024 00:53:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729842797; x=1730447597; 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=IEORy2mLGvSHfls0312Q4nlhvD6VswmOlwzroCAv/ag=; b=rQuLoXyKPP8DJ+h+Y2t1o3wGnzGAfvgNSP9GuCZYoUJamxwC1NDQda4Ehj7Qy4PNj3 QNobpBWqP+eT+xa42UrkG+k+G19AduHvrPQoJzstLdLIsS3ez9FicZ3EmFIiJnzXVGts nlOsw9jG/bzTXvHWnblceBvg2Btuae6y4RFtmsuK+a1wNseCY0qH/n5tPdjWiaCDkumf 3mpH9kFz9yAYJJ/MvpeNVpFyalBGiBE4bQfgReb4MTkh9o4erP4odr+cBdxRyb1bo6oo G6jY5CwNcSB4wPkb9T9FQSbm+pKWvpObXmXnk/+3XNQYBFtNFyCLRI27oGuJEKCM8D4V q9Eg== X-Gm-Message-State: AOJu0YzSQRIvDGQBfU8j/t9o7SuhpYHfMKYUR0xG2sw++r0eFvnA92lh +cLeq9VQOgeAhx4ShU1JMeUFLx2BFZHEUrWKwt43U2um5VV0jj9y0cPREclRAwsU48Wqq/YBS44 oPE1oDp9CgF+vR/N42grk2L8FX6aTz3Jhaf6Vl6Guim/CGIjFzdjxNVeIMQ== X-Received: by 2002:a17:902:db0e:b0:20c:98f8:e0fa with SMTP id d9443c01a7336-20fb98f236bmr54247475ad.11.1729842797199; Fri, 25 Oct 2024 00:53:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF7lFF4fSdZSk77eiYlicuQUhMcNFgGgM+iCulOgQaTBmp8CJmVc7ttluyOKJBCjPVwS3dQXw== X-Received: by 2002:a17:902:db0e:b0:20c:98f8:e0fa with SMTP id d9443c01a7336-20fb98f236bmr54247335ad.11.1729842796894; Fri, 25 Oct 2024 00:53:16 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-210bbf44321sm4904505ad.30.2024.10.25.00.53.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 00:53:13 -0700 (PDT) Date: Fri, 25 Oct 2024 09:53:10 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 6/8] treewide: Address cert-err33-c clang-tidy warnings for clock and timer functions Message-ID: <20241025095310.661a5886@elisabeth> In-Reply-To: References: <20241024230438.3192725-1-sbrivio@redhat.com> <20241024230438.3192725-7-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: NFRHK5FWSJUTDNPHZRHMLBJW3QUY72EN X-Message-ID-Hash: NFRHK5FWSJUTDNPHZRHMLBJW3QUY72EN 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 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 Fri, 25 Oct 2024 12:00:26 +1100 David Gibson wrote: > On Fri, Oct 25, 2024 at 01:04:36AM +0200, Stefano Brivio wrote: > > For clock_gettime(), we shouldn't ignore errors if they happen at > > initialisation phase, because something is seriously wrong and it's > > not helpful if we proceed as if nothing happened. > > > > As we're up and running, though, it's probably better to use a stale > > value than to terminate altogether. Make sure we use a zero value if > > we don't have a stale one somewhere. > > > > For timerfd_gettime() and timerfd_settime() failures, report an error, > > there isn't much else we can do. > > > > Signed-off-by: Stefano Brivio > > --- > > passt.c | 8 +++++--- > > pcap.c | 12 ++++++------ > > tcp.c | 12 +++++++++--- > > 3 files changed, 20 insertions(+), 12 deletions(-) > > > > diff --git a/passt.c b/passt.c > > index ad6f0bc..e987f0d 100644 > > --- a/passt.c > > +++ b/passt.c > > @@ -207,7 +207,8 @@ int main(int argc, char **argv) > > struct timespec now; > > struct sigaction sa; > > > > - clock_gettime(CLOCK_MONOTONIC, &log_start); > > + if (clock_gettime(CLOCK_MONOTONIC, &log_start)) > > + die_perror("Failed to get CLOCK_MONOTONIC time"); > > > > arch_avx2_exec(argv); > > > > @@ -265,7 +266,8 @@ int main(int argc, char **argv) > > > > secret_init(&c); > > > > - clock_gettime(CLOCK_MONOTONIC, &now); > > + if (clock_gettime(CLOCK_MONOTONIC, &now)) > > + die_perror("Failed to get CLOCK_MONOTONIC time"); > > > > flow_init(); > > > > @@ -313,7 +315,7 @@ loop: > > if (nfds == -1 && errno != EINTR) > > die_perror("epoll_wait() failed in main loop"); > > > > - clock_gettime(CLOCK_MONOTONIC, &now); > > + (void)clock_gettime(CLOCK_MONOTONIC, &now); > > I think we should err() here. Oops, right, added here and below. -- Stefano