Skip to content

KFunc bpf_strstr

v6.17

Find the first sub-string in a string

Definition

Parameters

s1__ign: The string to be searched

s2__ign: The string to search for

Return

  • >=0 - Index of the first character of the first occurrence of s2__ig within s1__ign
  • -ENOENT - s2__ign is not a substring of s1__ign
  • -EFAULT - Cannot read one of the strings
  • -E2BIG - One of the strings is too large
  • -ERANGE - One of the strings is outside of kernel address space

Signature

int bpf_strstr(const char *s1__ign, const char *s2__ign)

Usage

Docs could be improved

This part of the docs is incomplete, contributions are very welcome

Program types

The following program types can make use of this kfunc:

Example

Docs could be improved

This part of the docs is incomplete, contributions are very welcome