diff options
author | Alexei Starovoitov <ast@plumgrid.com> | 2014-11-13 17:36:47 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-11-18 13:43:59 -0500 |
commit | a1854d6ac0008518bfc45e791172ad250999c2a2 (patch) | |
tree | 20a92b168b05e32b66e0e21007e406a925acb84b /samples/bpf | |
parent | 28fbcfa08d8ed7c5a50d41a0433aad222835e8e3 (diff) | |
download | op-kernel-dev-a1854d6ac0008518bfc45e791172ad250999c2a2.zip op-kernel-dev-a1854d6ac0008518bfc45e791172ad250999c2a2.tar.gz |
bpf: fix BPF_MAP_LOOKUP_ELEM command return code
fix errno of BPF_MAP_LOOKUP_ELEM command as bpf manpage
described it in commit b4fc1a460f30("Merge branch 'bpf-next'"):
-----
BPF_MAP_LOOKUP_ELEM
int bpf_lookup_elem(int fd, void *key, void *value)
{
union bpf_attr attr = {
.map_fd = fd,
.key = ptr_to_u64(key),
.value = ptr_to_u64(value),
};
return bpf(BPF_MAP_LOOKUP_ELEM, &attr, sizeof(attr));
}
bpf() syscall looks up an element with given key in a map fd.
If element is found it returns zero and stores element's value
into value. If element is not found it returns -1 and sets
errno to ENOENT.
and further down in manpage:
ENOENT For BPF_MAP_LOOKUP_ELEM or BPF_MAP_DELETE_ELEM, indicates that
element with given key was not found.
-----
In general all BPF commands return ENOENT when map element is not found
(including BPF_MAP_GET_NEXT_KEY and BPF_MAP_UPDATE_ELEM with
flags == BPF_MAP_UPDATE_ONLY)
Subsequent patch adds a testsuite to check return values for all of
these combinations.
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples/bpf')
0 files changed, 0 insertions, 0 deletions