CE add rm command, implement remove () syscall
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m51s

This commit is contained in:
2026-03-05 01:17:13 +01:00
parent 35d5bed433
commit a5f5dbf21f
12 changed files with 106 additions and 7 deletions

View File

@@ -617,6 +617,30 @@ DEFINE_SYSCALL (sys_create_dir) {
return SYSRESULT (ret);
}
/* int remove (char* path) */
DEFINE_SYSCALL (sys_remove) {
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_remove (proc, proc->cwv, path);
spin_unlock (&proc->lock);
return SYSRESULT (ret);
}
static syscall_handler_func_t handler_table[] = {
[SYS_QUIT] = &sys_quit,
[SYS_TEST] = &sys_test,
@@ -645,6 +669,7 @@ static syscall_handler_func_t handler_table[] = {
[SYS_WAIT_FOR_PID] = &sys_wait_for_pid,
[SYS_KILL] = &sys_kill,
[SYS_CREATE_DIR] = &sys_create_dir,
[SYS_REMOVE] = &sys_remove,
};
syscall_handler_func_t syscall_find_handler (int syscall_num) {