summaryrefslogtreecommitdiff
path: root/src/cmd/init/driver
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/init/driver')
-rw-r--r--src/cmd/init/driver/driver.h1
-rw-r--r--src/cmd/init/driver/initctl.c44
2 files changed, 0 insertions, 45 deletions
diff --git a/src/cmd/init/driver/driver.h b/src/cmd/init/driver/driver.h
index 98c18f1..8bef042 100644
--- a/src/cmd/init/driver/driver.h
+++ b/src/cmd/init/driver/driver.h
@@ -1,7 +1,6 @@
#pragma once
#include <camellia/types.h>
-void initctl_drv(hid_t killswitch);
void ps2_drv(void);
void tmpfs_drv(void);
diff --git a/src/cmd/init/driver/initctl.c b/src/cmd/init/driver/initctl.c
deleted file mode 100644
index fed71b7..0000000
--- a/src/cmd/init/driver/initctl.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "driver.h"
-#include <camellia/syscalls.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <camellia/compat.h>
-
-void initctl_drv(hid_t killswitch) {
- struct ufs_request res;
- char buf[64];
- const size_t buflen = sizeof buf;
- while (!c0_fs_wait(buf, buflen, &res)) {
- switch (res.op) {
- case VFSOP_OPEN:
- c0_fs_respond(NULL, res.len == 0 ? 0 : -1, 0);
- break;
- case VFSOP_WRITE:
- /* null terminate */
- if (res.len > buflen - 1)
- res.len = buflen - 1;
- buf[res.len] = '\0';
- /* cut at first whitespace */
- for (size_t i = 0; buf[i]; i++) {
- if (isspace(buf[i])) {
- buf[i] = '\0';
- break;
- }
- }
- if (!strcmp(buf, "halt")) {
- _sys_write(killswitch, "halt", 4, 0, 0);
- }
- if (!strcmp(buf, "intr")) {
- _sys_write(killswitch, "intr", 4, 0, 0);
- }
- c0_fs_respond(NULL, res.len, 0);
- break;
- default:
- c0_fs_respond(NULL, -ENOSYS, 0);
- break;
- }
- }
- exit(1);
-}