Skip to content

KFunc bpf_strnchr

v6.17

Find a character in a length limited string

Definition

Note

The NULL-terminator is considered part of the string, and can be searched for.

Parameters

s__ign: The string to be searched

count: The number of characters to be searched

c: The character to search for

Returns

  • >=0 - Index of the first occurrence of c within s__ign
  • -ENOENT - c not found in the first @count characters of s__ign
  • -EFAULT - Cannot read s__ign
  • -E2BIG - s__ign is too large
  • -ERANGE - s__ign is outside of kernel address space

Signature

int bpf_strnchr(const char *s__ign, size_t count, char c)

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