Hi.
I too needed this some time ago and implemented it much like @jyijyi using faultAction: reboot
in the adef file. It has the added benefit of allowing the app to run sandboxed and let the supervisor deal with fault recovery.
I went a step further and bundled this functionality up in a separate app with the intention of adding more “custom” APIs for other system functions I might need available to any app running on my system.
Basically, my utility app .c
file consisted of something like this:
void sys_util_Reboot()
{
LE_INFO("User-initiated system reboot...");
kill(getpid(), SIGINT);
}
COMPONENT_INIT
{
LE_INFO("*** Starting System Utility Service ***");
}
With a simple .api
file containing:
/**
* Function that reboots the system.
*/
FUNCTION Reboot
(
);
Hope this helps.
Raf