* [PATCH] selftests/rlimits: print rlim_t as unsigned long long
@ 2026-11-03 15:55 Sasha Levin
0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2026-11-03 15:55 UTC (permalink / raw)
To: Shuah Khan; +Cc: linux-kselftest, linux-kernel
On 32-bit architectures with _FILE_OFFSET_BITS=64, rlim_t is an unsigned
long long, and printing it with %ld warns:
rlimits-per-userns.c:38:49: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'rlim_t' {aka 'long long unsigned int'} [-Wformat=]
Cast it to unsigned long long and print it with %llu.
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Found with a 32-bit build of the selftests with a 64-bit time_t (gcc 16
and clang 21 with -m32 -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64);
KernelCI's 32-bit arm builds show the same warnings. The changed files
build without format warnings there now, and the x86_64 builds don't
change. The other selftests get the same kind of fix in separate
patches.
tools/testing/selftests/rlimits/rlimits-per-userns.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/rlimits/rlimits-per-userns.c b/tools/testing/selftests/rlimits/rlimits-per-userns.c
index 26dc949e93eae..11bc65aca16b0 100644
--- a/tools/testing/selftests/rlimits/rlimits-per-userns.c
+++ b/tools/testing/selftests/rlimits/rlimits-per-userns.c
@@ -35,7 +35,7 @@ static void setrlimit_nproc(rlim_t n)
.rlim_max = n
};
- warnx("(pid=%d): Setting RLIMIT_NPROC=%ld", pid, n);
+ warnx("(pid=%d): Setting RLIMIT_NPROC=%llu", pid, (unsigned long long)n);
if (setrlimit(RLIMIT_NPROC, &limit) < 0)
err(EXIT_FAILURE, "(pid=%d): setrlimit(RLIMIT_NPROC)", pid);
--
2.53.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-03 15:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 15:55 [PATCH] selftests/rlimits: print rlim_t as unsigned long long Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®