bpf_strncasestr(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 inside s1__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 of s2__ign within the first len characters of s1__ign. found her! πŸŽ‰
  • -ENOENT β€” s2__ign not found in the first len characters of s1__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 🫢


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