summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorJesse <jesse.buhagiar@student.rmit.edu.au>2019-08-02 23:18:47 +1000
committerAndreas Kling <awesomekling@gmail.com>2019-08-02 15:18:47 +0200
commit401c87a0ccb7bb72d40622ae326889cacaaf5f7a (patch)
tree1cc33cadd0ddd9c15815f4577aaffb61562e7e15 /Libraries
parent3f91d2d0ccb1174adbc645e37013fc4a0bd93929 (diff)
downloadserenity-401c87a0ccb7bb72d40622ae326889cacaaf5f7a.zip
Kernel: mount system call (#396)
It is now possible to mount ext2 `DiskDevice` devices under Serenity on any folder in the root filesystem. Currently any user can do this with any permissions. There's a fair amount of assumptions made here too, that might not be too good, but can be worked on in the future. This is a good start to allow more dynamic operation under the OS itself. It is also currently impossible to unmount and such, and devices will fail to mount in Linux as the FS 'needs to be cleaned'. I'll work on getting `umount` done ASAP to rectify this (as well as working on less assumption-making in the mount syscall. We don't want to just be able to mount DiskDevices!). This could probably be fixed with some `-t` flag or something similar.
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibC/unistd.cpp6
-rw-r--r--Libraries/LibC/unistd.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/Libraries/LibC/unistd.cpp b/Libraries/LibC/unistd.cpp
index 922039c09f..5d9e9bb97d 100644
--- a/Libraries/LibC/unistd.cpp
+++ b/Libraries/LibC/unistd.cpp
@@ -546,6 +546,12 @@ int reboot()
__RETURN_WITH_ERRNO(rc, rc, -1);
}
+int mount(const char* device, const char* mountpoint)
+{
+ int rc = syscall(SC_mount, device, mountpoint);
+ __RETURN_WITH_ERRNO(rc, rc, -1);
+}
+
void dump_backtrace()
{
syscall(SC_dump_backtrace);
diff --git a/Libraries/LibC/unistd.h b/Libraries/LibC/unistd.h
index b4b8928e9c..567f098c82 100644
--- a/Libraries/LibC/unistd.h
+++ b/Libraries/LibC/unistd.h
@@ -98,6 +98,7 @@ int fchown(int fd, uid_t, gid_t);
int ftruncate(int fd, off_t length);
int halt();
int reboot();
+int mount(const char* device, const char* mountpoint);
enum {
_PC_NAME_MAX,