summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
authorIan McFarlane <i.mcfarlane2002@gmail.com>2025-04-25 11:51:09 -0400
committerIan McFarlane <i.mcfarlane2002@gmail.com>2025-04-25 11:51:09 -0400
commit25359ed1cb1a6131e9d3d26c8f2c8634670ed864 (patch)
tree559750220ff5084e33a2e1f5bc4f0c90b959a4f8 /user
parentfix freeing of virtual memory (diff)
parentpoweroff syscall (diff)
downloadcomus-25359ed1cb1a6131e9d3d26c8f2c8634670ed864.tar.gz
comus-25359ed1cb1a6131e9d3d26c8f2c8634670ed864.tar.bz2
comus-25359ed1cb1a6131e9d3d26c8f2c8634670ed864.zip
resolve format conflict
Diffstat (limited to '')
-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();
+}