Luna/kernel/src/sys/mkdir.cpp
apio d66506256d
All checks were successful
continuous-integration/drone/push Build is passing
kernel/VFS+libc: Introduce modes
2023-03-12 16:55:46 +01:00

18 lines
412 B
C++

#include "Log.h"
#include "fs/VFS.h"
#include "memory/MemoryManager.h"
#include "sys/Syscall.h"
Result<u64> sys_mkdir(Registers*, SyscallArgs args)
{
auto path = TRY(MemoryManager::strdup_from_user(args[0]));
mode_t mode = (mode_t)args[1];
kinfoln("mkdir: attempting to create %s", path.chars());
auto inode = TRY(VFS::create_directory(path.chars()));
inode->chmod(mode);
return 0;
}