summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Kernel/ACPI/DynamicParser.h2
-rw-r--r--Kernel/CMakeLists.txt2
-rw-r--r--Kernel/Devices/Device.h2
-rw-r--r--Kernel/DoubleBuffer.h4
-rw-r--r--Kernel/FileSystem/BlockBasedFileSystem.h2
-rw-r--r--Kernel/FileSystem/FIFO.cpp2
-rw-r--r--Kernel/FileSystem/FIFO.h4
-rw-r--r--Kernel/FileSystem/FileDescription.cpp2
-rw-r--r--Kernel/FileSystem/FileDescription.h2
-rw-r--r--Kernel/FileSystem/FileSystem.h4
-rw-r--r--Kernel/FileSystem/Inode.h4
-rw-r--r--Kernel/FileSystem/InodeWatcher.h2
-rw-r--r--Kernel/FileSystem/Plan9FileSystem.h2
-rw-r--r--Kernel/FileSystem/ProcFS.h2
-rw-r--r--Kernel/FileSystem/SysFS.h4
-rw-r--r--Kernel/FileSystem/TmpFS.cpp12
-rw-r--r--Kernel/FileSystem/VirtualFileSystem.h2
-rw-r--r--Kernel/Forward.h2
-rw-r--r--Kernel/GlobalProcessExposed.cpp8
-rw-r--r--Kernel/Graphics/VirtIOGPU/VirtIOGPU.h2
-rw-r--r--Kernel/Mutex.cpp (renamed from Kernel/Lock.cpp)44
-rw-r--r--Kernel/Mutex.h (renamed from Kernel/Lock.h)44
-rw-r--r--Kernel/Net/IPv4Socket.h2
-rw-r--r--Kernel/Net/IPv4SocketTuple.h2
-rw-r--r--Kernel/Net/LocalSocket.cpp2
-rw-r--r--Kernel/Net/NetworkTask.cpp4
-rw-r--r--Kernel/Net/NetworkingManagement.h2
-rw-r--r--Kernel/Net/Socket.h6
-rw-r--r--Kernel/Net/TCPSocket.cpp8
-rw-r--r--Kernel/Net/TCPSocket.h2
-rw-r--r--Kernel/Net/UDPSocket.cpp4
-rw-r--r--Kernel/Process.cpp4
-rw-r--r--Kernel/Process.h10
-rw-r--r--Kernel/ProcessExposed.h6
-rw-r--r--Kernel/ProcessGroup.h2
-rw-r--r--Kernel/ProcessSpecificExposed.cpp4
-rw-r--r--Kernel/Random.h2
-rw-r--r--Kernel/Storage/AHCIPort.h4
-rw-r--r--Kernel/Storage/AHCIPortHandler.h2
-rw-r--r--Kernel/Storage/IDEChannel.h4
-rw-r--r--Kernel/Storage/PATADiskDevice.h4
-rw-r--r--Kernel/Storage/RamdiskDevice.h4
-rw-r--r--Kernel/Storage/SATADiskDevice.h2
-rw-r--r--Kernel/Storage/StorageController.h2
-rw-r--r--Kernel/Storage/StorageDevice.h2
-rw-r--r--Kernel/Syscalls/hostname.cpp6
-rw-r--r--Kernel/Syscalls/uname.cpp4
-rw-r--r--Kernel/TTY/PTYMultiplexer.h4
-rw-r--r--Kernel/Thread.cpp12
-rw-r--r--Kernel/Thread.h12
-rw-r--r--Kernel/VM/VMObject.h4
51 files changed, 140 insertions, 140 deletions
diff --git a/Kernel/ACPI/DynamicParser.h b/Kernel/ACPI/DynamicParser.h
index 560edb6b06..4fbff9e5a8 100644
--- a/Kernel/ACPI/DynamicParser.h
+++ b/Kernel/ACPI/DynamicParser.h
@@ -9,7 +9,7 @@
#include <AK/RefPtr.h>
#include <Kernel/ACPI/Parser.h>
#include <Kernel/Interrupts/IRQHandler.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/PhysicalAddress.h>
#include <Kernel/VM/PhysicalPage.h>
diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt
index 0e59bd169b..d9e4319a62 100644
--- a/Kernel/CMakeLists.txt
+++ b/Kernel/CMakeLists.txt
@@ -130,7 +130,7 @@ set(KERNEL_SOURCES
KLexicalPath.cpp
KString.cpp
KSyms.cpp
- Lock.cpp
+ Mutex.cpp
Net/E1000ENetworkAdapter.cpp
Net/E1000NetworkAdapter.cpp
Net/IPv4Socket.cpp
diff --git a/Kernel/Devices/Device.h b/Kernel/Devices/Device.h
index 1bc751d820..53903c84e3 100644
--- a/Kernel/Devices/Device.h
+++ b/Kernel/Devices/Device.h
@@ -19,7 +19,7 @@
#include <AK/HashMap.h>
#include <Kernel/Devices/AsyncDeviceRequest.h>
#include <Kernel/FileSystem/File.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/UnixTypes.h>
namespace Kernel {
diff --git a/Kernel/DoubleBuffer.h b/Kernel/DoubleBuffer.h
index 664f2a2308..c99ef5da40 100644
--- a/Kernel/DoubleBuffer.h
+++ b/Kernel/DoubleBuffer.h
@@ -8,7 +8,7 @@
#include <AK/Types.h>
#include <Kernel/KBuffer.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/Thread.h>
#include <Kernel/UserOrKernelBuffer.h>
@@ -66,7 +66,7 @@ private:
size_t m_read_buffer_index { 0 };
size_t m_space_for_writing { 0 };
bool m_empty { true };
- mutable Lock m_lock { "DoubleBuffer" };
+ mutable Mutex m_lock { "DoubleBuffer" };
};
}
diff --git a/Kernel/FileSystem/BlockBasedFileSystem.h b/Kernel/FileSystem/BlockBasedFileSystem.h
index c50c97687f..e78bdcfcce 100644
--- a/Kernel/FileSystem/BlockBasedFileSystem.h
+++ b/Kernel/FileSystem/BlockBasedFileSystem.h
@@ -42,7 +42,7 @@ private:
DiskCache& cache() const;
void flush_specific_block_if_needed(BlockIndex index);
- mutable Lock m_cache_lock;
+ mutable Mutex m_cache_lock;
mutable OwnPtr<DiskCache> m_cache;
};
diff --git a/Kernel/FileSystem/FIFO.cpp b/Kernel/FileSystem/FIFO.cpp
index 255bceb7b0..6c91e5d240 100644
--- a/Kernel/FileSystem/FIFO.cpp
+++ b/Kernel/FileSystem/FIFO.cpp
@@ -9,7 +9,7 @@
#include <AK/StdLibExtras.h>
#include <Kernel/FileSystem/FIFO.h>
#include <Kernel/FileSystem/FileDescription.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/Process.h>
#include <Kernel/Thread.h>
diff --git a/Kernel/FileSystem/FIFO.h b/Kernel/FileSystem/FIFO.h
index 2a3da33efc..39ef6b8042 100644
--- a/Kernel/FileSystem/FIFO.h
+++ b/Kernel/FileSystem/FIFO.h
@@ -8,7 +8,7 @@
#include <Kernel/DoubleBuffer.h>
#include <Kernel/FileSystem/File.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/UnixTypes.h>
#include <Kernel/WaitQueue.h>
@@ -61,7 +61,7 @@ private:
WaitQueue m_read_open_queue;
WaitQueue m_write_open_queue;
- Lock m_open_lock;
+ Mutex m_open_lock;
};
}
diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp
index 1625639a50..6c15563126 100644
--- a/Kernel/FileSystem/FileDescription.cpp
+++ b/Kernel/FileSystem/FileDescription.cpp
@@ -219,7 +219,7 @@ KResultOr<NonnullOwnPtr<KBuffer>> FileDescription::read_entire_file()
KResultOr<size_t> FileDescription::get_dir_entries(UserOrKernelBuffer& output_buffer, size_t size)
{
- Locker locker(m_lock, Lock::Mode::Shared);
+ Locker locker(m_lock, Mutex::Mode::Shared);
if (!is_directory())
return ENOTDIR;
diff --git a/Kernel/FileSystem/FileDescription.h b/Kernel/FileSystem/FileDescription.h
index 81bab057b4..ae8f9d45b7 100644
--- a/Kernel/FileSystem/FileDescription.h
+++ b/Kernel/FileSystem/FileDescription.h
@@ -156,7 +156,7 @@ private:
bool m_direct : 1 { false };
FIFO::Direction m_fifo_direction { FIFO::Direction::Neither };
- Lock m_lock { "FileDescription" };
+ Mutex m_lock { "FileDescription" };
};
}
diff --git a/Kernel/FileSystem/FileSystem.h b/Kernel/FileSystem/FileSystem.h
index 72d621508c..0693b46b80 100644
--- a/Kernel/FileSystem/FileSystem.h
+++ b/Kernel/FileSystem/FileSystem.h
@@ -12,7 +12,7 @@
#include <Kernel/FileSystem/InodeIdentifier.h>
#include <Kernel/Forward.h>
#include <Kernel/KResult.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/UnixTypes.h>
#include <Kernel/UserOrKernelBuffer.h>
@@ -69,7 +69,7 @@ protected:
void set_block_size(u64 size) { m_block_size = size; }
void set_fragment_size(size_t size) { m_fragment_size = size; }
- mutable Lock m_lock { "FS" };
+ mutable Mutex m_lock { "FS" };
private:
unsigned m_fsid { 0 };
diff --git a/Kernel/FileSystem/Inode.h b/Kernel/FileSystem/Inode.h
index 29dc7d3bca..a49635d020 100644
--- a/Kernel/FileSystem/Inode.h
+++ b/Kernel/FileSystem/Inode.h
@@ -19,7 +19,7 @@
#include <Kernel/FileSystem/InodeMetadata.h>
#include <Kernel/Forward.h>
#include <Kernel/KResult.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
namespace Kernel {
@@ -109,7 +109,7 @@ protected:
void did_modify_contents();
void did_delete_self();
- mutable Lock m_lock { "Inode" };
+ mutable Mutex m_lock { "Inode" };
private:
FileSystem& m_file_system;
diff --git a/Kernel/FileSystem/InodeWatcher.h b/Kernel/FileSystem/InodeWatcher.h
index 3425554e95..e7dca21499 100644
--- a/Kernel/FileSystem/InodeWatcher.h
+++ b/Kernel/FileSystem/InodeWatcher.h
@@ -66,7 +66,7 @@ public:
private:
explicit InodeWatcher() { }
- mutable Lock m_lock;
+ mutable Mutex m_lock;
struct Event {
int wd { 0 };
diff --git a/Kernel/FileSystem/Plan9FileSystem.h b/Kernel/FileSystem/Plan9FileSystem.h
index 0c79fdaf11..53f1621a89 100644
--- a/Kernel/FileSystem/Plan9FileSystem.h
+++ b/Kernel/FileSystem/Plan9FileSystem.h
@@ -135,7 +135,7 @@ private:
ProtocolVersion m_remote_protocol_version { ProtocolVersion::v9P2000 };
size_t m_max_message_size { 4 * KiB };
- Lock m_send_lock { "Plan9FS send" };
+ Mutex m_send_lock { "Plan9FS send" };
Plan9FSBlockCondition m_completion_blocker;
HashMap<u16, NonnullRefPtr<ReceiveCompletion>> m_completions;
diff --git a/Kernel/FileSystem/ProcFS.h b/Kernel/FileSystem/ProcFS.h
index efeb8ed38b..6677f42898 100644
--- a/Kernel/FileSystem/ProcFS.h
+++ b/Kernel/FileSystem/ProcFS.h
@@ -12,7 +12,7 @@
#include <Kernel/FileSystem/Inode.h>
#include <Kernel/Forward.h>
#include <Kernel/KBufferBuilder.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/ProcessExposed.h>
namespace Kernel {
diff --git a/Kernel/FileSystem/SysFS.h b/Kernel/FileSystem/SysFS.h
index 25cc4c237f..e3d2f58127 100644
--- a/Kernel/FileSystem/SysFS.h
+++ b/Kernel/FileSystem/SysFS.h
@@ -33,10 +33,10 @@ public:
void register_new_component(SysFSComponent&);
SysFSDirectory& root_folder() { return m_root_folder; }
- Lock& get_lock() { return m_lock; }
+ Mutex& get_lock() { return m_lock; }
private:
- Lock m_lock;
+ Mutex m_lock;
NonnullRefPtr<SysFSRootDirectory> m_root_folder;
};
diff --git a/Kernel/FileSystem/TmpFS.cpp b/Kernel/FileSystem/TmpFS.cpp
index fa32e9a2da..66951f95ab 100644
--- a/Kernel/FileSystem/TmpFS.cpp
+++ b/Kernel/FileSystem/TmpFS.cpp
@@ -63,7 +63,7 @@ unsigned TmpFS::next_inode_index()
RefPtr<Inode> TmpFS::get_inode(InodeIdentifier identifier) const
{
- Locker locker(m_lock, Lock::Mode::Shared);
+ Locker locker(m_lock, Mutex::Mode::Shared);
VERIFY(identifier.fsid() == fsid());
auto it = m_inodes.find(identifier.index());
@@ -105,14 +105,14 @@ RefPtr<TmpFSInode> TmpFSInode::create_root(TmpFS& fs)
InodeMetadata TmpFSInode::metadata() const
{
- Locker locker(m_lock, Lock::Mode::Shared);
+ Locker locker(m_lock, Mutex::Mode::Shared);
return m_metadata;
}
KResult TmpFSInode::traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)> callback) const
{
- Locker locker(m_lock, Lock::Mode::Shared);
+ Locker locker(m_lock, Mutex::Mode::Shared);
if (!is_directory())
return ENOTDIR;
@@ -129,7 +129,7 @@ KResult TmpFSInode::traverse_as_directory(Function<bool(FileSystem::DirectoryEnt
KResultOr<size_t> TmpFSInode::read_bytes(off_t offset, size_t size, UserOrKernelBuffer& buffer, FileDescription*) const
{
- Locker locker(m_lock, Lock::Mode::Shared);
+ Locker locker(m_lock, Mutex::Mode::Shared);
VERIFY(!is_directory());
VERIFY(offset >= 0);
@@ -198,7 +198,7 @@ KResultOr<size_t> TmpFSInode::write_bytes(off_t offset, size_t size, const UserO
RefPtr<Inode> TmpFSInode::lookup(StringView name)
{
- Locker locker(m_lock, Lock::Mode::Shared);
+ Locker locker(m_lock, Mutex::Mode::Shared);
VERIFY(is_directory());
if (name == ".")
@@ -214,7 +214,7 @@ RefPtr<Inode> TmpFSInode::lookup(StringView name)
KResultOr<size_t> TmpFSInode::directory_entry_count() const
{
- Locker locker(m_lock, Lock::Mode::Shared);
+ Locker locker(m_lock, Mutex::Mode::Shared);
VERIFY(is_directory());
return 2 + m_children.size();
}
diff --git a/Kernel/FileSystem/VirtualFileSystem.h b/Kernel/FileSystem/VirtualFileSystem.h
index 7e99b51fca..b38f581ec9 100644
--- a/Kernel/FileSystem/VirtualFileSystem.h
+++ b/Kernel/FileSystem/VirtualFileSystem.h
@@ -86,7 +86,7 @@ private:
Mount* find_mount_for_host(InodeIdentifier);
Mount* find_mount_for_guest(InodeIdentifier);
- Lock m_lock { "VFSLock" };
+ Mutex m_lock { "VFSLock" };
RefPtr<Inode> m_root_inode;
Vector<Mount, 16> m_mounts;
diff --git a/Kernel/Forward.h b/Kernel/Forward.h
index 8009e16526..db666f4297 100644
--- a/Kernel/Forward.h
+++ b/Kernel/Forward.h
@@ -31,7 +31,7 @@ class InodeWatcher;
class KBuffer;
class KResult;
class LocalSocket;
-class Lock;
+class Mutex;
class MappedROM;
class MasterPTY;
class Mount;
diff --git a/Kernel/GlobalProcessExposed.cpp b/Kernel/GlobalProcessExposed.cpp
index 22a03830c2..dc372f4fbe 100644
--- a/Kernel/GlobalProcessExposed.cpp
+++ b/Kernel/GlobalProcessExposed.cpp
@@ -74,7 +74,7 @@ private:
virtual bool output(KBufferBuilder& builder) override
{
JsonArraySerializer array { builder };
- Locker locker(arp_table().lock(), Lock::Mode::Shared);
+ Locker locker(arp_table().lock(), Mutex::Mode::Shared);
for (auto& it : arp_table().resource()) {
auto obj = array.add_object();
obj.add("mac_address", it.value.to_string());
@@ -247,7 +247,7 @@ public:
private:
ProcFSDumpKmallocStacks();
- mutable Lock m_lock;
+ mutable Mutex m_lock;
};
class ProcFSUBSanDeadly : public ProcFSSystemBoolean {
@@ -266,7 +266,7 @@ public:
private:
ProcFSUBSanDeadly();
- mutable Lock m_lock;
+ mutable Mutex m_lock;
};
class ProcFSCapsLockRemap : public ProcFSSystemBoolean {
@@ -285,7 +285,7 @@ public:
private:
ProcFSCapsLockRemap();
- mutable Lock m_lock;
+ mutable Mutex m_lock;
};
UNMAP_AFTER_INIT NonnullRefPtr<ProcFSDumpKmallocStacks> ProcFSDumpKmallocStacks::must_create(const ProcFSSystemDirectory&)
diff --git a/Kernel/Graphics/VirtIOGPU/VirtIOGPU.h b/Kernel/Graphics/VirtIOGPU/VirtIOGPU.h
index 3f52fbb94f..e0c79efb5f 100644
--- a/Kernel/Graphics/VirtIOGPU/VirtIOGPU.h
+++ b/Kernel/Graphics/VirtIOGPU/VirtIOGPU.h
@@ -240,7 +240,7 @@ private:
// Synchronous commands
WaitQueue m_outstanding_request;
- Lock m_operation_lock;
+ Mutex m_operation_lock;
OwnPtr<Region> m_scratch_space;
};
diff --git a/Kernel/Lock.cpp b/Kernel/Mutex.cpp
index 6afc672ea5..85aed7ea0b 100644
--- a/Kernel/Lock.cpp
+++ b/Kernel/Mutex.cpp
@@ -7,16 +7,16 @@
#include <AK/SourceLocation.h>
#include <Kernel/Debug.h>
#include <Kernel/KSyms.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/SpinLock.h>
#include <Kernel/Thread.h>
namespace Kernel {
#if LOCK_DEBUG
-void Lock::lock(Mode mode, const SourceLocation& location)
+void Mutex::lock(Mode mode, const SourceLocation& location)
#else
-void Lock::lock(Mode mode)
+void Mutex::lock(Mode mode)
#endif
{
// NOTE: This may be called from an interrupt handler (not an IRQ handler)
@@ -30,7 +30,7 @@ void Lock::lock(Mode mode)
Mode current_mode = m_mode;
switch (current_mode) {
case Mode::Unlocked: {
- dbgln_if(LOCK_TRACE_DEBUG, "Lock::lock @ ({}) {}: acquire {}, currently unlocked", this, m_name, mode_to_string(mode));
+ dbgln_if(LOCK_TRACE_DEBUG, "Mutex::lock @ ({}) {}: acquire {}, currently unlocked", this, m_name, mode_to_string(mode));
m_mode = mode;
VERIFY(!m_holder);
VERIFY(m_shared_holders.is_empty());
@@ -71,9 +71,9 @@ void Lock::lock(Mode mode)
if constexpr (LOCK_TRACE_DEBUG) {
if (mode == Mode::Exclusive)
- dbgln("Lock::lock @ {} ({}): acquire {}, currently exclusive, holding: {}", this, m_name, mode_to_string(mode), m_times_locked);
+ dbgln("Mutex::lock @ {} ({}): acquire {}, currently exclusive, holding: {}", this, m_name, mode_to_string(mode), m_times_locked);
else
- dbgln("Lock::lock @ {} ({}): acquire exclusive (requested {}), currently exclusive, holding: {}", this, m_name, mode_to_string(mode), m_times_locked);
+ dbgln("Mutex::lock @ {} ({}): acquire exclusive (requested {}), currently exclusive, holding: {}", this, m_name, mode_to_string(mode), m_times_locked);
}
VERIFY(m_times_locked > 0);
@@ -99,7 +99,7 @@ void Lock::lock(Mode mode)
m_mode = Mode::Exclusive;
m_holder = current_thread;
m_shared_holders.clear();
- dbgln_if(LOCK_TRACE_DEBUG, "Lock::lock @ {} ({}): acquire {}, converted shared to exclusive lock, locks held {}", this, m_name, mode_to_string(mode), m_times_locked);
+ dbgln_if(LOCK_TRACE_DEBUG, "Mutex::lock @ {} ({}): acquire {}, converted shared to exclusive lock, locks held {}", this, m_name, mode_to_string(mode), m_times_locked);
return;
}
}
@@ -109,7 +109,7 @@ void Lock::lock(Mode mode)
VERIFY(m_mode == mode);
}
- dbgln_if(LOCK_TRACE_DEBUG, "Lock::lock @ {} ({}): acquire {}, currently shared, locks held {}", this, m_name, mode_to_string(mode), m_times_locked);
+ dbgln_if(LOCK_TRACE_DEBUG, "Mutex::lock @ {} ({}): acquire {}, currently shared, locks held {}", this, m_name, mode_to_string(mode), m_times_locked);
VERIFY(m_times_locked > 0);
if (m_mode == Mode::Shared) {
@@ -143,7 +143,7 @@ void Lock::lock(Mode mode)
}
}
-void Lock::unlock()
+void Mutex::unlock()
{
// NOTE: This may be called from an interrupt handler (not an IRQ handler)
// and also from within critical sections!
@@ -153,9 +153,9 @@ void Lock::unlock()
Mode current_mode = m_mode;
if constexpr (LOCK_TRACE_DEBUG) {
if (current_mode == Mode::Shared)
- dbgln("Lock::unlock @ {} ({}): release {}, locks held: {}", this, m_name, mode_to_string(current_mode), m_times_locked);
+ dbgln("Mutex::unlock @ {} ({}): release {}, locks held: {}", this, m_name, mode_to_string(current_mode), m_times_locked);
else
- dbgln("Lock::unlock @ {} ({}): release {}, holding: {}", this, m_name, mode_to_string(current_mode), m_times_locked);
+ dbgln("Mutex::unlock @ {} ({}): release {}, holding: {}", this, m_name, mode_to_string(current_mode), m_times_locked);
}
VERIFY(current_mode != Mode::Unlocked);
@@ -200,21 +200,21 @@ void Lock::unlock()
}
}
-void Lock::block(Thread& current_thread, Mode mode, ScopedSpinLock<SpinLock<u8>>& lock, u32 requested_locks)
+void Mutex::block(Thread& current_thread, Mode mode, ScopedSpinLock<SpinLock<u8>>& lock, u32 requested_locks)
{
auto& blocked_thread_list = thread_list_for_mode(mode);
VERIFY(!blocked_thread_list.contains(current_thread));
blocked_thread_list.append(current_thread);
- dbgln_if(LOCK_TRACE_DEBUG, "Lock::lock @ {} ({}) waiting...", this, m_name);
+ dbgln_if(LOCK_TRACE_DEBUG, "Mutex::lock @ {} ({}) waiting...", this, m_name);
current_thread.block(*this, lock, requested_locks);
- dbgln_if(LOCK_TRACE_DEBUG, "Lock::lock @ {} ({}) waited", this, m_name);
+ dbgln_if(LOCK_TRACE_DEBUG, "Mutex::lock @ {} ({}) waited", this, m_name);
VERIFY(blocked_thread_list.contains(current_thread));
blocked_thread_list.remove(current_thread);
}
-void Lock::unblock_waiters(Mode previous_mode)
+void Mutex::unblock_waiters(Mode previous_mode)
{
VERIFY(m_times_locked == 0);
VERIFY(m_mode == Mode::Unlocked);
@@ -253,7 +253,7 @@ void Lock::unblock_waiters(Mode previous_mode)
}
}
-auto Lock::force_unlock_if_locked(u32& lock_count_to_restore) -> Mode
+auto Mutex::force_unlock_if_locked(u32& lock_count_to_restore) -> Mode
{
// NOTE: This may be called from an interrupt handler (not an IRQ handler)
// and also from within critical sections!
@@ -268,7 +268,7 @@ auto Lock::force_unlock_if_locked(u32& lock_count_to_restore) -> Mode
return Mode::Unlocked;
}
- dbgln_if(LOCK_RESTORE_DEBUG, "Lock::force_unlock_if_locked @ {}: unlocking exclusive with lock count: {}", this, m_times_locked);
+ dbgln_if(LOCK_RESTORE_DEBUG, "Mutex::force_unlock_if_locked @ {}: unlocking exclusive with lock count: {}", this, m_times_locked);
#if LOCK_DEBUG
m_holder->holding_lock(*this, -(int)m_times_locked, {});
#endif
@@ -288,7 +288,7 @@ auto Lock::force_unlock_if_locked(u32& lock_count_to_restore) -> Mode
return Mode::Unlocked;
}
- dbgln_if(LOCK_RESTORE_DEBUG, "Lock::force_unlock_if_locked @ {}: unlocking exclusive with lock count: {}, total locks: {}",
+ dbgln_if(LOCK_RESTORE_DEBUG, "Mutex::force_unlock_if_locked @ {}: unlocking exclusive with lock count: {}, total locks: {}",
this, it->value, m_times_locked);
VERIFY(it->value > 0);
@@ -317,9 +317,9 @@ auto Lock::force_unlock_if_locked(u32& lock_count_to_restore) -> Mode
}
#if LOCK_DEBUG
-void Lock::restore_lock(Mode mode, u32 lock_count, const SourceLocation& location)
+void Mutex::restore_lock(Mode mode, u32 lock_count, const SourceLocation& location)
#else
-void Lock::restore_lock(Mode mode, u32 lock_count)
+void Mutex::restore_lock(Mode mode, u32 lock_count)
#endif
{
VERIFY(mode != Mode::Unlocked);
@@ -343,7 +343,7 @@ void Lock::restore_lock(Mode mode, u32 lock_count)
VERIFY(m_mode == Mode::Exclusive);
}
- dbgln_if(LOCK_RESTORE_DEBUG, "Lock::restore_lock @ {}: restoring {} with lock count {}, was {}", this, mode_to_string(mode), lock_count, mode_to_string(previous_mode));
+ dbgln_if(LOCK_RESTORE_DEBUG, "Mutex::restore_lock @ {}: restoring {} with lock count {}, was {}", this, mode_to_string(mode), lock_count, mode_to_string(previous_mode));
VERIFY(m_mode != Mode::Shared);
VERIFY(m_shared_holders.is_empty());
@@ -387,7 +387,7 @@ void Lock::restore_lock(Mode mode, u32 lock_count)
VERIFY(m_mode == Mode::Shared);
}
- dbgln_if(LOCK_RESTORE_DEBUG, "Lock::restore_lock @ {}: restoring {} with lock count {}, was {}",
+ dbgln_if(LOCK_RESTORE_DEBUG, "Mutex::restore_lock @ {}: restoring {} with lock count {}, was {}",
this, mode_to_string(mode), lock_count, mode_to_string(previous_mode));
VERIFY(!m_holder);
diff --git a/Kernel/Lock.h b/Kernel/Mutex.h
index c0908dc136..128996e83e 100644
--- a/Kernel/Lock.h
+++ b/Kernel/Mutex.h
@@ -16,20 +16,20 @@
namespace Kernel {
-class Lock {
+class Mutex {
friend class Thread;
- AK_MAKE_NONCOPYABLE(Lock);
- AK_MAKE_NONMOVABLE(Lock);
+ AK_MAKE_NONCOPYABLE(Mutex);
+ AK_MAKE_NONMOVABLE(Mutex);
public:
using Mode = LockMode;
- Lock(const char* name = nullptr)
+ Mutex(const char* name = nullptr)
: m_name(name)
{
}
- ~Lock() = default;
+ ~Mutex() = default;
#if LOCK_DEBUG
void lock(Mode mode = Mode::Exclusive, const SourceLocation& location = SourceLocation::current());
@@ -108,9 +108,9 @@ private:
class Locker {
public:
#if LOCK_DEBUG
- ALWAYS_INLINE explicit Locker(Lock& l, Lock::Mode mode = Lock::Mode::Exclusive, const SourceLocation& location = SourceLocation::current())
+ ALWAYS_INLINE explicit Locker(Mutex& l, Mutex::Mode mode = Mutex::Mode::Exclusive, const SourceLocation& location = SourceLocation::current())
#else
- ALWAYS_INLINE explicit Locker(Lock& l, Lock::Mode mode = Lock::Mode::Exclusive)
+ ALWAYS_INLINE explicit Locker(Mutex& l, Mutex::Mode mode = Mutex::Mode::Exclusive)
#endif
: m_lock(l)
{
@@ -134,9 +134,9 @@ public:
}
#if LOCK_DEBUG
- ALWAYS_INLINE void lock(Lock::Mode mode = Lock::Mode::Exclusive, const SourceLocation& location = SourceLocation::current())
+ ALWAYS_INLINE void lock(Mutex::Mode mode = Mutex::Mode::Exclusive, const SourceLocation& location = SourceLocation::current())
#else
- ALWAYS_INLINE void lock(Lock::Mode mode = Lock::Mode::Exclusive)
+ ALWAYS_INLINE void lock(Mutex::Mode mode = Mutex::Mode::Exclusive)
#endif
{
VERIFY(!m_locked);
@@ -149,11 +149,11 @@ public:
#endif
}
- Lock& get_lock() { return m_lock; }
- const Lock& get_lock() const { return m_lock; }
+ Mutex& get_lock() { return m_lock; }
+ const Mutex& get_lock() const { return m_lock; }
private:
- Lock& m_lock;
+ Mutex& m_lock;
bool m_locked { true };
};
@@ -165,7 +165,7 @@ public:
: m_resource(move(resource))
{
}
- [[nodiscard]] Lock& lock() { return m_lock; }
+ [[nodiscard]] Mutex& lock() { return m_lock; }
[[nodiscard]] T& resource() { return m_resource; }
[[nodiscard]] T lock_and_copy()
@@ -176,7 +176,7 @@ public:
private:
T m_resource;
- Lock m_lock;
+ Mutex m_lock;
};
class ScopedLockRelease {
@@ -185,7 +185,7 @@ class ScopedLockRelease {
public:
ScopedLockRelease& operator=(ScopedLockRelease&&) = delete;
- ScopedLockRelease(Lock& lock)
+ ScopedLockRelease(Mutex& lock)
: m_lock(&lock)
, m_previous_mode(lock.force_unlock_if_locked(m_previous_recursions))
{
@@ -193,23 +193,23 @@ public:
ScopedLockRelease(ScopedLockRelease&& from)
: m_lock(exchange(from.m_lock, nullptr))
- , m_previous_mode(exchange(from.m_previous_mode, Lock::Mode::Unlocked))
+ , m_previous_mode(exchange(from.m_previous_mode, Mutex::Mode::Unlocked))
, m_previous_recursions(exchange(from.m_previous_recursions, 0))
{
}
~ScopedLockRelease()
{
- if (m_lock && m_previous_mode != Lock::Mode::Unlocked)
+ if (m_lock && m_previous_mode != Mutex::Mode::Unlocked)
m_lock->restore_lock(m_previous_mode, m_previous_recursions);
}
void restore_lock()
{
VERIFY(m_lock);
- if (m_previous_mode != Lock::Mode::Unlocked) {
+ if (m_previous_mode != Mutex::Mode::Unlocked) {
m_lock->restore_lock(m_previous_mode, m_previous_recursions);
- m_previous_mode = Lock::Mode::Unlocked;
+ m_previous_mode = Mutex::Mode::Unlocked;
m_previous_recursions = 0;
}
}
@@ -217,13 +217,13 @@ public:
void do_not_restore()
{
VERIFY(m_lock);
- m_previous_mode = Lock::Mode::Unlocked;
+ m_previous_mode = Mutex::Mode::Unlocked;
m_previous_recursions = 0;
}
private:
- Lock* m_lock;
- Lock::Mode m_previous_mode;
+ Mutex* m_lock;
+ Mutex::Mode m_previous_mode;
u32 m_previous_recursions;
};
diff --git a/Kernel/Net/IPv4Socket.h b/Kernel/Net/IPv4Socket.h
index 19005f683b..7f025882ee 100644
--- a/Kernel/Net/IPv4Socket.h
+++ b/Kernel/Net/IPv4Socket.h
@@ -10,7 +10,7 @@
#include <AK/SinglyLinkedListWithCount.h>
#include <Kernel/DoubleBuffer.h>
#include <Kernel/KBuffer.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/Net/IPv4.h>
#include <Kernel/Net/IPv4SocketTuple.h>
#include <Kernel/Net/Socket.h>
diff --git a/Kernel/Net/IPv4SocketTuple.h b/Kernel/Net/IPv4SocketTuple.h
index d845ca617e..9a964bde89 100644
--- a/Kernel/Net/IPv4SocketTuple.h
+++ b/Kernel/Net/IPv4SocketTuple.h
@@ -9,7 +9,7 @@
#include <AK/HashMap.h>
#include <Kernel/DoubleBuffer.h>
#include <Kernel/KBuffer.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/Net/IPv4.h>
#include <Kernel/Net/Socket.h>
diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp
index 5d25631c8f..fdeb216e95 100644
--- a/Kernel/Net/LocalSocket.cpp
+++ b/Kernel/Net/LocalSocket.cpp
@@ -26,7 +26,7 @@ static Lockable<LocalSocket::List>& all_sockets()
void LocalSocket::for_each(Function<void(const LocalSocket&)> callback)
{
- Locker locker(all_sockets().lock(), Lock::Mode::Shared);
+ Locker locker(all_sockets().lock(), Mutex::Mode::Shared);
for (auto& socket : all_sockets().resource())
callback(socket);
}
diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp
index f65d846b4e..f6f8063eee 100644
--- a/Kernel/Net/NetworkTask.cpp
+++ b/Kernel/Net/NetworkTask.cpp
@@ -5,7 +5,7 @@
*/
#include <Kernel/Debug.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/Net/ARP.h>
#include <Kernel/Net/EtherType.h>
#include <Kernel/Net/EthernetFrameHeader.h>
@@ -224,7 +224,7 @@ void handle_icmp(const EthernetFrameHeader& eth, const IPv4Packet& ipv4_packet,
{
NonnullRefPtrVector<IPv4Socket> icmp_sockets;
{
- Locker locker(IPv4Socket::all_sockets().lock(), Lock::Mode::Shared);
+ Locker locker(IPv4Socket::all_sockets().lock(), Mutex::Mode::Shared);
for (auto* socket : IPv4Socket::all_sockets().resource()) {
if (socket->protocol() != (unsigned)IPv4Protocol::ICMP)
continue;
diff --git a/Kernel/Net/NetworkingManagement.h b/Kernel/Net/NetworkingManagement.h
index f16a8a5fc6..a7ea001bcc 100644
--- a/Kernel/Net/NetworkingManagement.h
+++ b/Kernel/Net/NetworkingManagement.h
@@ -40,7 +40,7 @@ private:
NonnullRefPtrVector<NetworkAdapter> m_adapters;
RefPtr<NetworkAdapter> m_loopback_adapter;
- mutable Lock m_lock { "Networking" };
+ mutable Mutex m_lock { "Networking" };
};
}
diff --git a/Kernel/Net/Socket.h b/Kernel/Net/Socket.h
index 0179b7923f..cd45156a45 100644
--- a/Kernel/Net/Socket.h
+++ b/Kernel/Net/Socket.h
@@ -12,7 +12,7 @@
#include <AK/Time.h>
#include <Kernel/FileSystem/File.h>
#include <Kernel/KResult.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/Net/NetworkAdapter.h>
#include <Kernel/UnixTypes.h>
@@ -99,7 +99,7 @@ public:
gid_t acceptor_gid() const { return m_acceptor.gid; }
const RefPtr<NetworkAdapter> bound_interface() const { return m_bound_interface; }
- Lock& lock() { return m_lock; }
+ Mutex& lock() { return m_lock; }
// ^File
virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override final;
@@ -137,7 +137,7 @@ protected:
private:
virtual bool is_socket() const final { return true; }
- Lock m_lock { "Socket" };
+ Mutex m_lock { "Socket" };
int m_domain { 0 };
int m_type { 0 };
diff --git a/Kernel/Net/TCPSocket.cpp b/Kernel/Net/TCPSocket.cpp
index 5539b51573..0d470ab88e 100644
--- a/Kernel/Net/TCPSocket.cpp
+++ b/Kernel/Net/TCPSocket.cpp
@@ -23,7 +23,7 @@ namespace Kernel {
void TCPSocket::for_each(Function<void(const TCPSocket&)> callback)
{
- Locker locker(sockets_by_tuple().lock(), Lock::Mode::Shared);
+ Locker locker(sockets_by_tuple().lock(), Mutex::Mode::Shared);
for (auto& it : sockets_by_tuple().resource())
callback(*it.value);
}
@@ -68,7 +68,7 @@ Lockable<HashMap<IPv4SocketTuple, TCPSocket*>>& TCPSocket::sockets_by_tuple()
RefPtr<TCPSocket> TCPSocket::from_tuple(const IPv4SocketTuple& tuple)
{
- Locker locker(sockets_by_tuple().lock(), Lock::Mode::Shared);
+ Locker locker(sockets_by_tuple().lock(), Mutex::Mode::Shared);
auto exact_match = sockets_by_tuple().resource().get(tuple);
if (exact_match.has_value())
@@ -91,7 +91,7 @@ RefPtr<TCPSocket> TCPSocket::create_client(const IPv4Address& new_local_address,
auto tuple = IPv4SocketTuple(new_local_address, new_local_port, new_peer_address, new_peer_port);
{
- Locker locker(sockets_by_tuple().lock(), Lock::Mode::Shared);
+ Locker locker(sockets_by_tuple().lock(), Mutex::Mode::Shared);
if (sockets_by_tuple().resource().contains(tuple))
return {};
}
@@ -545,7 +545,7 @@ void TCPSocket::retransmit_packets()
if (routing_decision.is_zero())
return;
- Locker locker(m_not_acked_lock, Lock::Mode::Shared);
+ Locker locker(m_not_acked_lock, Mutex::Mode::Shared);
for (auto& packet : m_not_acked) {
packet.tx_counter++;
diff --git a/Kernel/Net/TCPSocket.h b/Kernel/Net/TCPSocket.h
index 5441a991c7..94dbe9885d 100644
--- a/Kernel/Net/TCPSocket.h
+++ b/Kernel/Net/TCPSocket.h
@@ -202,7 +202,7 @@ private:
int tx_counter { 0 };
};
- mutable Lock m_not_acked_lock { "TCPSocket unacked packets" };
+ mutable Mutex m_not_acked_lock { "TCPSocket unacked packets" };
SinglyLinkedList<OutgoingPacket> m_not_acked;
size_t m_not_acked_size { 0 };
diff --git a/Kernel/Net/UDPSocket.cpp b/Kernel/Net/UDPSocket.cpp
index a39ed22300..fda3f832aa 100644
--- a/Kernel/Net/UDPSocket.cpp
+++ b/Kernel/Net/UDPSocket.cpp
@@ -17,7 +17,7 @@ namespace Kernel {
void UDPSocket::for_each(Function<void(const UDPSocket&)> callback)
{
- Locker locker(sockets_by_port().lock(), Lock::Mode::Shared);
+ Locker locker(sockets_by_port().lock(), Mutex::Mode::Shared);
for (auto it : sockets_by_port().resource())
callback(*it.value);
}
@@ -33,7 +33,7 @@ SocketHandle<UDPSocket> UDPSocket::from_port(u16 port)
{
RefPtr<UDPSocket> socket;
{
- Locker locker(sockets_by_port().lock(), Lock::Mode::Shared);
+ Locker locker(sockets_by_port().lock(), Mutex::Mode::Shared);
auto it = sockets_by_port().resource().find(port);
if (it == sockets_by_port().resource().end())
return {};
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index b0a25a330d..d1b03082f2 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -44,7 +44,7 @@ RecursiveSpinLock g_processes_lock;
static Atomic<pid_t> next_pid;
READONLY_AFTER_INIT Process::List* g_processes;
READONLY_AFTER_INIT String* g_hostname;
-READONLY_AFTER_INIT Lock* g_hostname_lock;
+READONLY_AFTER_INIT Mutex* g_hostname_lock;
READONLY_AFTER_INIT HashMap<String, OwnPtr<Module>>* g_modules;
READONLY_AFTER_INIT Region* g_signal_trampoline_region;
@@ -66,7 +66,7 @@ UNMAP_AFTER_INIT void Process::initialize()
g_processes = new Process::List();
g_process_groups = new ProcessGroup::List();
g_hostname = new String("courage");
- g_hostname_lock = new Lock;
+ g_hostname_lock = new Mutex;
create_signal_trampoline();
}
diff --git a/Kernel/Process.h b/Kernel/Process.h
index f14e0078a5..dc2bd5aab0 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -22,7 +22,7 @@
#include <Kernel/FileSystem/InodeMetadata.h>
#include <Kernel/Forward.h>
#include <Kernel/FutexQueue.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/PerformanceEventBuffer.h>
#include <Kernel/ProcessGroup.h>
#include <Kernel/StdLib.h>
@@ -469,8 +469,8 @@ public:
return m_thread_count.load(AK::MemoryOrder::memory_order_relaxed);
}
- Lock& big_lock() { return m_big_lock; }
- Lock& ptrace_lock() { return m_ptrace_lock; }
+ Mutex& big_lock() { return m_big_lock; }
+ Mutex& ptrace_lock() { return m_ptrace_lock; }
Custody& root_directory();
Custody& root_directory_relative_to_global_root();
@@ -696,8 +696,8 @@ private:
size_t m_master_tls_size { 0 };
size_t m_master_tls_alignment { 0 };
- Lock m_big_lock { "Process" };
- Lock m_ptrace_lock { "ptrace" };
+ Mutex m_big_lock { "Process" };
+ Mutex m_ptrace_lock { "ptrace" };
RefPtr<Timer> m_alarm_timer;
diff --git a/Kernel/ProcessExposed.h b/Kernel/ProcessExposed.h
index c5a1a2afb7..8074d848ef 100644
--- a/Kernel/ProcessExposed.h
+++ b/Kernel/ProcessExposed.h
@@ -38,10 +38,10 @@ public:
void unregister_process(Process&);
ProcFSRootDirectory& root_folder() { return *m_root_folder; }
- Lock& get_lock() { return m_lock; }
+ Mutex& get_lock() { return m_lock; }
private:
- Lock m_lock;
+ Mutex m_lock;
NonnullRefPtr<ProcFSRootDirectory> m_root_folder;
};
@@ -120,7 +120,7 @@ protected:
virtual bool acquire_link(KBufferBuilder& builder) = 0;
explicit ProcFSExposedLink(StringView name);
ProcFSExposedLink(StringView name, InodeIndex preallocated_index);
- mutable Lock m_lock { "ProcFSLink" };
+ mutable Mutex m_lock { "ProcFSLink" };
};
class ProcFSProcessDirectory final
diff --git a/Kernel/ProcessGroup.h b/Kernel/ProcessGroup.h
index 0be93ff5c4..317067629f 100644
--- a/Kernel/ProcessGroup.h
+++ b/Kernel/ProcessGroup.h
@@ -9,7 +9,7 @@
#include <AK/IntrusiveList.h>
#include <AK/RefCounted.h>
#include <AK/Weakable.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/SpinLock.h>
#include <Kernel/UnixTypes.h>
diff --git a/Kernel/ProcessSpecificExposed.cpp b/Kernel/ProcessSpecificExposed.cpp
index ad26f1940b..95c05fe159 100644
--- a/Kernel/ProcessSpecificExposed.cpp
+++ b/Kernel/ProcessSpecificExposed.cpp
@@ -84,7 +84,7 @@ private:
{
}
WeakPtr<ProcFSProcessDirectory> m_process_folder;
- mutable Lock m_lock;
+ mutable Mutex m_lock;
};
KResultOr<size_t> ProcFSProcessStacks::entries_count() const
@@ -193,7 +193,7 @@ private:
{
}
WeakPtr<ProcFSProcessDirectory> m_process_folder;
- mutable Lock m_lock;
+ mutable Mutex m_lock;
};
KResultOr<size_t> ProcFSProcessFileDescriptions::entries_count() const
diff --git a/Kernel/Random.h b/Kernel/Random.h
index 9102392940..e9907157a1 100644
--- a/Kernel/Random.h
+++ b/Kernel/Random.h
@@ -10,7 +10,7 @@
#include <AK/Assertions.h>
#include <AK/ByteBuffer.h>
#include <AK/Types.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/StdLib.h>
#include <LibCrypto/Cipher/AES.h>
#include <LibCrypto/Cipher/Cipher.h>
diff --git a/Kernel/Storage/AHCIPort.h b/Kernel/Storage/AHCIPort.h
index a8730272b3..da16679794 100644
--- a/Kernel/Storage/AHCIPort.h
+++ b/Kernel/Storage/AHCIPort.h
@@ -11,7 +11,7 @@
#include <Kernel/Devices/Device.h>
#include <Kernel/IO.h>
#include <Kernel/Interrupts/IRQHandler.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/PhysicalAddress.h>
#include <Kernel/Random.h>
#include <Kernel/Sections.h>
@@ -102,7 +102,7 @@ private:
EntropySource m_entropy_source;
RefPtr<AsyncBlockDeviceRequest> m_current_request;
SpinLock<u8> m_hard_lock;
- Lock m_lock { "AHCIPort" };
+ Mutex m_lock { "AHCIPort" };
mutable bool m_wait_for_completion { false };
bool m_wait_connect_for_completion { false };
diff --git a/Kernel/Storage/AHCIPortHandler.h b/Kernel/Storage/AHCIPortHandler.h
index 36c1fe071a..c698693e3d 100644
--- a/Kernel/Storage/AHCIPortHandler.h
+++ b/Kernel/Storage/AHCIPortHandler.h
@@ -11,7 +11,7 @@
#include <Kernel/Devices/Device.h>
#include <Kernel/IO.h>
#include <Kernel/Interrupts/IRQHandler.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/PhysicalAddress.h>
#include <Kernel/Random.h>
#include <Kernel/Sections.h>
diff --git a/Kernel/Storage/IDEChannel.h b/Kernel/Storage/IDEChannel.h
index 73c427e689..012259598b 100644
--- a/Kernel/Storage/IDEChannel.h
+++ b/Kernel/Storage/IDEChannel.h
@@ -21,7 +21,7 @@
#include <Kernel/Devices/Device.h>
#include <Kernel/IO.h>
#include <Kernel/Interrupts/IRQHandler.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/PhysicalAddress.h>
#include <Kernel/Random.h>
#include <Kernel/Storage/StorageDevice.h>
@@ -158,7 +158,7 @@ protected:
u64 m_current_request_block_index { 0 };
bool m_current_request_flushing_cache { false };
SpinLock<u8> m_request_lock;
- Lock m_lock { "IDEChannel" };
+ Mutex m_lock { "IDEChannel" };
IOAddressGroup m_io_group;
NonnullRefPtr<IDEController> m_parent_controller;
diff --git a/Kernel/Storage/PATADiskDevice.h b/Kernel/Storage/PATADiskDevice.h
index 1d2fc24d13..94d8479319 100644
--- a/Kernel/Storage/PATADiskDevice.h
+++ b/Kernel/Storage/PATADiskDevice.h
@@ -11,7 +11,7 @@
#pragma once
#include <Kernel/Interrupts/IRQHandler.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/Storage/StorageDevice.h>
namespace Kernel {
@@ -52,7 +52,7 @@ private:
bool is_slave() const;
- Lock m_lock { "IDEDiskDevice" };
+ Mutex m_lock { "IDEDiskDevice" };
u16 m_capabilities { 0 };
NonnullRefPtr<IDEChannel> m_channel;
DriveType m_drive_type { DriveType::Master };
diff --git a/Kernel/Storage/RamdiskDevice.h b/Kernel/Storage/RamdiskDevice.h
index e244808280..41b5b4f3be 100644
--- a/Kernel/Storage/RamdiskDevice.h
+++ b/Kernel/Storage/RamdiskDevice.h
@@ -6,7 +6,7 @@
#pragma once
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/Storage/StorageDevice.h>
namespace Kernel {
@@ -30,7 +30,7 @@ public:
bool is_slave() const;
- Lock m_lock { "RamdiskDevice" };
+ Mutex m_lock { "RamdiskDevice" };
NonnullOwnPtr<Region> m_region;
};
diff --git a/Kernel/Storage/SATADiskDevice.h b/Kernel/Storage/SATADiskDevice.h
index cf656162c0..22cb82a933 100644
--- a/Kernel/Storage/SATADiskDevice.h
+++ b/Kernel/Storage/SATADiskDevice.h
@@ -7,7 +7,7 @@
#pragma once
#include <Kernel/Interrupts/IRQHandler.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/Storage/AHCIPort.h>
#include <Kernel/Storage/StorageDevice.h>
diff --git a/Kernel/Storage/StorageController.h b/Kernel/Storage/StorageController.h
index 358516d5ac..1989cef86c 100644
--- a/Kernel/Storage/StorageController.h
+++ b/Kernel/Storage/StorageController.h
@@ -12,7 +12,7 @@
#include <Kernel/Bus/PCI/DeviceController.h>
#include <Kernel/Devices/Device.h>
#include <Kernel/IO.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/PhysicalAddress.h>
#include <Kernel/Random.h>
#include <Kernel/VM/PhysicalPage.h>
diff --git a/Kernel/Storage/StorageDevice.h b/Kernel/Storage/StorageDevice.h
index f1c375ef8a..a77bc706e8 100644
--- a/Kernel/Storage/StorageDevice.h
+++ b/Kernel/Storage/StorageDevice.h
@@ -8,7 +8,7 @@
#include <Kernel/Devices/BlockDevice.h>
#include <Kernel/Interrupts/IRQHandler.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
#include <Kernel/Storage/Partition/DiskPartition.h>
#include <Kernel/Storage/StorageController.h>
diff --git a/Kernel/Syscalls/hostname.cpp b/Kernel/Syscalls/hostname.cpp
index f2b06ff445..5a51f6674b 100644
--- a/Kernel/Syscalls/hostname.cpp
+++ b/Kernel/Syscalls/hostname.cpp
@@ -9,14 +9,14 @@
namespace Kernel {
extern String* g_hostname;
-extern Lock* g_hostname_lock;
+extern Mutex* g_hostname_lock;
KResultOr<FlatPtr> Process::sys$gethostname(Userspace<char*> buffer, size_t size)
{
REQUIRE_PROMISE(stdio);
if (size > NumericLimits<ssize_t>::max())
return EINVAL;
- Locker locker(*g_hostname_lock, Lock::Mode::Shared);
+ Locker locker(*g_hostname_lock, Mutex::Mode::Shared);
if (size < (g_hostname->length() + 1))
return ENAMETOOLONG;
if (!copy_to_user(buffer, g_hostname->characters(), g_hostname->length() + 1))
@@ -29,7 +29,7 @@ KResultOr<FlatPtr> Process::sys$sethostname(Userspace<const char*> hostname, siz
REQUIRE_NO_PROMISES;
if (!is_superuser())
return EPERM;
- Locker locker(*g_hostname_lock, Lock::Mode::Exclusive);
+ Locker locker(*g_hostname_lock, Mutex::Mode::Exclusive);
if (length > 64)
return ENAMETOOLONG;
auto copied_hostname = copy_string_from_user(hostname, length);
diff --git a/Kernel/Syscalls/uname.cpp b/Kernel/Syscalls/uname.cpp
index c0ca490632..01077af510 100644
--- a/Kernel/Syscalls/uname.cpp
+++ b/Kernel/Syscalls/uname.cpp
@@ -11,11 +11,11 @@ namespace Kernel {
KResultOr<FlatPtr> Process::sys$uname(Userspace<utsname*> user_buf)
{
extern String* g_hostname;
- extern Lock* g_hostname_lock;
+ extern Mutex* g_hostname_lock;
REQUIRE_PROMISE(stdio);
- Locker locker(*g_hostname_lock, Lock::Mode::Shared);
+ Locker locker(*g_hostname_lock, Mutex::Mode::Shared);
if (g_hostname->length() + 1 > sizeof(utsname::nodename))
return ENAMETOOLONG;
diff --git a/Kernel/TTY/PTYMultiplexer.h b/Kernel/TTY/PTYMultiplexer.h
index b0eaf9fc69..d40b5b9c85 100644
--- a/Kernel/TTY/PTYMultiplexer.h
+++ b/Kernel/TTY/PTYMultiplexer.h
@@ -8,7 +8,7 @@
#include <AK/Badge.h>
#include <Kernel/Devices/CharacterDevice.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
namespace Kernel {
@@ -43,7 +43,7 @@ private:
// ^CharacterDevice
virtual StringView class_name() const override { return "PTYMultiplexer"; }
- Lock m_lock { "PTYMultiplexer" };
+ Mutex m_lock { "PTYMultiplexer" };
Vector<unsigned> m_freelist;
};
diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp
index 40abdba261..b4ffcd8da1 100644
--- a/Kernel/Thread.cpp
+++ b/Kernel/Thread.cpp
@@ -172,7 +172,7 @@ Thread::~Thread()
}
}
-void Thread::block(Kernel::Lock& lock, ScopedSpinLock<SpinLock<u8>>& lock_lock, u32 lock_count)
+void Thread::block(Kernel::Mutex& lock, ScopedSpinLock<SpinLock<u8>>& lock_lock, u32 lock_count)
{
VERIFY(!Processor::current().in_irq());
VERIFY(this == Thread::current());
@@ -206,7 +206,7 @@ void Thread::block(Kernel::Lock& lock, ScopedSpinLock<SpinLock<u8>>& lock_lock,
lock_lock.unlock();
- dbgln_if(THREAD_DEBUG, "Thread {} blocking on Lock {}", *this, &lock);
+ dbgln_if(THREAD_DEBUG, "Thread {} blocking on Mutex {}", *this, &lock);
auto& big_lock = process().big_lock();
for (;;) {
@@ -238,7 +238,7 @@ void Thread::block(Kernel::Lock& lock, ScopedSpinLock<SpinLock<u8>>& lock_lock,
lock_lock.lock();
}
-u32 Thread::unblock_from_lock(Kernel::Lock& lock)
+u32 Thread::unblock_from_lock(Kernel::Mutex& lock)
{
ScopedSpinLock block_lock(m_block_lock);
VERIFY(m_blocking_lock == &lock);
@@ -253,7 +253,7 @@ u32 Thread::unblock_from_lock(Kernel::Lock& lock)
VERIFY(g_scheduler_lock.own_lock());
VERIFY(m_block_lock.own_lock());
VERIFY(m_blocking_lock == &lock);
- dbgln_if(THREAD_DEBUG, "Thread {} unblocked from Lock {}", *this, &lock);
+ dbgln_if(THREAD_DEBUG, "Thread {} unblocked from Mutex {}", *this, &lock);
m_blocking_lock = nullptr;
if (Thread::current() == this) {
set_state(Thread::Running);
@@ -491,7 +491,7 @@ const char* Thread::state_string() const
case Thread::Blocked: {
ScopedSpinLock block_lock(m_block_lock);
if (m_blocking_lock)
- return "Lock";
+ return "Mutex";
if (m_blocker)
return m_blocker->state_string();
VERIFY_NOT_REACHED();
@@ -512,7 +512,7 @@ void Thread::finalize()
ScopedSpinLock list_lock(m_holding_locks_lock);
for (auto& info : m_holding_locks_list) {
const auto& location = info.source_location;
- dbgln(" - Lock: \"{}\" @ {} locked in function \"{}\" at \"{}:{}\" with a count of: {}", info.lock->name(), info.lock, location.function_name(), location.filename(), location.line_number(), info.count);
+ dbgln(" - Mutex: \"{}\" @ {} locked in function \"{}\" at \"{}:{}\" with a count of: {}", info.lock->name(), info.lock, location.function_name(), location.filename(), location.line_number(), info.count);
}
VERIFY_NOT_REACHED();
}
diff --git a/Kernel/Thread.h b/Kernel/Thread.h
index da5bcd751a..1c80ce5e40 100644
--- a/Kernel/Thread.h
+++ b/Kernel/Thread.h
@@ -116,7 +116,7 @@ class Thread
AK_MAKE_NONCOPYABLE(Thread);
AK_MAKE_NONMOVABLE(Thread);
- friend class Lock;
+ friend class Mutex;
friend class Process;
friend class ProtectedProcessBase;
friend class Scheduler;
@@ -824,7 +824,7 @@ public:
}
}
- void block(Kernel::Lock&, ScopedSpinLock<SpinLock<u8>>&, u32);
+ void block(Kernel::Mutex&, ScopedSpinLock<SpinLock<u8>>&, u32);
template<typename BlockerType, class... Args>
[[nodiscard]] BlockResult block(const BlockTimeout& timeout, Args&&... args)
@@ -957,7 +957,7 @@ public:
return result;
}
- u32 unblock_from_lock(Kernel::Lock&);
+ u32 unblock_from_lock(Kernel::Mutex&);
void unblock_from_blocker(Blocker&);
void unblock(u8 signal = 0);
@@ -1126,7 +1126,7 @@ public:
RecursiveSpinLock& get_lock() const { return m_lock; }
#if LOCK_DEBUG
- void holding_lock(Lock& lock, int refs_delta, const SourceLocation& location)
+ void holding_lock(Mutex& lock, int refs_delta, const SourceLocation& location)
{
VERIFY(refs_delta != 0);
m_holding_locks.fetch_add(refs_delta, AK::MemoryOrder::memory_order_relaxed);
@@ -1283,13 +1283,13 @@ private:
Optional<Range> m_thread_specific_range;
Array<SignalActionData, NSIG> m_signal_action_data;
Blocker* m_blocker { nullptr };
- Kernel::Lock* m_blocking_lock { nullptr };
+ Kernel::Mutex* m_blocking_lock { nullptr };
u32 m_lock_requested_count { 0 };
IntrusiveListNode<Thread> m_blocked_threads_list_node;
#if LOCK_DEBUG
struct HoldingLockInfo {
- Lock* lock;
+ Mutex* lock;
SourceLocation source_location;
unsigned count;
};
diff --git a/Kernel/VM/VMObject.h b/Kernel/VM/VMObject.h
index 7ca350922f..3cd3b09082 100644
--- a/Kernel/VM/VMObject.h
+++ b/Kernel/VM/VMObject.h
@@ -14,7 +14,7 @@
#include <AK/Vector.h>
#include <AK/Weakable.h>
#include <Kernel/Forward.h>
-#include <Kernel/Lock.h>
+#include <Kernel/Mutex.h>
namespace Kernel {
@@ -70,7 +70,7 @@ protected:
IntrusiveListNode<VMObject> m_list_node;
FixedArray<RefPtr<PhysicalPage>> m_physical_pages;
- Lock m_paging_lock { "VMObject" };
+ Mutex m_paging_lock { "VMObject" };
mutable SpinLock<u8> m_lock;