KUNIT_DEFINE_ACTION_WRAPPER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… KUNIT_DEFINE_ACTION_WRAPPER(9) β€” NAME πŸ’…

Okay so bestie, welcome to the Kernel API Manual ✨ β€” this one's about KUNIT_DEFINE_ACTION_WRAPPER: it wraps a function for use as a deferred action. That's the whole vibe. πŸŽ€


✨ SYNOPSIS ✨

KUNIT_DEFINE_ACTION_WRAPPER (wrapper , orig , arg_type );

🫢 ARGUMENTS 🫢

  • wrapper β€” the name of the new wrapper function you're defining. You're naming your little creation, main character energy, pick it cute. πŸ‘‘
  • orig β€” the original function you want to wrap up. The og. πŸ¦‹
  • arg_type β€” the type of the argument that orig accepts. Gotta be honest about types, no cap. ⭐

πŸ”₯ DESCRIPTION πŸ”₯

So here's the tea: this defines a wrapper for a function which accepts a single, pointer-sized argument. That wrapper can then be passed to kunit_add_action and similar. πŸ’–

And listen β€” this should be used in preference to casting a function directly to kunit_action_t, because casting function pointers will break control flow integrity (CFI), leading to crashes. Not me warning you dramatically, it's literally right there: crashes, bestie. 😭 Don't do the cast thing. Use the wrapper. Periodt. πŸ’€


🌈 SEE ALSO 🌈

Kernel file ./include/kunit/resource.h β€” plus the whole friend group, and no we are not leaving anyone out, everyone gets an invite: πŸŽ€


Fr fr, that CFI thing is not a drill β€” casting function pointers directly = crashing, and crashing is not the aesthetic. πŸ™ˆ

And that's the page, bestie! 🧚 This little gem lives in ./include/kunit, dated October 2026 β€” yeah, from the future, iconic. Mwah, go wrap something. πŸ’…πŸ«ΆπŸ’œ

πŸ“¦ where this page comes from