rtapi_app_main(3rtapi)
β¨ rtapi_app_main β¨
okay bestie, so this is rtapi_app_main(3rtapi) β it lives in the HAL corner of the LinuxCNC manual universe, and it's literally the function YOU write to get your component born into the world. π
πΈ NAME πΈ
rtapi_app_main β the user-provided function that initializes a component π
π SYNTAX π
#include <rtapi_app.h>
int rtapi_app_main(void) {...}
π«Ά ARGUMENTS π«Ά
None. Nada. Zero. It takes no arguments, she's low-maintenance like that. π
π¦ DESCRIPTION π¦
So here's the tea: rtapi_app_main is your function. Like, the component author writes the body of it. That's you, bestie. β¨
And what goes in that body? Generally it's a call to rtapi_init or hal_init, and then after that comes all the other component-specific initialization code you need. That's the whole vibe β you're basically rolling out the red carpet so your component can make its grand entrance. π
π RETURN VALUE π
- Return
0for success. slay. β - Return a negative
errnovalue (e.g.,-EINVAL) on error. π¨
ngl, existing code also returns RTAPI or HAL error values, and that's fine β but here's the thing: using negative errno values gives you better diagnostics from insmod. so do that if you can. iykyk. π«Ά
π₯ REALTIME CONSIDERATIONS π₯
This gets called automatically by the rtapi infrastructure, and it happens in an initialization context β which is to say, NOT realtime. so no panicking about your realtime budget here, she's off duty. π
β SEE ALSO β
and that's the whole page, bestie!! π go forth and init your components. the LinuxCNC Documentation wrote this one back on 2008-05-26, and it's still out here being iconic in the rtapi_app_main(3rtapi) era. 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