History

bpf: introduce bpf_get_current_task() helper

over time there were multiple requests to access different data structures and fields of task_struct current, so finally add the helper to access 'current' as-is. Tracing bpf programs will do the rest of walking the pointers via bpf_probe_read(). Note that current can be null and bpf program has to deal it with, but even dumb passing null into bpf_probe_read() is still safe.

Alexei Starovoitov committed 10 years ago

Commit 606274c1 parent d3902382 files · +20 −0Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/bpf.h+7−0
@@ -357,6 +357,13 @@ enum bpf_func_id { · 356 unmodified lines
357 */357 */
358 BPF_FUNC_get_hash_recalc,358 BPF_FUNC_get_hash_recalc,
359 359
360 /**
361 * u64 bpf_get_current_task(void)
362 * Returns current task_struct
363 * Return: current
364 */
365 BPF_FUNC_get_current_task,
366
360 __BPF_FUNC_MAX_ID,367 __BPF_FUNC_MAX_ID,
361};368};
362 369

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t