Add create_file syscall, CE mkfile command, FatFS formatting fixes
All checks were successful
Build documentation / build-and-deploy (push) Successful in 4m16s

This commit is contained in:
2026-03-01 01:52:09 +01:00
parent eb55a6de21
commit abd85744cc
13 changed files with 133 additions and 18 deletions

View File

@@ -459,6 +459,30 @@ DEFINE_SYSCALL (sys_read_dir_entry) {
return SYSRESULT (ret);
}
/* int create_file (char* path) */
DEFINE_SYSCALL (sys_create_file) {
uintptr_t uvaddr_path = a1;
struct limine_hhdm_response* hhdm = limine_hhdm_request.response;
uintptr_t out_paddr;
spin_lock (&proc->procgroup->lock);
out_paddr = mm_v2p (&proc->procgroup->pd, uvaddr_path);
spin_unlock (&proc->procgroup->lock);
if (out_paddr == 0)
return SYSRESULT (-ST_BAD_ADDRESS_SPACE);
const char* path = (const char*)((uintptr_t)hhdm->offset + out_paddr);
spin_lock (&proc->lock);
int ret = vfs_create_file (proc, proc->cwv, path);
spin_unlock (&proc->lock);
return SYSRESULT (ret);
}
/* int get_exec_pid (void) */
DEFINE_SYSCALL (sys_get_exec_pid) { return SYSRESULT (proc->exec_pid); }
@@ -485,6 +509,7 @@ static syscall_handler_func_t handler_table[] = {
[SYS_GET_PROCGROUP] = &sys_get_procgroup,
[SYS_GET_EXEC_PID] = &sys_get_exec_pid,
[SYS_READ_DIR_ENTRY] = &sys_read_dir_entry,
[SYS_CREATE_FILE] = &sys_create_file,
};
syscall_handler_func_t syscall_find_handler (int syscall_num) {