Naresh Kamboju <naresh.kamboju@xxxxxxxxxx> writes: > On Tue, 17 Dec 2019 at 00:00, Toke Høiland-Jørgensen <toke@xxxxxxxxxx> wrote: >> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c >> index a2cc7313763a..3fe42d6b0c2f 100644 >> --- a/tools/lib/bpf/libbpf.c >> +++ b/tools/lib/bpf/libbpf.c >> @@ -41,6 +41,7 @@ >> #include <sys/types.h> >> #include <sys/vfs.h> >> #include <sys/utsname.h> >> +#include <sys/resource.h> >> #include <tools/libc_compat.h> >> #include <libelf.h> >> #include <gelf.h> >> @@ -100,6 +101,32 @@ void libbpf_print(enum libbpf_print_level level, const char *format, ...) >> va_end(args); >> } >> >> +static void pr_perm_msg(int err) >> +{ >> + struct rlimit limit; >> + char buf[100]; >> + >> + if (err != -EPERM || geteuid() != 0) >> + return; >> + >> + err = getrlimit(RLIMIT_MEMLOCK, &limit); >> + if (err) >> + return; >> + >> + if (limit.rlim_cur == RLIM_INFINITY) >> + return; >> + >> + if (limit.rlim_cur < 1024) >> + snprintf(buf, sizeof(buf), "%lu bytes", limit.rlim_cur); > > libbpf.c: In function 'pr_perm_msg': > libbpf.c:120:33: error: format '%lu' expects argument of type 'long > unsigned int', but argument 4 has type 'rlim_t {aka long long unsigned > int}' [-Werror=format=] > snprintf(buf, sizeof(buf), "%lu bytes", limit.rlim_cur); > ~~^ ~~~~~~~~~~~~~~ > %llu > Ah, guess this needs PRIu64. Will send a follow-up, thanks for the report :) -Toke