ubase/reboot.c

33 lines
491 B
C
Raw Normal View History

/* See LICENSE file for copyright and license details. */
#include <sys/syscall.h>
#include <unistd.h>
#include <stdio.h>
2013-08-19 11:27:21 -04:00
#include "reboot.h"
#include "util.h"
static void
usage(void)
{
eprintf("usage: %s\n", argv0);
}
int
main(int argc, char *argv[])
{
ARGBEGIN {
default:
usage();
} ARGEND;
if (argc > 0)
usage();
sync();
if (syscall(__NR_reboot, LINUX_REBOOT_MAGIC1,
LINUX_REBOOT_MAGIC2,
LINUX_REBOOT_CMD_RESTART, NULL) < 0)
eprintf("reboot:");
return 0;
}