assoc_array_iterate(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

assoc_array_iterate β€” Pass all objects in the array to a callback πŸ’…

Hey bestie, welcome to the assoc_array_iterate(9) page from the Kernel API Manual β€” it’s giving kernel-core realness and we’re gonna get through it together 🫢

🌸 SYNOPSIS 🌸

int assoc_array_iterate (const struct assoc_array *array , int
(*iterator)(const void *object, void *iterator_data) , void
*iterator_data );

πŸ’– ARGUMENTS πŸ’–

  • array β€” The array to iterate over.
  • iterator β€” The callback function.
  • iterator_data β€” Private data for the callback function.

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so this one iterates over all the objects in an associative array. Each one gets presented to the iterator function, no cap ✨

concurrency warning, bestie 😭 β€” if the array is being modified concurrently with the iteration, it is possible that some objects in the array will be passed to the iterator callback more than once β€” though every object should be passed at least once. If this is undesirable, then the caller must lock against modification for the duration of this function.

The function will return 0 if no objects were in the array, or else it will return the result of the last iterator function called. Iteration stops immediately if any call to the iteration function results in a non-zero return. periodt πŸ’…

The caller should hold the RCU read lock or better if concurrent modification is possible. iykyk 🧚

πŸŽ€ SEE ALSO πŸŽ€

Kernel file ./lib/assoc_array.c β€” and the whole squad:


mwah πŸ’‹ β€” source/version: ./lib, date: October 2026, page: assoc_array_iterate(9).

πŸ“¦ where this page comes from