2020-07-30 21:38:15 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-07-30 21:38:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <Kernel/Process.h>
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
2021-11-07 23:51:39 +00:00
|
|
|
ErrorOr<FlatPtr> Process::sys$umask(mode_t mask)
|
2020-07-30 21:38:15 +00:00
|
|
|
{
|
2021-07-18 18:20:12 +00:00
|
|
|
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
|
2021-12-29 09:11:45 +00:00
|
|
|
TRY(require_promise(Pledge::stdio));
|
2021-08-07 19:30:06 +00:00
|
|
|
auto old_mask = m_protected_values.umask;
|
2021-03-11 12:23:23 +00:00
|
|
|
ProtectedDataMutationScope scope { *this };
|
2021-08-07 19:30:06 +00:00
|
|
|
m_protected_values.umask = mask & 0777;
|
2020-07-30 21:38:15 +00:00
|
|
|
return old_mask;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|