Serenity Operating System
at master 21 lines 645 B view raw
1/* 2 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <AK/StringView.h> 8#include <Kernel/FileSystem/VirtualFileSystem.h> 9#include <Kernel/Process.h> 10 11namespace Kernel { 12 13ErrorOr<FlatPtr> Process::sys$mkdir(int dirfd, Userspace<char const*> user_path, size_t path_length, mode_t mode) 14{ 15 VERIFY_NO_PROCESS_BIG_LOCK(this); 16 TRY(require_promise(Pledge::cpath)); 17 auto path = TRY(get_syscall_path_argument(user_path, path_length)); 18 TRY(VirtualFileSystem::the().mkdir(credentials(), path->view(), mode & ~umask(), TRY(custody_for_dirfd(dirfd)))); 19 return 0; 20} 21}