Function report |
Source Code:kernel\bpf\cgroup.c |
Create Date:2022-07-28 13:27:39 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:__cgroup_bpf_attach() - Attach the program to a cgroup, and* propagate the change to descendants*@cgrp: The cgroup which descendants to traverse*@prog: A program to attach*@type: Type of attach operation*@flags: Option flags
Proto:int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog, enum bpf_attach_type type, u32 flags)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
struct cgroup * | cgrp | |
struct bpf_prog * | prog | |
enum bpf_attach_type | type | |
u32 | flags |
303 | struct bpf_cgroup_storage * storage[__BPF_CGROUP_STORAGE_MAX], * old_storage[__BPF_CGROUP_STORAGE_MAX] = {NULL} |
310 | If flags & cgroup-bpf attach flags used in BPF_PROG_ATTACH command* NONE(default): No further bpf programs allowed in the subtree && flags & BPF_F_ALLOW_MULTI Then Return -EINVAL |
314 | If Not parent has non-overridable prog attached,* disallow attaching new programs to the descendent cgroup.* if parent has overridable or multi-prog, allow attaching Then Return -EPERM |
317 | If Not list_empty - tests whether a list is empty*@head: the list to test. && flags[type] != flags Then Return -EPERM |
324 | If number of elements in the list.* it's slow but the list cannot be long >= BPF_CGROUP_MAX_PROGS Then Return -E2BIG |
328 | storage[stype] = bpf_cgroup_storage_alloc(prog, stype) |
333 | Return -ENOMEM |
337 | If flags & BPF_F_ALLOW_MULTI Then |
343 | Return -EINVAL |
347 | pl = Allocation memory |
348 | If Not pl Then |
351 | Return -ENOMEM |
354 | pl_was_allocated = true |
359 | Else |
369 | Else |
373 | old_storage[stype] = storage[stype] |
376 | pl_was_allocated = false |
385 | err = update_effective_progs(cgrp, type) |
391 | If Not old_storage[stype] Then Continue |
395 | If old_prog Then |
396 | bpf_prog_put(old_prog) |
400 | bpf_cgroup_storage_link(storage[stype], cgrp, type) |
401 | Return 0 |
403 | cleanup : |
408 | storage[stype] = old_storage[stype] |
409 | bpf_cgroup_storage_link(old_storage[stype], cgrp, type) |
411 | If pl_was_allocated Then |
415 | Return err |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |