mount syscall and simple mount program

This commit is contained in:
Matheus
2023-07-26 00:19:51 -03:00
parent 755fd1a8d1
commit dcaa20ae9c
10 changed files with 199 additions and 12 deletions
+14 -6
View File
@@ -13,16 +13,18 @@ index bb5b6ef..bd2f740 100644
#define IPPROTO_HOPOPTS 0
#define IPPROTO_ICMP 1
diff --git mlibc-clean/meson.build mlibc-workdir/meson.build
index 2261926..03b6260 100644
index 2261926..b5e6108 100644
--- mlibc-clean/meson.build
+++ mlibc-workdir/meson.build
@@ -153,6 +153,10 @@ elif host_machine.system() == 'dripos'
@@ -153,6 +153,12 @@ elif host_machine.system() == 'dripos'
rtdl_include_dirs += include_directories('sysdeps/dripos/include')
libc_include_dirs += include_directories('sysdeps/dripos/include')
subdir('sysdeps/dripos')
+elif host_machine.system() == 'astral'
+ rtdl_include_dirs += include_directories('sysdeps/astral/include')
+ libc_include_dirs += include_directories('sysdeps/astral/include')
+ internal_conf.set10('MLIBC_MAP_DSO_SEGMENTS', true)
+ internal_conf.set10('MLIBC_MAP_FILE_WINDOWS', true)
+ subdir('sysdeps/astral')
else
error('No sysdeps defined for OS: ' + host_machine.system())
@@ -133,10 +135,10 @@ index 0000000..e5b087a
+
diff --git mlibc-workdir/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp
new file mode 100644
index 0000000..f7b6375
index 0000000..23128c0
--- /dev/null
+++ mlibc-workdir/sysdeps/astral/generic/generic.cpp
@@ -0,0 +1,443 @@
@@ -0,0 +1,448 @@
+#include <bits/ensure.h>
+#include <mlibc/debug.hpp>
+#include <mlibc/all-sysdeps.hpp>
@@ -216,6 +218,11 @@ index 0000000..f7b6375
+ return 0;
+ }
+
+ int sys_mount(const char *source, const char *target, const char *fstype, unsigned long flags, const void *data) {
+ long ret;
+ return syscall(SYSCALL_MOUNT, &ret, (uint64_t)source, (uint64_t)target, (uint64_t)fstype, flags, (uint64_t)data);
+ }
+
+ int sys_ftruncate(int fd, size_t size) {
+ long ret;
+ return syscall(SYSCALL_FTRUNCATE, &ret, fd, size);
@@ -599,10 +606,10 @@ index 0000000..990eca0
+#endif
diff --git mlibc-workdir/sysdeps/astral/include/astral/syscall.h mlibc-workdir/sysdeps/astral/include/astral/syscall.h
new file mode 100644
index 0000000..76b4800
index 0000000..2fda766
--- /dev/null
+++ mlibc-workdir/sysdeps/astral/include/astral/syscall.h
@@ -0,0 +1,60 @@
@@ -0,0 +1,61 @@
+#ifndef _SYSCALL_H_INCLUDE
+#define _SYSCALL_H_INCLUDE
+
@@ -643,6 +650,7 @@ index 0000000..76b4800
+#define SYSCALL_POLL 34
+#define SYSCALL_NANOSLEEP 35
+#define SYSCALL_FTRUNCATE 36
+#define SYSCALL_MOUNT 37
+
+#include <stddef.h>
+#include <stdint.h>