20 lines
544 B
C++
20 lines
544 B
C++
#include "Log.h"
|
|
#include "fs/VFS.h"
|
|
#include "memory/MemoryManager.h"
|
|
#include "sys/Syscall.h"
|
|
#include "thread/Scheduler.h"
|
|
|
|
Result<u64> sys_mkdir(Registers*, SyscallArgs args)
|
|
{
|
|
auto path = TRY(MemoryManager::strdup_from_user(args[0]));
|
|
mode_t mode = (mode_t)args[1];
|
|
|
|
Thread* current = Scheduler::current();
|
|
|
|
auto inode = TRY(VFS::create_directory(path.chars(), current->auth, current->current_directory));
|
|
inode->chmod(mode & ~current->umask);
|
|
inode->chown(current->auth.euid, current->auth.egid);
|
|
|
|
return 0;
|
|
}
|