1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:47:44 +00:00

Kernel: Rename ScopedSpinlock => SpinlockLocker

This matches MutexLocker, and doesn't sound like it's a lock itself.
This commit is contained in:
Andreas Kling 2021-08-22 01:49:22 +02:00
parent 55adace359
commit c922a7da09
78 changed files with 365 additions and 366 deletions

View file

@ -682,7 +682,7 @@ KResult Process::do_exec(NonnullRefPtr<FileDescription> main_program_description
}
{
ScopedSpinlock lock(g_scheduler_lock);
SpinlockLocker lock(g_scheduler_lock);
new_main_thread->set_state(Thread::State::Runnable);
}
u32 lock_count_to_restore;

View file

@ -93,7 +93,7 @@ KResultOr<FlatPtr> Process::sys$fork(RegisterState& regs)
#endif
{
ScopedSpinlock lock(address_space().get_lock());
SpinlockLocker lock(address_space().get_lock());
for (auto& region : address_space().regions()) {
dbgln_if(FORK_DEBUG, "fork: cloning Region({}) '{}' @ {}", region, region->name(), region->vaddr());
auto maybe_region_clone = region->try_clone();
@ -120,7 +120,7 @@ KResultOr<FlatPtr> Process::sys$fork(RegisterState& regs)
PerformanceManager::add_process_created_event(*child);
ScopedSpinlock lock(g_scheduler_lock);
SpinlockLocker lock(g_scheduler_lock);
child_first_thread->set_affinity(Thread::current()->affinity());
child_first_thread->set_state(Thread::State::Runnable);

View file

@ -13,7 +13,7 @@ namespace Kernel {
void Process::clear_futex_queues_on_exec()
{
ScopedSpinlock lock(m_futex_lock);
SpinlockLocker lock(m_futex_lock);
for (auto& it : m_futex_queues) {
bool did_wake_all;
it.value->wake_all(did_wake_all);
@ -88,7 +88,7 @@ KResultOr<FlatPtr> Process::sys$futex(Userspace<const Syscall::SC_futex_params*>
auto do_wake = [&](FlatPtr user_address, u32 count, Optional<u32> bitmask) -> int {
if (count == 0)
return 0;
ScopedSpinlock locker(m_futex_lock);
SpinlockLocker locker(m_futex_lock);
auto futex_queue = find_futex_queue(user_address, false);
if (!futex_queue)
return 0;
@ -117,7 +117,7 @@ KResultOr<FlatPtr> Process::sys$futex(Userspace<const Syscall::SC_futex_params*>
}
atomic_thread_fence(AK::MemoryOrder::memory_order_acquire);
ScopedSpinlock locker(m_futex_lock);
SpinlockLocker locker(m_futex_lock);
did_create = false;
futex_queue = find_futex_queue(user_address, true, &did_create);
VERIFY(futex_queue);
@ -130,7 +130,7 @@ KResultOr<FlatPtr> Process::sys$futex(Userspace<const Syscall::SC_futex_params*>
Thread::BlockResult block_result = futex_queue->wait_on(timeout, bitset);
ScopedSpinlock locker(m_futex_lock);
SpinlockLocker locker(m_futex_lock);
if (futex_queue->is_empty_and_no_imminent_waits()) {
// If there are no more waiters, we want to get rid of the futex!
remove_futex_queue(user_address);
@ -150,7 +150,7 @@ KResultOr<FlatPtr> Process::sys$futex(Userspace<const Syscall::SC_futex_params*>
atomic_thread_fence(AK::MemoryOrder::memory_order_acquire);
int woken_or_requeued = 0;
ScopedSpinlock locker(m_futex_lock);
SpinlockLocker locker(m_futex_lock);
if (auto futex_queue = find_futex_queue(user_address, false)) {
RefPtr<FutexQueue> target_futex_queue;
bool is_empty, is_target_empty;

View file

@ -31,7 +31,7 @@ KResultOr<FlatPtr> Process::sys$profiling_enable(pid_t pid, u64 event_mask)
else
g_global_perf_events = PerformanceEventBuffer::try_create_with_size(32 * MiB).leak_ptr();
ScopedSpinlock lock(g_profiling_lock);
SpinlockLocker lock(g_profiling_lock);
if (!TimeManagement::the().enable_profile_timer())
return ENOTSUP;
g_profiling_all_threads = true;
@ -51,7 +51,7 @@ KResultOr<FlatPtr> Process::sys$profiling_enable(pid_t pid, u64 event_mask)
return ESRCH;
if (!is_superuser() && process->uid() != euid())
return EPERM;
ScopedSpinlock lock(g_profiling_lock);
SpinlockLocker lock(g_profiling_lock);
g_profiling_event_mask = PERF_EVENT_PROCESS_CREATE | PERF_EVENT_THREAD_CREATE | PERF_EVENT_MMAP;
process->set_profiling(true);
if (!process->create_perf_events_buffer_if_needed()) {
@ -86,7 +86,7 @@ KResultOr<FlatPtr> Process::sys$profiling_disable(pid_t pid)
return ESRCH;
if (!is_superuser() && process->uid() != euid())
return EPERM;
ScopedSpinlock lock(g_profiling_lock);
SpinlockLocker lock(g_profiling_lock);
if (!process->is_profiling())
return EINVAL;
// FIXME: If we enabled the profile timer and it's not supported, how do we disable it now?
@ -122,7 +122,7 @@ KResultOr<FlatPtr> Process::sys$profiling_free_buffer(pid_t pid)
return ESRCH;
if (!is_superuser() && process->uid() != euid())
return EPERM;
ScopedSpinlock lock(g_profiling_lock);
SpinlockLocker lock(g_profiling_lock);
if (process->is_profiling())
return EINVAL;
process->delete_perf_events_buffer();

View file

@ -18,7 +18,7 @@ namespace Kernel {
static KResultOr<u32> handle_ptrace(const Kernel::Syscall::SC_ptrace_params& params, Process& caller)
{
ScopedSpinlock scheduler_lock(g_scheduler_lock);
SpinlockLocker scheduler_lock(g_scheduler_lock);
if (params.request == PT_TRACE_ME) {
if (Process::current().tracer())
return EBUSY;
@ -55,7 +55,7 @@ static KResultOr<u32> handle_ptrace(const Kernel::Syscall::SC_ptrace_params& par
auto result = peer_process.start_tracing_from(caller.pid());
if (result.is_error())
return result.error();
ScopedSpinlock lock(peer->get_lock());
SpinlockLocker lock(peer->get_lock());
if (peer->state() != Thread::State::Stopped) {
peer->send_signal(SIGSTOP, &caller);
}

View file

@ -28,7 +28,7 @@ KResultOr<FlatPtr> Process::sys$sched_setparam(int pid, Userspace<const struct s
return EINVAL;
auto* peer = Thread::current();
ScopedSpinlock lock(g_scheduler_lock);
SpinlockLocker lock(g_scheduler_lock);
if (pid != 0)
peer = Thread::from_tid(pid);
@ -49,7 +49,7 @@ KResultOr<FlatPtr> Process::sys$sched_getparam(pid_t pid, Userspace<struct sched
int priority;
{
auto* peer = Thread::current();
ScopedSpinlock lock(g_scheduler_lock);
SpinlockLocker lock(g_scheduler_lock);
if (pid != 0) {
// FIXME: PID/TID BUG
// The entire process is supposed to be affected.

View file

@ -77,7 +77,7 @@ KResultOr<FlatPtr> Process::sys$create_thread(void* (*entry)(void*), Userspace<c
PerformanceManager::add_thread_created_event(*thread);
ScopedSpinlock lock(g_scheduler_lock);
SpinlockLocker lock(g_scheduler_lock);
thread->set_priority(requested_thread_priority);
thread->set_state(Thread::State::Runnable);
return thread->tid().value();
@ -207,7 +207,7 @@ KResultOr<FlatPtr> Process::sys$get_thread_name(pid_t tid, Userspace<char*> buff
if (!thread || thread->pid() != pid())
return ESRCH;
ScopedSpinlock locker(thread->get_lock());
SpinlockLocker locker(thread->get_lock());
auto thread_name = thread->name();
if (thread_name.is_null()) {