aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/mount.c20
-rw-r--r--lib/sys/mount.h11
2 files changed, 31 insertions, 0 deletions
diff --git a/core/mount.c b/core/mount.c
new file mode 100644
index 0000000..a7a4527
--- /dev/null
+++ b/core/mount.c
@@ -0,0 +1,20 @@
+#include "../lib/sys/mount.h"
+#include "../lib/io/io.h"
+#include "../lib/sys/errno.h"
+
+int main(int argc, char **argv)
+{
+ if (argc != 4) {
+ wf(STDERR_FD, "mount <type> <source> <target>\n");
+ return -1;
+ }
+
+ int err;
+
+ if ((err = mount(argv[2], argv[3], argv[1], 0, 0))) {
+ wff(STDERR_FD, "error: %s", errstr[-err]);
+ return err;
+ }
+
+ return 0;
+}
diff --git a/lib/sys/mount.h b/lib/sys/mount.h
new file mode 100644
index 0000000..6451b22
--- /dev/null
+++ b/lib/sys/mount.h
@@ -0,0 +1,11 @@
+#ifndef MOUNT_H
+#define MOUNT_H
+
+#include "syscalls.h"
+
+int mount(const char *src, const char *target, const char *type, unsigned long flags, const void *data)
+{
+ return syscall(MOUNT, src, target, type, flags, data);
+}
+
+#endif