mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-31 14:38:21 +00:00
init: reboot, acpid
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user