From: Jaime Saguillo Revilla <jaime.saguillo@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org,
Jaime Saguillo Revilla <jaime.saguillo@gmail.com>
Subject: [PATCH] proc: uptime: print 64-bit seconds values
Date: Mon, 22 Dec 2025 18:41:41 +0100 [thread overview]
Message-ID: <20251222174141.39277-1-jaime.saguillo@gmail.com> (raw)
uptime.tv_sec and idle.tv_sec are time64_t and may exceed unsigned
long on 32-bit kernels. Print them using a 64-bit format to avoid
truncation in /proc/uptime.
Signed-off-by: Jaime Saguillo Revilla <jaime.saguillo@gmail.com>
---
fs/proc/uptime.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c
index b5343d209381..2b83435ad01e 100644
--- a/fs/proc/uptime.c
+++ b/fs/proc/uptime.c
@@ -30,10 +30,10 @@ static int uptime_proc_show(struct seq_file *m, void *v)
idle.tv_sec = div_u64_rem(idle_nsec, NSEC_PER_SEC, &rem);
idle.tv_nsec = rem;
- seq_printf(m, "%lu.%02lu %lu.%02lu\n",
- (unsigned long) uptime.tv_sec,
+ seq_printf(m, "%lld.%02lu %lld.%02lu\n",
+ (long long) uptime.tv_sec,
(uptime.tv_nsec / (NSEC_PER_SEC / 100)),
- (unsigned long) idle.tv_sec,
+ (long long) idle.tv_sec,
(idle.tv_nsec / (NSEC_PER_SEC / 100)));
return 0;
}
--
2.43.0
reply other threads:[~2025-12-22 17:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251222174141.39277-1-jaime.saguillo@gmail.com \
--to=jaime.saguillo@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox