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