mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 18:01:07 +00:00
[NTOSKRNL]: Activate the pseudo-quota system. It doesnt' do much but at least it can silence the debug spam. I think mike wrote it..
svn path=/trunk/; revision=60071
This commit is contained in:
parent
f2ca6ff5d0
commit
384e5d6f11
|
@ -16,16 +16,8 @@
|
|||
|
||||
EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock;
|
||||
|
||||
|
||||
/* Define this macro to enable quota code testing. Once quota code is */
|
||||
/* stable and verified, remove this macro and checks for it. */
|
||||
/*#define PS_QUOTA_ENABLE_QUOTA_CODE*/
|
||||
|
||||
|
||||
/* PRIVATE FUNCTIONS *******************************************************/
|
||||
|
||||
#ifdef PS_QUOTA_ENABLE_QUOTA_CODE
|
||||
|
||||
/*
|
||||
* Private helper to charge the specified process quota.
|
||||
* ReturnsSTATUS_QUOTA_EXCEEDED on quota limit check failure.
|
||||
|
@ -49,7 +41,9 @@ PspChargeProcessQuotaSpecifiedPool(IN PEPROCESS Process,
|
|||
if (Process->QuotaUsage[PoolIndex] + Amount >
|
||||
Process->QuotaBlock->QuotaEntry[PoolIndex].Limit)
|
||||
{
|
||||
return STATUS_QUOTA_EXCEEDED; /* caller raises the exception */
|
||||
DPRINT1("Quota exceeded, but ROS will let it slide...\n");
|
||||
return STATUS_SUCCESS;
|
||||
//return STATUS_QUOTA_EXCEEDED; /* caller raises the exception */
|
||||
}
|
||||
|
||||
InterlockedExchangeAdd((LONG*)&Process->QuotaUsage[PoolIndex], Amount);
|
||||
|
@ -63,7 +57,6 @@ PspChargeProcessQuotaSpecifiedPool(IN PEPROCESS Process,
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Private helper to remove quota charge from the specified process quota.
|
||||
* TODO: Research and possibly add (the undocumented) enum type PS_QUOTA_TYPE
|
||||
|
@ -91,9 +84,6 @@ PspReturnProcessQuotaSpecifiedPool(IN PEPROCESS Process,
|
|||
}
|
||||
}
|
||||
|
||||
#endif /* PS_QUOTA_ENABLE_QUOTA_CODE */
|
||||
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
VOID
|
||||
|
@ -139,6 +129,9 @@ PspDestroyQuotaBlock(PEPROCESS Process)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PsChargeProcessPageFileQuota(IN PEPROCESS Process,
|
||||
|
@ -147,13 +140,7 @@ PsChargeProcessPageFileQuota(IN PEPROCESS Process,
|
|||
/* Don't do anything for the system process */
|
||||
if (Process == PsInitialSystemProcess) return STATUS_SUCCESS;
|
||||
|
||||
#ifdef PS_QUOTA_ENABLE_QUOTA_CODE
|
||||
return PspChargeProcessQuotaSpecifiedPool(Process, 2, Amount);
|
||||
#else
|
||||
/* Otherwise, not implemented */
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -166,12 +153,7 @@ PsChargePoolQuota(IN PEPROCESS Process,
|
|||
IN SIZE_T Amount)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
#ifdef PS_QUOTA_ENABLE_QUOTA_CODE
|
||||
/* MS-documented IRQL requirement. Not yet enabled as it */
|
||||
/* needs verification that it does not break ReactOS, */
|
||||
ASSERT(KeGetCurrentIrql() < DISPATCH_LEVEL);
|
||||
#endif
|
||||
|
||||
/* Don't do anything for the system process */
|
||||
if (Process == PsInitialSystemProcess) return;
|
||||
|
@ -217,18 +199,13 @@ PsChargeProcessPoolQuota(IN PEPROCESS Process,
|
|||
/* Don't do anything for the system process */
|
||||
if (Process == PsInitialSystemProcess) return STATUS_SUCCESS;
|
||||
|
||||
#ifdef PS_QUOTA_ENABLE_QUOTA_CODE
|
||||
return PspChargeProcessQuotaSpecifiedPool(Process,
|
||||
(PoolType & PAGED_POOL_MASK),
|
||||
Amount);
|
||||
#else
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
VOID
|
||||
NTAPI
|
||||
|
@ -236,26 +213,16 @@ PsReturnPoolQuota(IN PEPROCESS Process,
|
|||
IN POOL_TYPE PoolType,
|
||||
IN SIZE_T Amount)
|
||||
{
|
||||
#ifdef PS_QUOTA_ENABLE_QUOTA_CODE
|
||||
/* MS-documented IRQL requirement. Not yet enabled as it */
|
||||
/* needs verification that it does not break ReactOS, */
|
||||
ASSERT(KeGetCurrentIrql() < DISPATCH_LEVEL);
|
||||
#endif
|
||||
|
||||
/* Don't do anything for the system process */
|
||||
if (Process == PsInitialSystemProcess) return;
|
||||
|
||||
#ifdef PS_QUOTA_ENABLE_QUOTA_CODE
|
||||
PspReturnProcessQuotaSpecifiedPool(Process,
|
||||
(PoolType & PAGED_POOL_MASK),
|
||||
Amount);
|
||||
#else
|
||||
UNIMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
VOID
|
||||
NTAPI
|
||||
|
@ -265,15 +232,11 @@ PsReturnProcessNonPagedPoolQuota(IN PEPROCESS Process,
|
|||
/* Don't do anything for the system process */
|
||||
if (Process == PsInitialSystemProcess) return;
|
||||
|
||||
#ifdef PS_QUOTA_ENABLE_QUOTA_CODE
|
||||
PsReturnPoolQuota(Process, NonPagedPool, Amount);
|
||||
#else
|
||||
UNIMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
VOID
|
||||
NTAPI
|
||||
|
@ -283,13 +246,12 @@ PsReturnProcessPagedPoolQuota(IN PEPROCESS Process,
|
|||
/* Don't do anything for the system process */
|
||||
if (Process == PsInitialSystemProcess) return;
|
||||
|
||||
#ifdef PS_QUOTA_ENABLE_QUOTA_CODE
|
||||
PsReturnPoolQuota(Process, PagedPool, Amount);
|
||||
#else
|
||||
UNIMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PsReturnProcessPageFileQuota(IN PEPROCESS Process,
|
||||
|
@ -298,12 +260,7 @@ PsReturnProcessPageFileQuota(IN PEPROCESS Process,
|
|||
/* Don't do anything for the system process */
|
||||
if (Process == PsInitialSystemProcess) return STATUS_SUCCESS;
|
||||
|
||||
#ifdef PS_QUOTA_ENABLE_QUOTA_CODE
|
||||
PspReturnProcessQuotaSpecifiedPool(Process, 2, Amount);
|
||||
#else
|
||||
/* Otherwise, not implemented */
|
||||
UNIMPLEMENTED;
|
||||
#endif
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue