bpf_timer_cancel_async(9)
π bpf_timer_cancel_async β the gen-z guide to bailing on a timer
okay so you found bpf_timer_cancel_async(9) in the Kernel API Manual and you're like "bestie what does this even do" β don't worry, i gotchu. short version: it tries to deactivate a timer. that's the whole vibe. π
β¨ NAME β¨
bpf_timer_cancel_async β try to deactivate a timer, no cap π°οΈ
πΈ SYNOPSIS πΈ
__bpf_kfunc int bpf_timer_cancel_async (struct bpf_timer *timer );
literally the entire signature, copy it exactly, don't be weird about the spacing π«Ά
π¦ ARGUMENTS π¦
timerβ thebpf_timeryou wanna stop. that's it. that's the arg. she's the main character of this function π
π₯ DESCRIPTION π₯
so you're calling this to try to deactivate a timer, and the function is gonna come back at you with one of these bad boys. read the return value carefully because it's giving very different energy depending on which one you get π
0when the timer was not active π΄1when the timer was active β‘-1when the timer is currently executing the callback function and cannot be stopped π like it's literally mid-callback, you cannot touch her-ECANCELEDwhen the timer will be cancelled asynchronously ποΈ ok so it's not done yet, but it's been handled β patience, bestie-ENOMEMwhen out of memory π classic-EINVALwhen the timer was not initialized π© so you skipped a step, huh-ENOENTwhen this kfunc is racing with timer deletion π yes it's a race, no you're not winning it on purpose
ngl the difference between-1and-ECANCELEDis the whole personality of this function β one says "can't stop her", the other says "she's on her way out." know which one you got. π
π SEE ALSO π
kernel file ./kernel/bpf/helpers.c, plus the whole group chat:
bpf_obj_new(9)bpf_percpu_obj_new(9)bpf_obj_drop(9)bpf_percpu_obj_drop(9)bpf_refcount_acquire(9)bpf_list_push_front(9)bpf_list_push_back(9)bpf_rbtree_add(9)bpf_task_acquire(9)bpf_task_release(9)bpf_cgroup_acquire(9)bpf_cgroup_release(9)bpf_cgroup_ancestor(9)bpf_cgroup_from_id(9)bpf_task_under_cgroup(9)bpf_task_get_cgroup1(9)bpf_task_from_pid(9)bpf_task_from_vpid(9)bpf_dynptr_slice(9)bpf_dynptr_slice_rdwr(9)bpf_dynptr_copy(9)bpf_dynptr_memset(9)bpf_iter_bits_new(9)bpf_iter_bits_next(9)bpf_iter_bits_destroy(9)bpf_copy_from_user_str(9)bpf_copy_from_user_task_str(9)bpf_strcmp(9)bpf_strcasecmp(9)bpf_strnchr(9)bpf_strchr(9)bpf_strchrnul(9)bpf_strrchr(9)bpf_strnlen(9)bpf_strlen(9)bpf_strspn(9)bpf_strcspn(9)bpf_strstr(9)bpf_strcasestr(9)bpf_strnstr(9)bpf_strncasestr(9)bpf_lookup_user_key(9)bpf_lookup_system_key(9)bpf_key_put(9)bpf_verify_pkcs7_signature(9)bpf_task_work_schedule_signal(9)bpf_task_work_schedule_resume(9)
like. all of them. every single one. go read them, i'll wait π
okay that's the whole page, go touch some bpf_timers π
sign-off time β¨ this one lives in ./kernel/bpf, dated October 2026, and we're officially done β slay, periodt, bye π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms