RESIZE_ARRAY(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… RESIZE_ARRAY(9) β€” like, the Kernel API Manual page you actually wanna read

okay so picture this: you're deep in the Kernel API Manual, section 9, and you've got a BPF array that needs to grow. Bestie, this macro is your girl. Let's get into it ✨


πŸ¦‹ NAME

RESIZE_ARRAY β€” the convenience macro for resizing a BPF array. That's it, that's the whole vibe. No cap.


πŸŽ€ SYNOPSIS

RESIZE_ARRAY (__skel , elfsec , arr , n );

✨ ARGUMENTS

  • __skel β€” the skeleton that's holding your array. the whole container, the main character 🫢
  • elfsec β€” the data section of the BPF program where the array lives. you gotta tell it where πŸ‘€
  • arr β€” the name of the array. literally just the name, bestie πŸŽ€
  • n β€” the desired array element count. how many you want. the number. the goal. ⭐

πŸ”₯ DESCRIPTION

Okay so for BPF arrays declared with RESIZABLE_ARRAY, this macro does two things, and honestly? both ate.

Operation one: it resizes the map that corresponds to the custom data section containing the target array. And as a little side effect β€” lowkey iconic β€” the BTF info for the array gets adjusted so that the array length is sized to cover the new data section size. slay πŸ’…

Operation two: it reassigns the skeleton pointer for that custom data section so it points at the newly memory mapped region. boom. new region, new pointer, new you. ✨

ngl, that's the whole thing β€” two operations, done. no weird edge cases listed here, so don't go inventing any πŸ™ˆ

🌈 SEE ALSO

  • the Kernel file ./tools/sched_ext/include/scx/common.h β€” go read it, iykyk πŸ’œ

and that's the page!! πŸ¦‹ big kisses to ./tools/sched_ext/include/scx for the source, October 2026 for the date, and the Kernel API Manual for hosting. mwah πŸ’– periodt.

πŸ“¦ where this page comes from