Add mesosphere (VERY VERY WIP)

This commit is contained in:
TuxSH
2018-10-31 21:47:31 +01:00
committed by Michael Scire
parent 50e307b4b7
commit 745fa84e5e
56 changed files with 5033 additions and 0 deletions

View 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);
}
}
}