summaryrefslogtreecommitdiff
path: root/tools/include
diff options
context:
space:
mode:
authorFlorent Revest <revest@chromium.org>2021-02-10 14:14:03 +0300
committerAlexei Starovoitov <ast@kernel.org>2021-02-12 04:44:41 +0300
commitc5dbb89fc2ac013afe67b9e4fcb3743c02b567cd (patch)
tree717c986e70611b002a57850957d7132121c7ec9f /tools/include
parent07881ccbf40cc7893869f3f170301889ddca54ac (diff)
downloadlinux-c5dbb89fc2ac013afe67b9e4fcb3743c02b567cd.tar.xz
bpf: Expose bpf_get_socket_cookie to tracing programs
This needs a new helper that: - can work in a sleepable context (using sock_gen_cookie) - takes a struct sock pointer and checks that it's not NULL Signed-off-by: Florent Revest <revest@chromium.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: KP Singh <kpsingh@kernel.org> Acked-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20210210111406.785541-2-revest@chromium.org
Diffstat (limited to 'tools/include')
-rw-r--r--tools/include/uapi/linux/bpf.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index dbf10bf08582..07cc2e404291 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -1673,6 +1673,14 @@ union bpf_attr {
* Return
* A 8-byte long unique number.
*
+ * u64 bpf_get_socket_cookie(struct sock *sk)
+ * Description
+ * Equivalent to **bpf_get_socket_cookie**\ () helper that accepts
+ * *sk*, but gets socket from a BTF **struct sock**. This helper
+ * also works for sleepable programs.
+ * Return
+ * A 8-byte long unique number or 0 if *sk* is NULL.
+ *
* u32 bpf_get_socket_uid(struct sk_buff *skb)
* Return
* The owner UID of the socket associated to *skb*. If the socket