mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-28 09:30:58 +01:00
kern: add support for InfoType_FreeThreadCount
This commit is contained in:
parent
7336dc2b7a
commit
c45088d1cd
@ -59,6 +59,7 @@ namespace ams::kern::svc {
|
||||
case ams::svc::InfoType_TotalNonSystemMemorySize:
|
||||
case ams::svc::InfoType_UsedNonSystemMemorySize:
|
||||
case ams::svc::InfoType_IsApplication:
|
||||
case ams::svc::InfoType_FreeThreadCount:
|
||||
{
|
||||
/* These info types don't support non-zero subtypes. */
|
||||
R_UNLESS(info_subtype == 0, svc::ResultInvalidCombination());
|
||||
@ -125,6 +126,15 @@ namespace ams::kern::svc {
|
||||
case ams::svc::InfoType_IsApplication:
|
||||
*out = process->IsApplication();
|
||||
break;
|
||||
case ams::svc::InfoType_FreeThreadCount:
|
||||
if (KResourceLimit *resource_limit = process->GetResourceLimit(); resource_limit != nullptr) {
|
||||
const auto current_value = resource_limit->GetCurrentValue(ams::svc::LimitableResource_ThreadCountMax);
|
||||
const auto limit_value = resource_limit->GetLimitValue(ams::svc::LimitableResource_ThreadCountMax);
|
||||
*out = limit_value - current_value;
|
||||
} else {
|
||||
*out = 0;
|
||||
}
|
||||
break;
|
||||
MESOSPHERE_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
@ -156,6 +156,7 @@ namespace ams::svc {
|
||||
InfoType_TotalNonSystemMemorySize = 21,
|
||||
InfoType_UsedNonSystemMemorySize = 22,
|
||||
InfoType_IsApplication = 23,
|
||||
InfoType_FreeThreadCount = 24,
|
||||
|
||||
InfoType_MesosphereMeta = 65000,
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user