feat: implement utime libc function, SYS_UTIME syscall, filesystem support (ext2 only)

This commit is contained in:
daniel committed 2026-08-09 11:16:59 +02:00
1 parent 771c3a5a98
commit 1c498ffa6a
15 files changed
+158 -30

No files matched your search

+1 -1
View File
@@ -12,4 +12,4 @@
#pragma once
#define MONTAUK_BUILD_NUMBER 94
#define MONTAUK_BUILD_NUMBER 95
+13
View File
@@ -15,6 +15,7 @@
#include <Memory/Paging.hpp>
#include <Libraries/Memory.hpp>
#include <Ipc/Ipc.hpp>
#include <Timekeeping/Time.hpp>
#include "Path.hpp"
namespace montauk::abi {
@@ -133,6 +134,18 @@ namespace montauk::abi {
return 0;
}
static int Sys_Utime(const char* path, int64_t atime, int64_t mtime,
bool useCurrent) {
char resolved[256];
if (!ResolveProcessPath(path, resolved, sizeof(resolved))) return -1;
if (useCurrent) {
int64_t now = Timekeeping::GetUnixTimestamp();
atime = now;
mtime = now;
}
return Fs::Vfs::VfsSetTimes(resolved, atime, mtime);
}
static int Sys_FMkdir(const char* path) {
char resolved[256];
if (!ResolveProcessPath(path, resolved, sizeof(resolved))) return -1;
+6
View File
@@ -174,6 +174,12 @@ namespace montauk::abi {
if (!UserMemory::String(frame->arg1, kMaxPathBytes)) return -1;
if (!UserMemory::Writable<FileStat>(frame->arg2)) return -1;
return (int64_t)Sys_Stat((const char*)frame->arg1, (FileStat*)frame->arg2);
case SYS_UTIME:
if (!UserMemory::String(frame->arg1, kMaxPathBytes)) return -1;
return (int64_t)Sys_Utime((const char*)frame->arg1,
(int64_t)frame->arg2,
(int64_t)frame->arg3,
frame->arg4 != 0);
case SYS_TERMSIZE:
return (int64_t)Sys_TermSize();
case SYS_GETARGS:
+3
View File
@@ -310,6 +310,9 @@ namespace montauk::abi {
/* Keyboard.hpp */
static constexpr uint64_t SYS_GETCHAR_NB = 166; // () -> ascii, 0 if nothing pending; never blocks
// Set path access/modification times. (path, atime, mtime, useCurrent)
static constexpr uint64_t SYS_UTIME = 167;
// Tunable parameters (for SYS_SDR_SETPARAM / SYS_SDR_GETPARAM).
static constexpr int SDR_PARAM_FREQ = 0; // center frequency, Hz
static constexpr int SDR_PARAM_SAMPLE_RATE = 1; // sample rate, Hz