bpf_strcasestr(9)
π bpf_strcasestr π
okay so this is a page from the Kernel API Manual (section 9, kernel API, iykyk), and it's all about bpf_strcasestr β the function that finds the first substring in a string while ignoring the case of the characters. literally the "i don't care if you're shouting" version of a substring search π«Ά
β¨ NAME β¨
bpf_strcasestr β find the first substring in a string, ignoring the case of the characters π
π SYNOPSIS π
__bpf_kfunc int bpf_strcasestr (const char *s1__ign , const char *s2__ign );
that's the whole signature bestie, no cap. two const char * args, both marked __ign, returns an int, and it's a __bpf_kfunc π
πΈ ARGUMENTS πΈ
s1__ignβ the string to be searched. this is the one you're digging through, the main character of the search πs2__ignβ the string to search for. the little guy you're looking for insides1__ignπ£
π RETURN π
here's the vibe check on what you get back β it's an int, so read the sign, okay?
>=0β index of the first character of the first occurrence ofs2__ignwithins1__ignβ (zero or bigger = found it, and here's exactly where it starts)-ENOENTβs2__ignis not a substring ofs1__ignπ (it's just not in there, sorry bestie)-EFAULTβ cannot read one of the strings π (something's not readable)-E2BIGβ one of the strings is too large π (that string ate and then ate some more)-ERANGEβ one of the strings is outside of kernel address space π« (not our address space, not our problem)
fr fr, check the return value every time. 0 and up is a hit, negative is a hard no β and each negative has a different reason, so don't lump them together π
π¦ SEE ALSO π¦
so many friends π first up, the kernel file: ./kernel/bpf/helpers.c β that's where the family lives. then, the whole crew:
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_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)
the string-search girlies in particular βbpf_strstr(9),bpf_strnstr(9),bpf_strcasecmp(9),bpf_strncasestr(9)β are literally siblings of this one, so go say hi πΈ
that's the whole page bestie, no notes π
this one ships out of ./kernel/bpf and it's dated October 2026 β mwah, go find your substrings πβ¨π«Ά
π¦ 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