From: Richard Palethorpe <rpalethorpe@suse.de>
To: Hui Min Mina Chou <minachou@andestech.com>
Cc: tim609@andestech.com, ltp@lists.linux.it, az70021@gmail.com
Subject: Re: [LTP] [PATCH] syscalls/getrusage04:Fix tst_resm() format string for 64bit offset
Date: Mon, 13 Feb 2023 11:34:05 +0000 [thread overview]
Message-ID: <878rh1pzj1.fsf@suse.de> (raw)
In-Reply-To: <20230207082041.1021333-1-minachou@andestech.com>
Hello,
Hui Min Mina Chou <minachou@andestech.com> writes:
> This patch fixes the incorrect output on 32bit platform.
> The correct way to print tv_usec is cast it to (long long) type and
> change the format string to %lld.
Merged, thanks!
>
> Signed-off-by: Hui Min Mina Chou <minachou@andestech.com>
> ---
> testcases/kernel/syscalls/getrusage/getrusage04.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/getrusage/getrusage04.c b/testcases/kernel/syscalls/getrusage/getrusage04.c
> index 06b576d79..b03bc549b 100644
> --- a/testcases/kernel/syscalls/getrusage/getrusage04.c
> +++ b/testcases/kernel/syscalls/getrusage/getrusage04.c
> @@ -104,8 +104,9 @@ int main(int argc, char *argv[])
> tst_count = 0;
> i = 0;
> SAFE_GETRUSAGE(cleanup, RUSAGE_THREAD, &usage);
> - tst_resm(TINFO, "utime:%12luus; stime:%12luus",
> - usage.ru_utime.tv_usec, usage.ru_stime.tv_usec);
> + tst_resm(TINFO, "utime:%12lldus; stime:%12lldus",
> + (long long)usage.ru_utime.tv_usec,
> + (long long)usage.ru_stime.tv_usec);
> ulast = usage.ru_utime.tv_usec;
> slast = usage.ru_stime.tv_usec;
>
> @@ -115,9 +116,9 @@ int main(int argc, char *argv[])
> sdelta = usage.ru_stime.tv_usec - slast;
> if (udelta > 0 || sdelta > 0) {
> i++;
> - tst_resm(TINFO, "utime:%12luus; stime:%12luus",
> - usage.ru_utime.tv_usec,
> - usage.ru_stime.tv_usec);
> + tst_resm(TINFO, "utime:%12lldus; stime:%12lldus",
> + (long long)usage.ru_utime.tv_usec,
> + (long long)usage.ru_stime.tv_usec);
> if ((long)udelta > 1000 + (BIAS_MAX * factor_nr)) {
> sprintf(msg_string,
> "utime increased > %ldus:",
> --
> 2.34.1
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2023-02-13 11:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-07 8:20 [LTP] [PATCH] syscalls/getrusage04:Fix tst_resm() format string for 64bit offset Hui Min Mina Chou
2023-02-13 11:34 ` Richard Palethorpe [this message]
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=878rh1pzj1.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=az70021@gmail.com \
--cc=ltp@lists.linux.it \
--cc=minachou@andestech.com \
--cc=tim609@andestech.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.