
Путь: Toys/Other, команды версии: Ver.4 Ver.9 reboot Комментарии в файле reboot.c :
Исходный текст в файле reboot.c #define FOR_reboot
#include "toys.h"
#include <sys/reboot.h>
GLOBALS(
char *d;
)
void reboot_main(void)
{
struct timespec ts;
int types[] = {RB_AUTOBOOT, RB_HALT_SYSTEM, RB_POWER_OFF},
sigs[] = {SIGTERM, SIGUSR1, SIGUSR2}, idx;
if (TT.d) {
xparsetimespec(TT.d, &ts);
nanosleep(&ts, NULL);
}
if (!FLAG(n)) sync();
idx = stridx("hp", *toys.which->name)+1;
if (FLAG(f)) toys.exitval = reboot(types[idx]);
else toys.exitval = kill(1, sigs[idx]);
} |
![]() |