Luna/kernel/src/sys/mkdir.cpp

19 lines
429 B
C++
Raw Normal View History

2023-03-12 14:32:09 +00:00
#include "Log.h"
#include "fs/VFS.h"
#include "memory/MemoryManager.h"
#include "sys/Syscall.h"
Result<u64> sys_mkdir(Registers*, SyscallArgs args)
{
u64 path_address = args[0];
if (!MemoryManager::validate_userspace_string(path_address)) return err(EFAULT);
const char* path = (const char*)path_address;
kinfoln("mkdir: attempting to create %s", path);
TRY(VFS::create_directory(path));
return 0;
}