Commit 618ec9a7 authored by Alexei Starovoitov's avatar Alexei Starovoitov Committed by David S. Miller

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: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 557c0c6e
...@@ -158,8 +158,11 @@ static int load_maps(struct bpf_map_def *maps, int len) ...@@ -158,8 +158,11 @@ static int load_maps(struct bpf_map_def *maps, int len)
maps[i].key_size, maps[i].key_size,
maps[i].value_size, maps[i].value_size,
maps[i].max_entries); 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; return 1;
}
if (maps[i].type == BPF_MAP_TYPE_PROG_ARRAY) if (maps[i].type == BPF_MAP_TYPE_PROG_ARRAY)
prog_array_fd = map_fd[i]; prog_array_fd = map_fd[i];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment