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

Kernel: PID/TID typing

This compiles, and contains exactly the same bugs as before.
The regex 'FIXME: PID/' should reveal all markers that I left behind, including:
- Incomplete conversion
- Issues or things that look fishy
- Actual bugs that will go wrong during runtime
This commit is contained in:
Ben Wiederhake 2020-08-08 17:32:34 +02:00 committed by Andreas Kling
parent f225321184
commit f5744a6f2f
26 changed files with 136 additions and 111 deletions

View file

@ -136,7 +136,7 @@ Thread::WriteBlocker::WriteBlocker(const FileDescription& description)
timespec* Thread::WriteBlocker::override_timeout(timespec* timeout)
{
auto& description = blocked_description();
auto& description = blocked_description();
if (description.is_socket()) {
auto& socket = *description.socket();
if (socket.has_send_timeout()) {
@ -227,7 +227,7 @@ bool Thread::SelectBlocker::should_unblock(Thread& thread)
return false;
}
Thread::WaitBlocker::WaitBlocker(int wait_options, pid_t& waitee_pid)
Thread::WaitBlocker::WaitBlocker(int wait_options, ProcessID& waitee_pid)
: m_wait_options(wait_options)
, m_waitee_pid(waitee_pid)
{
@ -296,8 +296,7 @@ void Thread::consider_unblock(time_t now_sec, long now_usec)
case Thread::Dying:
/* don't know, don't care */
return;
case Thread::Blocked:
{
case Thread::Blocked: {
ASSERT(m_blocker != nullptr);
timespec now;
now.tv_sec = now_sec,
@ -378,7 +377,7 @@ bool Scheduler::pick_next()
auto name = process.name();
auto pid = process.pid();
auto exit_status = Process::reap(process);
dbg() << "Scheduler[" << Processor::current().id() << "]: Reaped unparented process " << name << "(" << pid << "), exit status: " << exit_status.si_status;
dbg() << "Scheduler[" << Processor::current().id() << "]: Reaped unparented process " << name << "(" << pid.value() << "), exit status: " << exit_status.si_status;
}
return IterationDecision::Continue;
}
@ -496,7 +495,7 @@ bool Scheduler::yield()
bool Scheduler::donate_to(Thread* beneficiary, const char* reason)
{
ASSERT(beneficiary);
// Set the m_in_scheduler flag before acquiring the spinlock. This
// prevents a recursive call into Scheduler::invoke_async upon
// leaving the scheduler lock.
@ -685,8 +684,9 @@ void Scheduler::timer_tick(const RegisterState& regs)
SmapDisabler disabler;
auto backtrace = current_thread->raw_backtrace(regs.ebp, regs.eip);
auto& sample = Profiling::next_sample_slot();
sample.pid = current_thread->process().pid();
sample.tid = current_thread->tid();
// FIXME: PID/TID INCOMPLETE
sample.pid = current_thread->process().pid().value();
sample.tid = current_thread->tid().value();
sample.timestamp = g_uptime;
for (size_t i = 0; i < min(backtrace.size(), Profiling::max_stack_frame_count); ++i) {
sample.frames[i] = backtrace[i];