]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
tools/bpf: sync uapi bpf.h for bpf_get_current_cgroup_id() helper
authorYonghong Song <yhs@fb.com>
Sun, 3 Jun 2018 22:59:42 +0000 (15:59 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 4 Jun 2018 01:22:41 +0000 (18:22 -0700)
Sync kernel uapi/linux/bpf.h with tools uapi/linux/bpf.h.
Also add the necessary helper define in bpf_helpers.h.

Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/include/uapi/linux/bpf.h
tools/testing/selftests/bpf/bpf_helpers.h

index f0b6608b1f1cad4268a6ff4b4a96ea9ca15541e7..18712b0dbfe7c749fbd36d82218e0ece95cdd5ca 100644 (file)
@@ -2070,6 +2070,11 @@ union bpf_attr {
  *             **CONFIG_SOCK_CGROUP_DATA** configuration option.
  *     Return
  *             The id is returned or 0 in case the id could not be retrieved.
+ *
+ * u64 bpf_get_current_cgroup_id(void)
+ *     Return
+ *             A 64-bit integer containing the current cgroup id based
+ *             on the cgroup within which the current task is running.
  */
 #define __BPF_FUNC_MAPPER(FN)          \
        FN(unspec),                     \
@@ -2151,7 +2156,8 @@ union bpf_attr {
        FN(lwt_seg6_action),            \
        FN(rc_repeat),                  \
        FN(rc_keydown),                 \
-       FN(skb_cgroup_id),
+       FN(skb_cgroup_id),              \
+       FN(get_current_cgroup_id),
 
 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
  * function eBPF program intends to call
index a66a9d91acf4c23e660188268877dc56918773d5..f2f28b6c89151d91eb7819b5e0f835afd4c9944a 100644 (file)
@@ -131,6 +131,8 @@ static int (*bpf_rc_repeat)(void *ctx) =
 static int (*bpf_rc_keydown)(void *ctx, unsigned int protocol,
                             unsigned long long scancode, unsigned int toggle) =
        (void *) BPF_FUNC_rc_keydown;
+static unsigned long long (*bpf_get_current_cgroup_id)(void) =
+       (void *) BPF_FUNC_get_current_cgroup_id;
 
 /* llvm builtin functions that eBPF C program may use to
  * emit BPF_LD_ABS and BPF_LD_IND instructions