mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-22 18:46:18 +00:00
Kernel: Make Process's m_promises & m_execpromises fields atomic
This is essentially free on x86 and allows us to not hold the big process lock just to check the required promises for a syscall.
This commit is contained in:
parent
868be680c2
commit
c3f668a758
|
@ -92,10 +92,10 @@ protected:
|
|||
gid_t m_sgid { 0 };
|
||||
Vector<gid_t> m_extra_gids;
|
||||
bool m_dumpable { false };
|
||||
bool m_has_promises { false };
|
||||
u32 m_promises { 0 };
|
||||
bool m_has_execpromises { false };
|
||||
u32 m_execpromises { 0 };
|
||||
Atomic<bool> m_has_promises { false };
|
||||
Atomic<u32> m_promises { 0 };
|
||||
Atomic<bool> m_has_execpromises { false };
|
||||
Atomic<u32> m_execpromises { 0 };
|
||||
mode_t m_umask { 022 };
|
||||
VirtualAddress m_signal_trampoline;
|
||||
Atomic<u32> m_thread_count { 0 };
|
||||
|
|
|
@ -639,8 +639,8 @@ KResult Process::do_exec(NonnullRefPtr<FileDescription> main_program_description
|
|||
|
||||
{
|
||||
ProtectedDataMutationScope scope { *this };
|
||||
m_promises = m_execpromises;
|
||||
m_has_promises = m_has_execpromises;
|
||||
m_promises = m_execpromises.load();
|
||||
m_has_promises = m_has_execpromises.load();
|
||||
|
||||
m_execpromises = 0;
|
||||
m_has_execpromises = false;
|
||||
|
|
|
@ -30,10 +30,10 @@ KResultOr<FlatPtr> Process::sys$fork(RegisterState& regs)
|
|||
|
||||
{
|
||||
ProtectedDataMutationScope scope { *child };
|
||||
child->m_promises = m_promises;
|
||||
child->m_execpromises = m_execpromises;
|
||||
child->m_has_promises = m_has_promises;
|
||||
child->m_has_execpromises = m_has_execpromises;
|
||||
child->m_promises = m_promises.load();
|
||||
child->m_execpromises = m_execpromises.load();
|
||||
child->m_has_promises = m_has_promises.load();
|
||||
child->m_has_execpromises = m_has_execpromises.load();
|
||||
child->m_sid = m_sid;
|
||||
child->m_extra_gids = m_extra_gids;
|
||||
child->m_umask = m_umask;
|
||||
|
|
|
@ -74,13 +74,13 @@ KResultOr<FlatPtr> Process::sys$pledge(Userspace<const Syscall::SC_pledge_params
|
|||
// leave the caller in an unexpected state.
|
||||
|
||||
if (promises) {
|
||||
m_has_promises = true;
|
||||
m_promises = new_promises;
|
||||
m_has_promises = true;
|
||||
}
|
||||
|
||||
if (execpromises) {
|
||||
m_has_execpromises = true;
|
||||
m_execpromises = new_execpromises;
|
||||
m_has_execpromises = true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue