Adding "Reboot" command
based on BDH Shell
Last updated
Was this helpful?
Was this helpful?
static int usrcmd_reboot(int argc, char **argv);static int usrcmd_reboot(int argc, char **argv)
{
printf("Rebooting the system...\n");
NVIC_SystemReset();
return 0;
}{ "reboot", " Reboot the system of board", usrcmd_reboot },static int usrcmd_kill(int argc, char **argv);static int usrcmd_kill(int argc, char **argv)
{
if (argc != 2) {
printf("Usage: kill <pid>\n");
return 1;
}
int pid = atoi(argv[1]);
if (kill(pid) != 0) {
printf("Failed to kill process %d\n", pid);
return 1;
}
printf("Process %d killed\n", pid);
return 0;
}{ "kill", "Kill a process with a specific PID", usrcmd_kill },