diff options
author | Freya Murphy <freya@freyacat.org> | 2025-04-25 11:45:15 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-04-25 11:45:15 -0400 |
commit | 87e8de4f0050ec154286189783ddbd269fbcc7ee (patch) | |
tree | 70e518a288276ec1d306b153d3006c2a44e27ea2 /user | |
parent | load init from ata and run it (diff) | |
download | comus-87e8de4f0050ec154286189783ddbd269fbcc7ee.tar.gz comus-87e8de4f0050ec154286189783ddbd269fbcc7ee.tar.bz2 comus-87e8de4f0050ec154286189783ddbd269fbcc7ee.zip |
poweroff syscall
Diffstat (limited to 'user')
-rw-r--r-- | user/include/unistd.h | 7 | ||||
-rw-r--r-- | user/lib/syscall.S | 1 | ||||
-rw-r--r-- | user/poweroff.c | 6 |
3 files changed, 14 insertions, 0 deletions
diff --git a/user/include/unistd.h b/user/include/unistd.h index a815914..bbacdbe 100644 --- a/user/include/unistd.h +++ b/user/include/unistd.h @@ -162,4 +162,11 @@ extern void *brk(const void *addr); */ extern void *sbrk(intptr_t increment); +/** + * Poweroff the system. + * + * @return 1 on failure + */ +extern int poweroff(void); + #endif /* unistd.h */ diff --git a/user/lib/syscall.S b/user/lib/syscall.S index fc1ab93..c5a23b5 100644 --- a/user/lib/syscall.S +++ b/user/lib/syscall.S @@ -24,3 +24,4 @@ SYSCALL kill SYS_kill SYSCALL sleep SYS_sleep SYSCALL brk SYS_brk SYSCALL sbrk SYS_sbrk +SYSCALL poweroff SYS_poweroff diff --git a/user/poweroff.c b/user/poweroff.c new file mode 100644 index 0000000..f51a86f --- /dev/null +++ b/user/poweroff.c @@ -0,0 +1,6 @@ +#include <unistd.h> + +int main(void) +{ + return poweroff(); +} |