summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@fb.com>2016-03-07 21:57:18 -0800
committerMichael Bestas <mkbestas@lineageos.org>2022-04-19 00:50:32 +0300
commitbba23d575b6fae5727ee4738b85a8348f62b2685 (patch)
tree367f81787a20747827d31757fcb71d6b78ff255f
parent1c5ae0cb8d8f69da2c71428bced1c957830e5e54 (diff)
samples/bpf: make map creation more verbose
map creation is typically the first one to fail when rlimits are too low, not enough memory, etc Make this failure scenario more verbose Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Chatur27 <jasonbright2709@gmail.com>
-rw-r--r--samples/bpf/bpf_load.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/samples/bpf/bpf_load.c b/samples/bpf/bpf_load.c
index e836b5ff2060..66e5af728798 100644
--- a/samples/bpf/bpf_load.c
+++ b/samples/bpf/bpf_load.c
@@ -158,8 +158,11 @@ static int load_maps(struct bpf_map_def *maps, int len)
maps[i].key_size,
maps[i].value_size,
maps[i].max_entries);
- if (map_fd[i] < 0)
+ if (map_fd[i] < 0) {
+ printf("failed to create a map: %d %s\n",
+ errno, strerror(errno));
return 1;
+ }
if (maps[i].type == BPF_MAP_TYPE_PROG_ARRAY)
prog_array_fd = map_fd[i];