Files
Astral/tools/init/reboot.c
T
2024-09-01 23:14:12 -03:00

25 lines
373 B
C

#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include "common.h"
int main() {
char c = COMMAND_REBOOT;
int fd = open(COMMAND_FIFO, O_WRONLY);
if (fd == -1) {
perror("poweroff: open");
return EXIT_FAILURE;
}
if (write(fd, &c, 1) < 0) {
perror("poweroff: write");
return EXIT_FAILURE;
}
close(fd);
return EXIT_SUCCESS;
}