Skip to content

Helper function bpf_strtoul

v5.2

Definition

Copyright (c) 2015 The Libbpf Authors. All rights reserved.

Convert the initial part of the string from buffer buf of size buf_len to an unsigned long integer according to the given base and save the result in res.

The string may begin with an arbitrary amount of white space (as determined by isspace(3)).

Five least significant bits of flags encode base, other bits are currently unused.

Base must be either 8, 10, 16 or 0 to detect it automatically similar to user space strtoul(3).

Returns

Number of characters consumed on success. Must be positive but no more than buf_len.

-EINVAL if no valid digits were found or unsupported base was provided.

-ERANGE if resulting value was out of range.

static long (* const bpf_strtoul)(const char *buf, unsigned long buf_len, __u64 flags, unsigned long *res) = (void *) 106;

Usage

Docs could be improved

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

Program types

This helper call can be used in the following program types:

Example

Docs could be improved

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