The helper is used in tracing programs to cast a socket pointer to a unix_sock pointer. The return value could be NULL if the casting is illegal.
Showing the changes to include/uapi (1 of 6 files). Show all
Unified · Split
| @@ -4909,6 +4909,12 @@ union bpf_attr { · 4908 unmodified lines | ||
| 4909 | 4909 | * Return |
| 4910 | 4910 | * The number of bytes written to the buffer, or a negative error |
| 4911 | 4911 | * in case of failure. |
| 4912 | + * | |
| 4913 | + * struct unix_sock *bpf_skc_to_unix_sock(void *sk) | |
| 4914 | + * Description | |
| 4915 | + * Dynamically cast a *sk* pointer to a *unix_sock* pointer. | |
| 4916 | + * Return | |
| 4917 | + * *sk* if casting is valid, or **NULL** otherwise. | |
| 4912 | 4918 | */ |
| 4913 | 4919 | #define __BPF_FUNC_MAPPER(FN) \ |
| 4914 | 4920 | FN(unspec), \ |
| @@ -5089,6 +5095,7 @@ union bpf_attr { · 174 unmodified lines | ||
| 5089 | 5095 | FN(task_pt_regs), \ |
| 5090 | 5096 | FN(get_branch_snapshot), \ |
| 5091 | 5097 | FN(trace_vprintk), \ |
| 5098 | + FN(skc_to_unix_sock), \ | |
| 5092 | 5099 | /* */ |
| 5093 | 5100 | |
| 5094 | 5101 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper |