summaryrefslogtreecommitdiff
path: root/src/user
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-01-02 00:47:16 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-01-02 00:58:45 +0800
commitd8eaa13f2efc1eeca4e5f230d5a2d535aaf27338 (patch)
tree6ca02e2a2d1b1121620431059e322724a3c94a33 /src/user
parent2dde56422dcfb94affee2baffc8d240ad16ad4b2 (diff)
downloadlume-d8eaa13f2efc1eeca4e5f230d5a2d535aaf27338.tar.gz
lume-d8eaa13f2efc1eeca4e5f230d5a2d535aaf27338.tar.xz
dev(file-system): establish VFS and Read-only FAT32 File System
Diffstat (limited to 'src/user')
-rw-r--r--src/user/init.cc36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/user/init.cc b/src/user/init.cc
index 1646f6b..27c1e2f 100644
--- a/src/user/init.cc
+++ b/src/user/init.cc
@@ -1,4 +1,5 @@
#include "user/user.h"
+#include "common/fcntl.h"
int strlen(const char *s)
{
@@ -149,7 +150,40 @@ void test_syscalls()
int main()
{
- print("\n[Lume Shell] Ready.\n");
+ print("\n[Lume Shell] Init process started.\n");
+ print("[Test] Opening test.txt...\n");
+ int fd = open("test.txt", O_RDONLY);
+ if (fd < 0)
+ {
+ print("[Test] Open failed (Is test.txt in fs.img?)\n");
+ }
+ else
+ {
+ print("[Test] Open success! fd=");
+ print_int(fd);
+ print("\n");
+
+ char buf[64];
+ int n = read(fd, buf, 63);
+ if (n > 0)
+ {
+ buf[n] = 0;
+ print("[Test] Read content:\n---\n");
+ print(buf);
+ print("\n---\n");
+ }
+ else
+ {
+ print("[Test] Read returned ");
+ print_int(n);
+ print("\n");
+ }
+ close(fd);
+ print("[Test] File closed.\n");
+ }
+
+
+
print("Commands:\n");
print(" s: Run System Call Tests (fork, wait, mm)\n");
print(" t: Run Disk Driver Test (VirtIO)\n");