CE add mkdir command, implement create_dir () syscall
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m1s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m1s
This commit is contained in:
@@ -593,6 +593,30 @@ DEFINE_SYSCALL (sys_kill) {
|
||||
return ST_OK;
|
||||
}
|
||||
|
||||
/* int create_dir (char* path) */
|
||||
DEFINE_SYSCALL (sys_create_dir) {
|
||||
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_dir (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,
|
||||
@@ -620,6 +644,7 @@ static syscall_handler_func_t handler_table[] = {
|
||||
[SYS_WRITE_FILE] = &sys_write_file,
|
||||
[SYS_WAIT_FOR_PID] = &sys_wait_for_pid,
|
||||
[SYS_KILL] = &sys_kill,
|
||||
[SYS_CREATE_DIR] = &sys_create_dir,
|
||||
};
|
||||
|
||||
syscall_handler_func_t syscall_find_handler (int syscall_num) {
|
||||
|
||||
Reference in New Issue
Block a user