KUNIT_DEFINE_ACTION_WRAPPER(9)
π 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 thatorigaccepts. 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: π
struct kunit_resource(9)kunit_get_resource(9)kunit_put_resource(9)__kunit_add_resource(9)kunit_add_resource(9)kunit_add_named_resource(9)kunit_alloc_and_get_resource(9)kunit_alloc_resource(9)kunit_resource_name_match(9)kunit_find_resource(9)kunit_find_named_resource(9)kunit_destroy_resource(9)kunit_remove_resource(9)kunit_add_action(9)kunit_add_action_or_reset(9)kunit_remove_action(9)kunit_release_action(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms