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