From 05cf1511dfcde10717894bab2004150ad43cca3f Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Sat, 11 Feb 2023 16:14:56 +0100 Subject: add mount --- core/mount.c | 20 ++++++++++++++++++++ lib/sys/mount.h | 11 +++++++++++ 2 files changed, 31 insertions(+) create mode 100644 core/mount.c create mode 100644 lib/sys/mount.h 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 \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 -- cgit v1.2.3-70-g09d2