Kernel/LibC/Userspace: Add SYS_POWEROFF + cli tool

You can now shutdown/reboot banan-os with the poweroff cli tool.

Reboot doesn't seem to work on qemu.
This commit is contained in:
Bananymous
2023-09-28 12:36:47 +03:00
parent d45bf363f1
commit 6eda65eea6
9 changed files with 100 additions and 2 deletions

View File

@@ -11,8 +11,8 @@ __BEGIN_DECLS
#define TTY_FLAG_ENABLE_OUTPUT 1
#define TTY_FLAG_ENABLE_INPUT 2
#define POWER_SHUTDOWN 0
#define POWER_REBOOT 1
#define POWEROFF_SHUTDOWN 0
#define POWEROFF_REBOOT 1
/*
fildes: refers to valid tty device
@@ -22,6 +22,7 @@ flags: bitwise or of TTY_FLAG_* definitions
return value: 0 on success, -1 on failure and errno set to the error
*/
int tty_ctrl(int fildes, int command, int flags);
int poweroff(int command);
__END_DECLS

View File

@@ -54,6 +54,7 @@ __BEGIN_DECLS
#define SYS_MMAP 51
#define SYS_MUNMAP 52
#define SYS_TTY_CTRL 53
#define SYS_POWEROFF 54
__END_DECLS