bpf_strncasestr(9)
π bpf_strncasestr β the kernel API manual, but make it make sense
okay so real talk, this page is from the Kernel API Manual, section 9, and it's all about bpf_strncasestr(9). Bestie, it's a string-search girlie and she does NOT care about your capitals. Let's get into it π
β¨ NAME β¨
bpf_strncasestr β find the first substring in a length-limited string, ignoring the case of the characters π¦
like, she's strnstr but she's case-blind and she's thriving, no cap.
πΈ SYNOPSIS πΈ
__bpf_kfunc int bpf_strncasestr (const char *s1__ign , const char
* s2__ign , size_t len );
so it's __bpf_kfunc, it hands you back an int, and it takes three args. the __ign suffix on the pointers is just the kernel's little annotation moment β do not come for her π
π ARGUMENTS π
s1__ignβ the string to be searched. the main character. the one we're snooping around in πs2__ignβ the string to search for. the little icon we're hunting for insides1__ign.lenβ the maximum number of characters to search. think of it as the vibe check boundary β she stops looking past this many characters, periodt.
π RETURN π
bestie, here's what she can give you back:
>=0β index of the first character of the first occurrence ofs2__ignwithin the firstlencharacters ofs1__ign. found her! π-ENOENTβs2__ignnot found in the firstlencharacters ofs1__ign. she's not there, move on π-EFAULTβ cannot read one of the strings. ouch, invalid memory moment π-E2BIGβ one of the strings is too large. too much, even for us π-ERANGEβ one of the strings is outside of kernel address space. wrong neighborhood entirely π«
π₯ SEE ALSO π₯
okay this list is LONG and honestly iconic β it's the whole Kernel file ./kernel/bpf/helpers.c friend group. buckle up π«Ά
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_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)
ngl the whole "case-insensitive but only for len characters" thing is the entire personality of this function. respect it. π§
and that's the page, bestie! this little baddie lives at the path ./kernel/bpf, the version stamp on her birth certificate says October 2026, and she's filed under bpf_strncasestr(9) in the Kernel API Manual β slay, 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