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

Kernel: Replace "current" with Thread::current and Process::current

Suggested by Sergey. The currently running Thread and Process are now
Thread::current and Process::current respectively. :^)
This commit is contained in:
Andreas Kling 2020-02-17 15:04:27 +01:00
parent 4f4af24b9d
commit 48f7c28a5c
37 changed files with 257 additions and 252 deletions

View file

@ -54,7 +54,7 @@ Socket::Socket(int domain, int type, int protocol)
, m_type(type)
, m_protocol(protocol)
{
auto& process = current->process();
auto& process = *Process::current;
m_origin = { process.pid(), process.uid(), process.gid() };
}
@ -65,7 +65,7 @@ Socket::~Socket()
void Socket::set_setup_state(SetupState new_setup_state)
{
#ifdef SOCKET_DEBUG
kprintf("%s(%u) Socket{%p} setup state moving from %s to %s\n", current->process().name().characters(), current->pid(), this, to_string(m_setup_state), to_string(new_setup_state));
kprintf("%s(%u) Socket{%p} setup state moving from %s to %s\n", Process::current->name().characters(), Process::current->pid(), this, to_string(m_setup_state), to_string(new_setup_state));
#endif
m_setup_state = new_setup_state;
@ -77,11 +77,11 @@ RefPtr<Socket> Socket::accept()
if (m_pending.is_empty())
return nullptr;
#ifdef SOCKET_DEBUG
kprintf("%s(%u) Socket{%p} de-queueing connection\n", current->process().name().characters(), current->pid(), this);
kprintf("%s(%u) Socket{%p} de-queueing connection\n", Process::current->name().characters(), Process::current->pid(), this);
#endif
auto client = m_pending.take_first();
ASSERT(!client->is_connected());
auto& process = current->process();
auto& process = *Process::current;
client->m_acceptor = { process.pid(), process.uid(), process.gid() };
client->m_connected = true;
client->m_role = Role::Accepted;
@ -91,7 +91,7 @@ RefPtr<Socket> Socket::accept()
KResult Socket::queue_connection_from(NonnullRefPtr<Socket> peer)
{
#ifdef SOCKET_DEBUG
kprintf("%s(%u) Socket{%p} queueing connection\n", current->process().name().characters(), current->pid(), this);
kprintf("%s(%u) Socket{%p} queueing connection\n", Process::current->name().characters(), Process::current->pid(), this);
#endif
LOCKER(m_lock);
if (m_pending.size() >= m_backlog)