mirror of
https://github.com/reactos/reactos.git
synced 2024-09-27 21:16:34 +00:00
[NTOS:OB] Charge/Return pool quotas of objects
As it currently stands the Object Manager doesn't charge any quotas when objects are created, nor it returns quotas when objects are de-allocated and freed from the objects namespace database. This alone can bring inconsistencies in the kernel as we simply don't know what is the amount charged in an object and thus we aren't keeping track of quotas flow. Now with both PsReturnSharedPoolQuota and PsChargeSharedPoolQuota implemented, the Object Manager can now track the said flow of quotas every time an object is created or de-allocated, thus enforcing consistency with the use of quota resources.
This commit is contained in:
parent
ee697cfeef
commit
0c07eac5b4
|
@ -457,14 +457,19 @@ ObpChargeQuotaForObject(IN POBJECT_HEADER ObjectHeader,
|
|||
NonPagedPoolCharge = ObjectType->TypeInfo.DefaultNonPagedPoolCharge;
|
||||
}
|
||||
|
||||
/* Charge the quota */
|
||||
ObjectHeader->QuotaBlockCharged = (PVOID)1;
|
||||
DPRINT("FIXME: Should charge: %lx %lx\n", PagedPoolCharge, NonPagedPoolCharge);
|
||||
#if 0
|
||||
PsChargeSharedPoolQuota(PsGetCurrentProcess(),
|
||||
PagedPoolCharge,
|
||||
NonPagedPoolCharge);
|
||||
#endif
|
||||
/* Is this the system process? */
|
||||
if (PsGetCurrentProcess() == PsInitialSystemProcess)
|
||||
{
|
||||
/* It is, don't do anything */
|
||||
ObjectHeader->QuotaBlockCharged = OBP_SYSTEM_PROCESS_QUOTA;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Charge the quota */
|
||||
ObjectHeader->QuotaBlockCharged = PsChargeSharedPoolQuota(PsGetCurrentProcess(),
|
||||
PagedPoolCharge,
|
||||
NonPagedPoolCharge);
|
||||
}
|
||||
|
||||
/* Check if we don't have a quota block */
|
||||
if (!ObjectHeader->QuotaBlockCharged) return STATUS_QUOTA_EXCEEDED;
|
||||
|
|
|
@ -110,13 +110,12 @@ ObpDeallocateObject(IN PVOID Object)
|
|||
}
|
||||
|
||||
/* Return the quota */
|
||||
DPRINT("FIXME: Should return quotas: %lx %lx\n", PagedPoolCharge, NonPagedPoolCharge);
|
||||
#if 0
|
||||
PsReturnSharedPoolQuota(ObjectHeader->QuotaBlockCharged,
|
||||
PagedPoolCharge,
|
||||
NonPagedPoolCharge);
|
||||
#endif
|
||||
|
||||
if (Header->QuotaBlockCharged != OBP_SYSTEM_PROCESS_QUOTA)
|
||||
{
|
||||
PsReturnSharedPoolQuota(Header->QuotaBlockCharged,
|
||||
PagedPoolCharge,
|
||||
NonPagedPoolCharge);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue