summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
Diffstat (limited to 'user')
-rw-r--r--user/include/unistd.h7
-rw-r--r--user/lib/syscall.S1
-rw-r--r--user/poweroff.c6
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();
+}