From nobody Fri Nov 29 04:39:54 2024 Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31C7C1AB6D3 for ; Tue, 24 Sep 2024 15:57:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727193436; cv=none; b=Nan5v0eEexuE2iwRVlAFHErlbYQXI2YOtUara2A8/0FMG/sBUDA7w8GC9nYPuvtK1FpA4fL0EZDdBRoAIXmWCIhYjyuS/zMSTRTX5voEukordDzCZDDVJfcucAXkKMkbmkAGMCZ1kauwn0jlhnVqtcS/XQhfmimwdDZWiHYL7mw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727193436; c=relaxed/simple; bh=lXbxjZ+ouwu3WVA+0m4+uIw+G7oJZMsuRpVOioaQla4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=rowUzOpVX3OcZPHt2pt9Rn2JyawUQ6HEqhhvNEBE2DcL/GYH2Mq5CP0o9MnIp1PHSFMBa0oRRmywvTgyb9OipyRZBSpABv1pIg3fVTevUdn0SyGTKG2HWshSm2RYoXqre7RmqPP2/h8wcIwgiYkfmUzUCTlnErNWsMC4RjENxrw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UN+7c5fU; arc=none smtp.client-ip=209.85.166.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="UN+7c5fU" Received: by mail-io1-f44.google.com with SMTP id ca18e2360f4ac-82aa7c3b3dbso294851439f.2 for ; Tue, 24 Sep 2024 08:57:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1727193433; x=1727798233; darn=vger.kernel.org; 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=ZoBLYc/BQM+75Z1j2IpEGmI44ylTgvAEahoMtAvQpbo=; b=UN+7c5fUk1Lv6DP3UjquXzkW7k0U+6v33K/p03N64baxWBNEyCZZ1zi2MaLeZSidzt UQ+B4FNz+MP1Gk3weqTO8GlG6VuqBnKeHiEnrAsRnmQKPF6EmcfMXyDSL6ZygEmCY7T1 5NPLpayv4/2D9lF2KrfkAob5D2MBSNdTDRXQ4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727193433; x=1727798233; 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=ZoBLYc/BQM+75Z1j2IpEGmI44ylTgvAEahoMtAvQpbo=; b=ERyMD/+CDrZi1Uf5pU2zujGJ3OHH0kULV+9JF7J8/JFoWC7jwcGOklxXcfxYLsaUW6 mElUoiVZwB3JxfW8QQMgcm/noWFqpc/lg0FhI7jvRND9TrqIcAdfzy+rPpjPkQuVl2S+ 7SVuiwx9TGlSqPrs90fPuKwfQajyEQ/fjkKfhMVvoDqKnq0Sy49uxy4F5haoZ9pb0SkW oXMfEbExVc+5GY5KARkTMRk2dS+l8T4FH92dudSpTWq2xTL5N62x/Iv4WWxJQLDBnTUJ ilXi+IYQPxTPX2KhN0nJyNC1T5Ds5V7yh/4Tu0Vf+KX5g/UP5jKHJ0VSWB3YEvFRiPmA qRPw== X-Forwarded-Encrypted: i=1; AJvYcCXPlPyrCc1UNSbSaKF56UPbfMnAsA06010LSvYb3d1G2rX8SHJlBw9nzoShtsXA9dHxKqnne0gG/KRPfqo=@vger.kernel.org X-Gm-Message-State: AOJu0YwIBZQQjeeOrsLyB92lhKuKqVkLpEqv+AVQ3nptwmcljcdV1ILR WT07zL0VOApCMWz0pN5D1KfvFll+0+zl2R6zPJxkllcTfLPOkz2Iyw029LkPwrI= X-Google-Smtp-Source: AGHT+IFcqBry3uguUOUjwwPSHKY/lNeTCQaBHBGKJIYpreu2Ms1ak2blPjgKbu0F8CAIifxnwdGmOQ== X-Received: by 2002:a05:6e02:194d:b0:3a0:c820:c5f0 with SMTP id e9e14a558f8ab-3a0c9d90ba0mr145029575ab.24.1727193433191; Tue, 24 Sep 2024 08:57:13 -0700 (PDT) Received: from localhost.localdomain ([38.175.170.29]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a1a5713b64sm4492035ab.58.2024.09.24.08.57.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2024 08:57:12 -0700 (PDT) From: Shuah Khan To: jstultz@google.com, tglx@linutronix.de, sboyd@kernel.org, shuah@kernel.org Cc: Shuah Khan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH 1/2] selftests:timers: posix_timers: Fix warn_unused_result in __fatal_error() Date: Tue, 24 Sep 2024 09:56:46 -0600 Message-Id: <4f3a0acd903aeee52fb71acaec1106d513a2e88b.1727191485.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable __fatal_error routine doesn't check strerror_r() return value, which results in the following compile time warning: posix_timers.c: In function =E2=80=98__fatal_error=E2=80=99: posix_timers.c:31:9: warning: ignoring return value of =E2=80=98strerror_r= =E2=80=99 declared with attribute =E2=80=98warn_unused_result=E2=80=99 [-Wu= nused-result] 31 | strerror_r(errno, buf, sizeof(buf)); Fix this by adding a check for return value and error handling appropriate for the GNU-specific strerror_r() in use in __fatal_error(). Check if return string is null and handle accordingly. From Linux strerror_r() manual page: "The GNU-specific strerror_r() returns a pointer to a string containing the error message. This may be either a pointer to a string that the function stores in buf, or a pointer to some (immutable) static string (in which case buf is unused). If the function stores a string in buf, then at most buflen bytes are stored (the string may be truncated if buflen is too small and errnum is unknown). The string always includes a terminating null byte." Signed-off-by: Shuah Khan Acked-by: John Stultz Acked-by: Thomas Gleixner --- tools/testing/selftests/timers/posix_timers.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/timers/posix_timers.c b/tools/testing/= selftests/timers/posix_timers.c index 16bd49492efa..ddb1cebc844e 100644 --- a/tools/testing/selftests/timers/posix_timers.c +++ b/tools/testing/selftests/timers/posix_timers.c @@ -26,13 +26,17 @@ static void __fatal_error(const char *test, const char *name, const char *= what) { char buf[64]; + char *ret_str =3D NULL; =20 - strerror_r(errno, buf, sizeof(buf)); + ret_str =3D strerror_r(errno, buf, sizeof(buf)); =20 - if (name && strlen(name)) - ksft_exit_fail_msg("%s %s %s %s\n", test, name, what, buf); + if (name && strlen(name) && ret_str) + ksft_exit_fail_msg("%s %s %s %s\n", test, name, what, ret_str); + else if (ret_str) + ksft_exit_fail_msg("%s %s %s\n", test, what, ret_str); else - ksft_exit_fail_msg("%s %s %s\n", test, what, buf); + ksft_exit_fail_msg("%s %s\n", test, what); + } =20 #define fatal_error(name, what) __fatal_error(__func__, name, what) --=20 2.40.1 From nobody Fri Nov 29 04:39:54 2024 Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B54F21ABEA9 for ; Tue, 24 Sep 2024 15:57:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727193439; cv=none; b=XaRxpyRueQu/yJhYAdYfQebNxH2YkiQuGurCLlqCP29CS6boSeCpblWpDEXlM0ueT1NwIGkTD+pGQdjxlSJWzRK67s/vrKHDU4xpYLZXa4co9aKyS5lLzbqRKx0v9GJMpmCQqxIaXnGjWmNHiyjbJyXuxW2V1hygRE45BS9rryM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727193439; c=relaxed/simple; bh=/5F68H2WHyHuyiG699Xxk67Rx4hgdRsscfaURuGqd2c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=J4z3TryufQOlKtW6nUHEKOkDgu7ot3pCbEP2xxhjlqXBWJV1OuBkUrisBKX9rLsiPRnmUmC+oYiTt6VgwF+28EyKByIoSePT0p40RjMFKQxA7ZYT9y6U9HdqvyBqFIVCX8uboHB1/k2j5WEpJNjx4mwQGtLnyVGnNSUMDe8u7wU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=YHcrU7zC; arc=none smtp.client-ip=209.85.166.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="YHcrU7zC" Received: by mail-il1-f174.google.com with SMTP id e9e14a558f8ab-3a0c8b81b4eso20400215ab.0 for ; Tue, 24 Sep 2024 08:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1727193436; x=1727798236; darn=vger.kernel.org; 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=53AWYMV3y98vy7YqJ237N2ZTEc/DzjoF7oupBD8L8xA=; b=YHcrU7zCEKw5x0uyMgVFsG8i5x53CTM26bmjOkQcgPLwazALxxVMMXDXpPJdqqhB3M Saac0iB4+GTf49Lx99yWQoFgg93ryPYX6gPkTnYfk1Y69J38hJn6UR8tavxKFYkELuFM c7hDJmzox0hqaPGc5seoz9AsIlqJk5V7Ige4s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727193436; x=1727798236; 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=53AWYMV3y98vy7YqJ237N2ZTEc/DzjoF7oupBD8L8xA=; b=cWrNLwtdvVU58kTnHIXEYYlV97UcOfpT7GvPx0Z1F5zAECjn28FGkGXETtXXgBPCej p0tu8J1kJlkUVGQTEcAQcEfjhjIntwN4HjKWCQzZrCJCt6DdbbVv+l6kvXh41BWsKOzI WpiKMrBH5XCyudZaY0Xr+Vb0G3i+DhJP6gdrQ2ewTQzp0iLYipKjqXRsSGcnKDLNkDr1 pZgsLOg2TPDM433i04rBomQaso06NhbFuQs98JEwch5jAo/5C4f29AWW3k1KDFSzkmaI lYV8ZfEbtn3Yn9u0Q2KtdUV5mvqd8kRMXah8lIHrPeN0DZfYW1GsrFBrIK1s5dZe5lLO saHw== X-Forwarded-Encrypted: i=1; AJvYcCXFlg2codiVZcjV1mvObPuUgUjk6khzPycNb5X4tZYW7n71rMugPqXfpesF71QOmq/S9SnI4OmhcVz9TAw=@vger.kernel.org X-Gm-Message-State: AOJu0Yy2bwgNSIBceHve/lrybzBPbiJtPI12eemuBkayHOF3sqKPCsCe nT7dNb4qtAXp/dTbUloqInAueppEQSwFT8bgWoO9sVtveorO2KXKK+4X3WhM/EhCI/opUJtzOuG 6 X-Google-Smtp-Source: AGHT+IEklgHT9dpWQRJxz1ElVFna2TN0was+5e+f5zgBUGOIrvtxsRvWEwABxvdFXIu2DgNklS5fzw== X-Received: by 2002:a05:6e02:184e:b0:39f:6180:afca with SMTP id e9e14a558f8ab-3a0c8cd7625mr153791675ab.13.1727193435794; Tue, 24 Sep 2024 08:57:15 -0700 (PDT) Received: from localhost.localdomain ([38.175.170.29]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a1a5713b64sm4492035ab.58.2024.09.24.08.57.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2024 08:57:15 -0700 (PDT) From: Shuah Khan To: jstultz@google.com, tglx@linutronix.de, sboyd@kernel.org, shuah@kernel.org Cc: Shuah Khan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH 2/2] selftests: timers: Remove local NSEC_PER_SEC and USEC_PER_SEC defines Date: Tue, 24 Sep 2024 09:56:47 -0600 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Remove local NSEC_PER_SEC and USEC_PER_SEC defines. Pick them up from include/vdso/time64.h. This requires -I $(top_srcdir) to the timers Makefile to include the include/vdso/time64.h. posix_timers test names the defines NSECS_PER_SEC and USECS_PER_SEC. Include the include/vdso/time64.h and change NSECS_PER_SEC and USECS_PER_SEC references to NSEC_PER_SEC and USEC_PER_SEC respectively. Signed-off-by: Shuah Khan Acked-by: Thomas Gleixner --- tools/testing/selftests/timers/Makefile | 2 +- tools/testing/selftests/timers/adjtick.c | 4 +--- .../testing/selftests/timers/alarmtimer-suspend.c | 2 +- .../selftests/timers/inconsistency-check.c | 2 +- tools/testing/selftests/timers/leap-a-day.c | 2 +- tools/testing/selftests/timers/mqueue-lat.c | 2 +- tools/testing/selftests/timers/nanosleep.c | 3 +-- tools/testing/selftests/timers/posix_timers.c | 15 +++++++-------- tools/testing/selftests/timers/raw_skew.c | 2 +- tools/testing/selftests/timers/set-2038.c | 3 +-- tools/testing/selftests/timers/set-timer-lat.c | 3 +-- tools/testing/selftests/timers/valid-adjtimex.c | 4 +--- 12 files changed, 18 insertions(+), 26 deletions(-) diff --git a/tools/testing/selftests/timers/Makefile b/tools/testing/selfte= sts/timers/Makefile index 0e73a16874c4..32203593c62e 100644 --- a/tools/testing/selftests/timers/Makefile +++ b/tools/testing/selftests/timers/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -CFLAGS +=3D -O3 -Wl,-no-as-needed -Wall +CFLAGS +=3D -O3 -Wl,-no-as-needed -Wall -I $(top_srcdir) LDLIBS +=3D -lrt -lpthread -lm =20 # these are all "safe" tests that don't modify diff --git a/tools/testing/selftests/timers/adjtick.c b/tools/testing/selft= ests/timers/adjtick.c index 205b76a4abb4..cb9a30f54662 100644 --- a/tools/testing/selftests/timers/adjtick.c +++ b/tools/testing/selftests/timers/adjtick.c @@ -22,14 +22,12 @@ #include #include #include +#include =20 #include "../kselftest.h" =20 #define CLOCK_MONOTONIC_RAW 4 =20 -#define NSEC_PER_SEC 1000000000LL -#define USEC_PER_SEC 1000000 - #define MILLION 1000000 =20 long systick; diff --git a/tools/testing/selftests/timers/alarmtimer-suspend.c b/tools/te= sting/selftests/timers/alarmtimer-suspend.c index ad52e608b88e..62da2a3f949e 100644 --- a/tools/testing/selftests/timers/alarmtimer-suspend.c +++ b/tools/testing/selftests/timers/alarmtimer-suspend.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "../kselftest.h" =20 #define CLOCK_REALTIME 0 @@ -45,7 +46,6 @@ #define NR_CLOCKIDS 12 =20 =20 -#define NSEC_PER_SEC 1000000000ULL #define UNREASONABLE_LAT (NSEC_PER_SEC * 5) /* hopefully we resume in 5 se= cs */ =20 #define SUSPEND_SECS 15 diff --git a/tools/testing/selftests/timers/inconsistency-check.c b/tools/t= esting/selftests/timers/inconsistency-check.c index 36a49fba6c9b..75650cf0503f 100644 --- a/tools/testing/selftests/timers/inconsistency-check.c +++ b/tools/testing/selftests/timers/inconsistency-check.c @@ -28,10 +28,10 @@ #include #include #include +#include #include "../kselftest.h" =20 #define CALLS_PER_LOOP 64 -#define NSEC_PER_SEC 1000000000ULL =20 #define CLOCK_REALTIME 0 #define CLOCK_MONOTONIC 1 diff --git a/tools/testing/selftests/timers/leap-a-day.c b/tools/testing/se= lftests/timers/leap-a-day.c index 986abbdb1521..04004a7c0934 100644 --- a/tools/testing/selftests/timers/leap-a-day.c +++ b/tools/testing/selftests/timers/leap-a-day.c @@ -48,9 +48,9 @@ #include #include #include +#include #include "../kselftest.h" =20 -#define NSEC_PER_SEC 1000000000ULL #define CLOCK_TAI 11 =20 time_t next_leap; diff --git a/tools/testing/selftests/timers/mqueue-lat.c b/tools/testing/se= lftests/timers/mqueue-lat.c index f3179a605bba..63de2334a291 100644 --- a/tools/testing/selftests/timers/mqueue-lat.c +++ b/tools/testing/selftests/timers/mqueue-lat.c @@ -29,9 +29,9 @@ #include #include #include +#include #include "../kselftest.h" =20 -#define NSEC_PER_SEC 1000000000ULL =20 #define TARGET_TIMEOUT 100000000 /* 100ms in nanoseconds */ #define UNRESONABLE_LATENCY 40000000 /* 40ms in nanosecs */ diff --git a/tools/testing/selftests/timers/nanosleep.c b/tools/testing/sel= ftests/timers/nanosleep.c index df1d03516e7b..9a354e38a569 100644 --- a/tools/testing/selftests/timers/nanosleep.c +++ b/tools/testing/selftests/timers/nanosleep.c @@ -27,10 +27,9 @@ #include #include #include +#include #include "../kselftest.h" =20 -#define NSEC_PER_SEC 1000000000ULL - #define CLOCK_REALTIME 0 #define CLOCK_MONOTONIC 1 #define CLOCK_PROCESS_CPUTIME_ID 2 diff --git a/tools/testing/selftests/timers/posix_timers.c b/tools/testing/= selftests/timers/posix_timers.c index ddb1cebc844e..9814b3a1c77d 100644 --- a/tools/testing/selftests/timers/posix_timers.c +++ b/tools/testing/selftests/timers/posix_timers.c @@ -15,13 +15,12 @@ #include #include #include +#include #include =20 #include "../kselftest.h" =20 #define DELAY 2 -#define USECS_PER_SEC 1000000 -#define NSECS_PER_SEC 1000000000 =20 static void __fatal_error(const char *test, const char *name, const char *= what) { @@ -86,9 +85,9 @@ static int check_diff(struct timeval start, struct timeva= l end) long long diff; =20 diff =3D end.tv_usec - start.tv_usec; - diff +=3D (end.tv_sec - start.tv_sec) * USECS_PER_SEC; + diff +=3D (end.tv_sec - start.tv_sec) * USEC_PER_SEC; =20 - if (llabs(diff - DELAY * USECS_PER_SEC) > USECS_PER_SEC / 2) { + if (llabs(diff - DELAY * USEC_PER_SEC) > USEC_PER_SEC / 2) { printf("Diff too high: %lld..", diff); return -1; } @@ -448,7 +447,7 @@ static inline int64_t calcdiff_ns(struct timespec t1, s= truct timespec t2) { int64_t diff; =20 - diff =3D NSECS_PER_SEC * (int64_t)((int) t1.tv_sec - (int) t2.tv_sec); + diff =3D NSEC_PER_SEC * (int64_t)((int) t1.tv_sec - (int) t2.tv_sec); diff +=3D ((int) t1.tv_nsec - (int) t2.tv_nsec); return diff; } @@ -479,7 +478,7 @@ static void check_sigev_none(int which, const char *nam= e) do { if (clock_gettime(which, &now)) fatal_error(name, "clock_gettime()"); - } while (calcdiff_ns(now, start) < NSECS_PER_SEC); + } while (calcdiff_ns(now, start) < NSEC_PER_SEC); =20 if (timer_gettime(timerid, &its)) fatal_error(name, "timer_gettime()"); @@ -536,7 +535,7 @@ static void check_gettime(int which, const char *name) wraps++; prev =3D its; =20 - } while (calcdiff_ns(now, start) < NSECS_PER_SEC); + } while (calcdiff_ns(now, start) < NSEC_PER_SEC); =20 if (timer_delete(timerid)) fatal_error(name, "timer_delete()"); @@ -587,7 +586,7 @@ static void check_overrun(int which, const char *name) do { if (clock_gettime(which, &now)) fatal_error(name, "clock_gettime()"); - } while (calcdiff_ns(now, start) < NSECS_PER_SEC); + } while (calcdiff_ns(now, start) < NSEC_PER_SEC); =20 /* Unblock it, which should deliver a signal */ if (sigprocmask(SIG_UNBLOCK, &set, NULL)) diff --git a/tools/testing/selftests/timers/raw_skew.c b/tools/testing/self= tests/timers/raw_skew.c index 030143eb09b4..ea50e4efc422 100644 --- a/tools/testing/selftests/timers/raw_skew.c +++ b/tools/testing/selftests/timers/raw_skew.c @@ -25,10 +25,10 @@ #include #include #include +#include #include "../kselftest.h" =20 #define CLOCK_MONOTONIC_RAW 4 -#define NSEC_PER_SEC 1000000000LL =20 #define shift_right(x, s) ({ \ __typeof__(x) __x =3D (x); \ diff --git a/tools/testing/selftests/timers/set-2038.c b/tools/testing/self= tests/timers/set-2038.c index f7d978721b9e..ed244315e11c 100644 --- a/tools/testing/selftests/timers/set-2038.c +++ b/tools/testing/selftests/timers/set-2038.c @@ -27,10 +27,9 @@ #include #include #include +#include #include "../kselftest.h" =20 -#define NSEC_PER_SEC 1000000000LL - #define KTIME_MAX ((long long)~((unsigned long long)1 << 63)) #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) =20 diff --git a/tools/testing/selftests/timers/set-timer-lat.c b/tools/testing= /selftests/timers/set-timer-lat.c index 7ce240c89b21..5365e9ae61c3 100644 --- a/tools/testing/selftests/timers/set-timer-lat.c +++ b/tools/testing/selftests/timers/set-timer-lat.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "../kselftest.h" =20 #define CLOCK_REALTIME 0 @@ -44,8 +45,6 @@ #define CLOCK_TAI 11 #define NR_CLOCKIDS 12 =20 - -#define NSEC_PER_SEC 1000000000ULL #define UNRESONABLE_LATENCY 40000000 /* 40ms in nanosecs */ =20 #define TIMER_SECS 1 diff --git a/tools/testing/selftests/timers/valid-adjtimex.c b/tools/testin= g/selftests/timers/valid-adjtimex.c index d500884801d8..6b7801055ad1 100644 --- a/tools/testing/selftests/timers/valid-adjtimex.c +++ b/tools/testing/selftests/timers/valid-adjtimex.c @@ -29,11 +29,9 @@ #include #include #include +#include #include "../kselftest.h" =20 -#define NSEC_PER_SEC 1000000000LL -#define USEC_PER_SEC 1000000LL - #define ADJ_SETOFFSET 0x0100 =20 #include --=20 2.40.1