1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +00:00

Kernel: Make self-contained locking smart pointers their own classes

Until now, our kernel has reimplemented a number of AK classes to
provide automatic internal locking:

- RefPtr
- NonnullRefPtr
- WeakPtr
- Weakable

This patch renames the Kernel classes so that they can coexist with
the original AK classes:

- RefPtr => LockRefPtr
- NonnullRefPtr => NonnullLockRefPtr
- WeakPtr => LockWeakPtr
- Weakable => LockWeakable

The goal here is to eventually get rid of the Lock* classes in favor of
using external locking.
This commit is contained in:
Andreas Kling 2022-08-19 20:53:40 +02:00
parent e475263113
commit 11eee67b85
360 changed files with 1703 additions and 1672 deletions

View file

@ -19,7 +19,7 @@ namespace Kernel {
TRY(require_promise(Pledge::unix)); \
} while (0)
static void setup_socket_fd(Process::OpenFileDescriptions& fds, int fd, NonnullRefPtr<OpenFileDescription> description, int type)
static void setup_socket_fd(Process::OpenFileDescriptions& fds, int fd, NonnullLockRefPtr<OpenFileDescription> description, int type)
{
description->set_readable(true);
description->set_writable(true);
@ -92,7 +92,7 @@ ErrorOr<FlatPtr> Process::sys$accept4(Userspace<Syscall::SC_accept4_params const
TRY(copy_from_user(&address_size, static_ptr_cast<socklen_t const*>(user_address_size)));
ScopedDescriptionAllocation fd_allocation;
RefPtr<OpenFileDescription> accepting_socket_description;
LockRefPtr<OpenFileDescription> accepting_socket_description;
TRY(m_fds.with_exclusive([&](auto& fds) -> ErrorOr<void> {
fd_allocation = TRY(fds.allocate());
@ -103,7 +103,7 @@ ErrorOr<FlatPtr> Process::sys$accept4(Userspace<Syscall::SC_accept4_params const
return ENOTSOCK;
auto& socket = *accepting_socket_description->socket();
RefPtr<Socket> accepted_socket;
LockRefPtr<Socket> accepted_socket;
for (;;) {
accepted_socket = socket.accept();
if (accepted_socket)