rtapi_module_param(3rtapi)
β¨ rtapi_module_param β the 3rtapi era β¨
okay bestie, pull up a chair, because this one is the glue that holds your kernel modules together π
this page lives in section 3rtapi and it's all about how you declare module parameters like a boss.
πΈ NAME πΈ
rtapi_module_param β specifying module parameters π
π¦ SYNTAX π¦
here's the whole cast, exactly as written, no semicolons, no drama:
RTAPI_MP_INT(var, description)
RTAPI_MP_LONG(var, description)
RTAPI_MP_STRING(var, description)
RTAPI_MP_ARRAY_INT(var, num, description)
RTAPI_MP_ARRAY_LONG(var, num, description)
RTAPI_MP_ARRAY_STRING(var, num, description)
MODULE_LICENSE(license)
MODULE_AUTHOR(author)
MODULE_DESCRIPTION(description)
EXPORT_FUNCTION(function)
π ARGUMENTS π
varβ the variable where the parameter should be stored π« that's literally its whole job.descriptionβ a short description of the parameter or module π keep it cute, keep it short.numβ the maximum number of values for an array parameter π’ that's the cap, bestie.licenseβ the license of the module, for instance"GPL"βοΈauthorβ the author of the module π you. it's you.functionβ the pointer to the function to be exported π€
π DESCRIPTION π
so these macros are portable ways to declare kernel module parameters β¨ that's the whole vibe.
the rules, and they are not optional:
- they must be used in the global scope π
- they are not followed by a terminating semicolon π«
; - they must be used after the associated variable or function has been defined β³ order matters, no cap.
π NOTES π
EXPORT_FUNCTION makes a symbol available for use by a subsequently loaded component π
β οΈ it is unrelated to HAL functions, which are described in hal_export_funct(3hal). do not mix these up, i am begging π
π Interpretation of license strings π
MODULE_LICENSE follows the kernel's definition of license strings. notably, "GPL" indicates "GNU General Public License v2 or later" (emphasis ours). periodt.
"GPL"β GNU General Public License v2 or later"GPL v2"β GNU General Public License v2"GPL and additional rights"β GNU General Public License v2 rights and more"Dual BSD/GPL"β GNU General Public License v2 or BSD license choice"Dual MIT/GPL"β GNU General Public License v2 or MIT license choice"Dual MPL/GPL"β GNU General Public License v2 or Mozilla license choice"Proprietary"β Non-free products
and ngl, it is still good practice to include a license block which indicates the author, copyright date, and disclaimer of warranty as recommended by the GNU GPL π«Ά do it for the culture.
β° REALTIME CONSIDERATIONS β°
Not available in userspace code. π« userland girlies, this one is not for you, sorry bestie π
and that's the whole page, babes π
written up by the LinuxCNC Documentation crew, dated 2006-10-12, and it belongs to the rtapi_module_param(3rtapi) era β iconic, historic, and honestly? still ate. mwah πβ¨
π¦ where this page comes from
- debian bookworm: linuxcnc-uspace-dev 2.9.0~pre1+git20230208.f1270d6ed7-1+deb12u2 Β· GFDL-1.1-or-later
- debian trixie: linuxcnc-uspace-dev 1:2.9.4-2+deb13u1 Β· GFDL-1.1-or-later
- ubuntu questing: linuxcnc-uspace-dev 1:2.9.4-2ubuntu2
- ubuntu resolute: linuxcnc-uspace-dev 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- ubuntu stonking: linuxcnc-uspace-dev 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms