Add mesosphere (VERY VERY WIP)
This commit is contained in:
20
mesosphere/source/interfaces/IAlarmable.cpp
Normal file
20
mesosphere/source/interfaces/IAlarmable.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <mesosphere/interfaces/IAlarmable.hpp>
|
||||
#include <mesosphere/core/KCoreContext.hpp>
|
||||
#include <mesosphere/interrupts/KAlarm.hpp>
|
||||
|
||||
namespace mesosphere
|
||||
{
|
||||
|
||||
void IAlarmable::SetAlarmTimeImpl(const KSystemClock::time_point &alarmTime)
|
||||
{
|
||||
this->alarmTime = alarmTime;
|
||||
KCoreContext::GetCurrentInstance().GetAlarm()->AddAlarmable(*this);
|
||||
}
|
||||
|
||||
void IAlarmable::ClearAlarm()
|
||||
{
|
||||
KCoreContext::GetCurrentInstance().GetAlarm()->RemoveAlarmable(*this);
|
||||
alarmTime = KSystemClock::time_point{};
|
||||
}
|
||||
|
||||
}
|
||||
12
mesosphere/source/interfaces/IInterruptibleWork.cpp
Normal file
12
mesosphere/source/interfaces/IInterruptibleWork.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <mesosphere/interfaces/IInterruptibleWork.hpp>
|
||||
|
||||
namespace mesosphere
|
||||
{
|
||||
|
||||
IWork *IInterruptibleWork::HandleInterrupt(uint interruptId)
|
||||
{
|
||||
(void)interruptId;
|
||||
return (IWork *)this;
|
||||
}
|
||||
|
||||
}
|
||||
26
mesosphere/source/interfaces/ILimitedResource.cpp
Normal file
26
mesosphere/source/interfaces/ILimitedResource.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <mesosphere/interfaces/ILimitedResource.hpp>
|
||||
#include <mesosphere/processes/KProcess.hpp>
|
||||
#include <mesosphere/kresources/KResourceLimit.hpp>
|
||||
|
||||
namespace mesosphere::detail
|
||||
{
|
||||
|
||||
void ReleaseResource(const SharedPtr<KResourceLimit> &reslimit, KAutoObject::TypeId typeId, size_t count, size_t realCount)
|
||||
{
|
||||
if (reslimit != nullptr) {
|
||||
reslimit->Release(KResourceLimit::GetCategory(typeId), count, realCount);
|
||||
} else {
|
||||
KResourceLimit::GetDefaultInstance().Release(KResourceLimit::GetCategory(typeId), count, realCount);
|
||||
}
|
||||
}
|
||||
|
||||
void ReleaseResource(const SharedPtr<KProcess> &owner, KAutoObject::TypeId typeId, size_t count, size_t realCount)
|
||||
{
|
||||
if (owner != nullptr) {
|
||||
return ReleaseResource(owner->GetResourceLimit(), typeId, count, realCount);
|
||||
} else {
|
||||
KResourceLimit::GetDefaultInstance().Release(KResourceLimit::GetCategory(typeId), count, realCount);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user