1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 20:25:07 +00:00

Kernel: Remove ancient nprocess and nblocked globals.

These were not in sync with reality, and not used anywhere anyway.
This commit is contained in:
Andreas Kling 2019-04-03 13:05:20 +02:00
parent ac46e45f6e
commit a095a90b51
3 changed files with 0 additions and 15 deletions

View file

@ -51,7 +51,6 @@ void Process::initialize()
Vector<pid_t> Process::all_pids()
{
Vector<pid_t> pids;
pids.ensure_capacity(system.nprocess);
InterruptDisabler disabler;
for (auto* process = g_processes->head(); process; process = process->next())
pids.append(process->pid());
@ -61,7 +60,6 @@ Vector<pid_t> Process::all_pids()
Vector<Process*> Process::all_processes()
{
Vector<Process*> processes;
processes.ensure_capacity(system.nprocess);
InterruptDisabler disabler;
for (auto* process = g_processes->head(); process; process = process->next())
processes.append(process);
@ -260,7 +258,6 @@ Process* Process::fork(RegisterDump& regs)
{
InterruptDisabler disabler;
g_processes->prepend(child);
system.nprocess++;
}
#ifdef TASK_DEBUG
kprintf("Process %u (%s) forked from %u @ %p\n", child->pid(), child->name().characters(), m_pid, child_tss.eip);
@ -508,7 +505,6 @@ Process* Process::create_user_process(const String& path, uid_t uid, gid_t gid,
{
InterruptDisabler disabler;
g_processes->prepend(process);
system.nprocess++;
}
#ifdef TASK_DEBUG
kprintf("Process %u (%s) spawned @ %p\n", process->pid(), process->name().characters(), process->main_thread().tss().eip);
@ -525,7 +521,6 @@ Process* Process::create_kernel_process(String&& name, void (*e)())
if (process->pid() != 0) {
InterruptDisabler disabler;
g_processes->prepend(process);
system.nprocess++;
#ifdef TASK_DEBUG
kprintf("Kernel process %u (%s) spawned @ %p\n", process->pid(), process->name().characters(), process->main_thread().tss().eip);
#endif
@ -611,11 +606,6 @@ Process::Process(String&& name, uid_t uid, gid_t gid, pid_t ppid, RingLevel ring
Process::~Process()
{
dbgprintf("~Process{%p} name=%s pid=%d, m_fds=%d\n", this, m_name.characters(), pid(), m_fds.size());
{
InterruptDisabler disabler;
system.nprocess--;
}
delete m_main_thread;
m_main_thread = nullptr;
}

View file

@ -94,12 +94,10 @@ Thread::~Thread()
void Thread::unblock()
{
if (current == this) {
system.nblocked--;
m_state = Thread::Running;
return;
}
ASSERT(m_state != Thread::Runnable && m_state != Thread::Running);
system.nblocked--;
m_state = Thread::Runnable;
}
@ -117,7 +115,6 @@ void Thread::block(Thread::State new_state)
kprintf("Thread::block: %s(%u) block(%u/%s) with state=%u/%s\n", process().name().characters(), process().pid(), new_state, to_string(new_state), state(), to_string(state()));
}
ASSERT(state() == Thread::Running);
system.nblocked++;
m_was_interrupted_while_blocked = false;
set_state(new_state);
Scheduler::yield();

View file

@ -5,8 +5,6 @@
struct system_t
{
time_t uptime;
dword nprocess;
dword nblocked;
};
extern system_t system;