Sync bpf_strtoX related bpf UAPI changes to tools/.
Showing the changes to tools/include/uapi/linux (1 of 1 file). Show all
Unified · Split
| @@ -2575,6 +2575,53 @@ union bpf_attr { · 2574 unmodified lines | ||
| 2575 | 2575 | * **-E2BIG** if the *buf_len* is too big. |
| 2576 | 2576 | * |
| 2577 | 2577 | * **-EINVAL** if sysctl is being read. |
| 2578 | + * | |
| 2579 | + * int bpf_strtol(const char *buf, size_t buf_len, u64 flags, long *res) | |
| 2580 | + * Description | |
| 2581 | + * Convert the initial part of the string from buffer *buf* of | |
| 2582 | + * size *buf_len* to a long integer according to the given base | |
| 2583 | + * and save the result in *res*. | |
| 2584 | + * | |
| 2585 | + * The string may begin with an arbitrary amount of white space | |
| 2586 | + * (as determined by isspace(3)) followed by a single optional '-' | |
| 2587 | + * sign. | |
| 2588 | + * | |
| 2589 | + * Five least significant bits of *flags* encode base, other bits | |
| 2590 | + * are currently unused. | |
| 2591 | + * | |
| 2592 | + * Base must be either 8, 10, 16 or 0 to detect it automatically | |
| 2593 | + * similar to user space strtol(3). | |
| 2594 | + * Return | |
| 2595 | + * Number of characters consumed on success. Must be positive but | |
| 2596 | + * no more than buf_len. | |
| 2597 | + * | |
| 2598 | + * **-EINVAL** if no valid digits were found or unsupported base | |
| 2599 | + * was provided. | |
| 2600 | + * | |
| 2601 | + * **-ERANGE** if resulting value was out of range. | |
| 2602 | + * | |
| 2603 | + * int bpf_strtoul(const char *buf, size_t buf_len, u64 flags, unsigned long *res) | |
| 2604 | + * Description | |
| 2605 | + * Convert the initial part of the string from buffer *buf* of | |
| 2606 | + * size *buf_len* to an unsigned long integer according to the | |
| 2607 | + * given base and save the result in *res*. | |
| 2608 | + * | |
| 2609 | + * The string may begin with an arbitrary amount of white space | |
| 2610 | + * (as determined by isspace(3)). | |
| 2611 | + * | |
| 2612 | + * Five least significant bits of *flags* encode base, other bits | |
| 2613 | + * are currently unused. | |
| 2614 | + * | |
| 2615 | + * Base must be either 8, 10, 16 or 0 to detect it automatically | |
| 2616 | + * similar to user space strtoul(3). | |
| 2617 | + * Return | |
| 2618 | + * Number of characters consumed on success. Must be positive but | |
| 2619 | + * no more than buf_len. | |
| 2620 | + * | |
| 2621 | + * **-EINVAL** if no valid digits were found or unsupported base | |
| 2622 | + * was provided. | |
| 2623 | + * | |
| 2624 | + * **-ERANGE** if resulting value was out of range. | |
| 2578 | 2625 | */ |
| 2579 | 2626 | #define __BPF_FUNC_MAPPER(FN) \ |
| 2580 | 2627 | FN(unspec), \ |
| @@ -2681,7 +2728,9 @@ union bpf_attr { · 100 unmodified lines | ||
| 2681 | 2728 | FN(sysctl_get_name), \ |
| 2682 | 2729 | FN(sysctl_get_current_value), \ |
| 2683 | 2730 | FN(sysctl_get_new_value), \ |
| 2684 | − FN(sysctl_set_new_value), | |
| 2731 | + FN(sysctl_set_new_value), \ | |
| 2732 | + FN(strtol), \ | |
| 2733 | + FN(strtoul), | |
| 2685 | 2734 | |
| 2686 | 2735 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper |
| 2687 | 2736 | * function eBPF program intends to call |