bpf_strchr(9)
π NAME π
Okay so bpf_strchr(9) is the Kernel API Manual entry for bpf_strchr β the function that finds the first occurrence of a character in a string. Itβs giving βtiny search bar, but for one char,β and honestly? Iconic. β¨
β¨ SYNOPSIS β¨
The whole signature flex is:
__bpf_kfunc int bpf_strchr (const char *s__ign , char c );
π ARGUMENTS π
s__ignβ the string to be searched. This is the main character youβre scanning, bestie.cβ the character to search for. The one youβre hunting for, fr fr.
πΈ DESCRIPTION πΈ
Lowkey important detail: the NUL-terminator is considered part of the string here, and you can search for it too. Not me pointing that out because itβs exactly the kind of tiny thing that matters, but also yes. π«Ά
π₯ RETURN π₯
>=0β the index of the first occurrence ofcwithins__ign. Slay, found it.-ENOENTβcnot found ins__ign. Itβs not there, bestie, no cap.-EFAULTβ cannot reads__ign. The vibe check failed at read time. π-E2BIGβs__ignis too large. That string ate too much.-ERANGEβs__ignis outside of kernel address space. Not in the right neighborhood, periodt.
π SEE ALSO π
Kernel file ./kernel/bpf/helpers.c is the source-file bestie, and the whole cross-ref crew is here β every single one, no skipping:
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_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)bpf_timer_cancel_async(9)
Signed off from ./kernel/bpf β October 2026 β page bpf_strchr(9) π
π«Άβ¨
π¦ 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