xref: /third_party/toybox/porting/liteos_a/toys/other/reboot.c
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/toybox/porting/liteos_a/toys/other/
10f66f451Sopenharmony_ci/* reboot.c - Restart, halt or powerdown the system.
20f66f451Sopenharmony_ci *
30f66f451Sopenharmony_ci * Copyright 2013 Elie De Brauwer <eliedebrauwer@gmail.com>
40f66f451Sopenharmony_ci
50f66f451Sopenharmony_ciUSE_REBOOT(NEWTOY(reboot, "", TOYFLAG_SBIN|TOYFLAG_NEEDROOT))
60f66f451Sopenharmony_ci
70f66f451Sopenharmony_ciconfig REBOOT
80f66f451Sopenharmony_ci  bool "reboot"
90f66f451Sopenharmony_ci  default y
100f66f451Sopenharmony_ci  help
110f66f451Sopenharmony_ci    usage: reboot
120f66f451Sopenharmony_ci
130f66f451Sopenharmony_ci    Restart the system.
140f66f451Sopenharmony_ci
150f66f451Sopenharmony_ci*/
160f66f451Sopenharmony_ci#define FOR_reboot
170f66f451Sopenharmony_ci#include "toys.h"
180f66f451Sopenharmony_ci#include <sys/reboot.h>
190f66f451Sopenharmony_ci
200f66f451Sopenharmony_civoid reboot_main(void)
210f66f451Sopenharmony_ci{
220f66f451Sopenharmony_ci  int types[] = {RB_AUTOBOOT, RB_HALT_SYSTEM, RB_POWER_OFF},
230f66f451Sopenharmony_ci      sigs[] = {SIGTERM, SIGUSR1, SIGUSR2}, idx;
240f66f451Sopenharmony_ci
250f66f451Sopenharmony_ci  idx = stridx("hp", *toys.which->name)+1;
260f66f451Sopenharmony_ci  toys.exitval = reboot(types[idx]);
270f66f451Sopenharmony_ci}
28

Indexes created Thu Nov 07 10:32:03 CST 2024