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 πŸŽ€βœ¨