All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] libbpf: Use PRIu64 when printing ulimit value
@ 2019-12-18 11:28 Toke Høiland-Jørgensen
  2019-12-18 15:37 ` Alexei Starovoitov
  0 siblings, 1 reply; 2+ messages in thread
From: Toke Høiland-Jørgensen @ 2019-12-18 11:28 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann
  Cc: Toke Høiland-Jørgensen, netdev, bpf, Naresh Kamboju

Naresh pointed out that libbpf builds fail on 32-bit architectures because
rlimit.rlim_cur is defined as 'unsigned long long' on those architectures.
Fix this by using the PRIu64 definition in printf.

Fixes: dc3a2d254782 ("libbpf: Print hint about ulimit when getting permission denied error")
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 3fe42d6b0c2f..ba31083998ce 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -117,7 +117,7 @@ static void pr_perm_msg(int err)
 		return;
 
 	if (limit.rlim_cur < 1024)
-		snprintf(buf, sizeof(buf), "%lu bytes", limit.rlim_cur);
+		snprintf(buf, sizeof(buf), "%"PRIu64" bytes", limit.rlim_cur);
 	else if (limit.rlim_cur < 1024*1024)
 		snprintf(buf, sizeof(buf), "%.1f KiB", (double)limit.rlim_cur / 1024);
 	else
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH bpf-next] libbpf: Use PRIu64 when printing ulimit value
  2019-12-18 11:28 [PATCH bpf-next] libbpf: Use PRIu64 when printing ulimit value Toke Høiland-Jørgensen
@ 2019-12-18 15:37 ` Alexei Starovoitov
  0 siblings, 0 replies; 2+ messages in thread
From: Alexei Starovoitov @ 2019-12-18 15:37 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen
  Cc: Alexei Starovoitov, Daniel Borkmann, Network Development, bpf,
	Naresh Kamboju

On Wed, Dec 18, 2019 at 3:28 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>
> Naresh pointed out that libbpf builds fail on 32-bit architectures because
> rlimit.rlim_cur is defined as 'unsigned long long' on those architectures.
> Fix this by using the PRIu64 definition in printf.
>
> Fixes: dc3a2d254782 ("libbpf: Print hint about ulimit when getting permission denied error")
> Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
> ---
>  tools/lib/bpf/libbpf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 3fe42d6b0c2f..ba31083998ce 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -117,7 +117,7 @@ static void pr_perm_msg(int err)
>                 return;
>
>         if (limit.rlim_cur < 1024)
> -               snprintf(buf, sizeof(buf), "%lu bytes", limit.rlim_cur);
> +               snprintf(buf, sizeof(buf), "%"PRIu64" bytes", limit.rlim_cur);

please use %zu and (size_t) cast like the rest of libbpf.
Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-18 15:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 11:28 [PATCH bpf-next] libbpf: Use PRIu64 when printing ulimit value Toke Høiland-Jørgensen
2019-12-18 15:37 ` Alexei Starovoitov

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.