bpf_iter_bits_new(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so bestie, welcome to bpf_iter_bits_new(9) β€” yes, that's the page title β€” from the Kernel API Manual. It's giving "tiny setup function with main character energy," and we're gonna get you comfy with it πŸ’…βœ¨

πŸŽ€ NAME πŸŽ€

bpf_iter_bits_new β€” initialize a new bits iterator for a given memory area. That's the whole vibe: new iterator, specific memory area, let's go πŸ¦‹

✨ SYNOPSIS ✨

__bpf_kfunc int bpf_iter_bits_new (struct bpf_iter_bits *it , const u64 *unsafe_ptr__ign , u32 nr_words );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • it β€” the new bpf_iter_bits to be created. Fresh iterator, freshly created, periodt πŸ’–
  • unsafe_ptr__ign β€” a pointer pointing to a memory area to be iterated over. Yes, the name is a little unhinged, but that's literally the argument 🫢
  • nr_words β€” the size of the specified memory area, measured in 8-byte units. The maximum value of nr_words is BITS_ITER_NR_WORDS_MAX. This limit may be further reduced by the BPF memory allocator implementation. So that's the ceiling, and the allocator can lower it 😭

πŸ’– DESCRIPTION πŸ’–

This function initializes a new bpf_iter_bits structure for iterating over a memory area which is specified by the unsafe_ptr__ign and nr_words. It copies the data of the memory area to the newly created bpf_iter_bits it for subsequent iteration operations. Setup now, iterate later β€” iconic behavior 🌸

On success, 0 is returned. On failure, ERR is returned. No cap, that's the return contract πŸ’€

🌈 SEE ALSO 🌈

Kernel file: ./kernel/bpf/helpers.c.

The reference friend group is: bpf_obj_new(9), bpf_percpu_obj_new(9), bpf_obj_drop(9), bpf_percpu_obj_drop(9), bpf_refcount_acquire(9), bpf_list_push_front(9), bpf_list_push_back(9), bpf_rbtree_add(9), bpf_task_acquire(9), bpf_task_release(9), bpf_cgroup_acquire(9), bpf_cgroup_release(9), bpf_cgroup_ancestor(9), bpf_cgroup_from_id(9), bpf_task_under_cgroup(9), bpf_task_get_cgroup1(9), bpf_task_from_pid(9), bpf_task_from_vpid(9), bpf_dynptr_slice(9), bpf_dynptr_slice_rdwr(9), bpf_dynptr_copy(9), bpf_dynptr_memset(9), bpf_iter_bits_next(9), bpf_iter_bits_destroy(9), bpf_copy_from_user_str(9), bpf_copy_from_user_task_str(9), bpf_strcmp(9), bpf_strcasecmp(9), bpf_strnchr(9), bpf_strchr(9), bpf_strchrnul(9), bpf_strrchr(9), bpf_strnlen(9), bpf_strlen(9), bpf_strspn(9), bpf_strcspn(9), bpf_strstr(9), bpf_strcasestr(9), bpf_strnstr(9), bpf_strncasestr(9), bpf_lookup_user_key(9), bpf_lookup_system_key(9), bpf_key_put(9), bpf_verify_pkcs7_signature(9), bpf_task_work_schedule_signal(9), bpf_task_work_schedule_resume(9), bpf_timer_cancel_async(9).


Cute footer sign-off: source/version ./kernel/bpf, date October 2026, page bpf_iter_bits_new(9). That's the tea, bestie β€” stay slay and may your iterators be initialized correctly πŸ’œπŸŽ€

πŸ“¦ where this page comes from