mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 17:52:56 +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
1 changed files with 12 additions and 55 deletions
|
@ -16,16 +16,8 @@
|
||||||
|
|
||||||
EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock;
|
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 *******************************************************/
|
/* PRIVATE FUNCTIONS *******************************************************/
|
||||||
|
|
||||||
#ifdef PS_QUOTA_ENABLE_QUOTA_CODE
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Private helper to charge the specified process quota.
|
* Private helper to charge the specified process quota.
|
||||||
* ReturnsSTATUS_QUOTA_EXCEEDED on quota limit check failure.
|
* ReturnsSTATUS_QUOTA_EXCEEDED on quota limit check failure.
|
||||||
|
@ -49,7 +41,9 @@ PspChargeProcessQuotaSpecifiedPool(IN PEPROCESS Process,
|
||||||
if (Process->QuotaUsage[PoolIndex] + Amount >
|
if (Process->QuotaUsage[PoolIndex] + Amount >
|
||||||
Process->QuotaBlock->QuotaEntry[PoolIndex].Limit)
|
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);
|
InterlockedExchangeAdd((LONG*)&Process->QuotaUsage[PoolIndex], Amount);
|
||||||
|
@ -63,7 +57,6 @@ PspChargeProcessQuotaSpecifiedPool(IN PEPROCESS Process,
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Private helper to remove quota charge from the specified process quota.
|
* Private helper to remove quota charge from the specified process quota.
|
||||||
* TODO: Research and possibly add (the undocumented) enum type PS_QUOTA_TYPE
|
* 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 ***************************************************************/
|
/* FUNCTIONS ***************************************************************/
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -139,6 +129,9 @@ PspDestroyQuotaBlock(PEPROCESS Process)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
PsChargeProcessPageFileQuota(IN PEPROCESS Process,
|
PsChargeProcessPageFileQuota(IN PEPROCESS Process,
|
||||||
|
@ -147,13 +140,7 @@ PsChargeProcessPageFileQuota(IN PEPROCESS Process,
|
||||||
/* Don't do anything for the system process */
|
/* Don't do anything for the system process */
|
||||||
if (Process == PsInitialSystemProcess) return STATUS_SUCCESS;
|
if (Process == PsInitialSystemProcess) return STATUS_SUCCESS;
|
||||||
|
|
||||||
#ifdef PS_QUOTA_ENABLE_QUOTA_CODE
|
|
||||||
return PspChargeProcessQuotaSpecifiedPool(Process, 2, Amount);
|
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)
|
IN SIZE_T Amount)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
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);
|
ASSERT(KeGetCurrentIrql() < DISPATCH_LEVEL);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Don't do anything for the system process */
|
/* Don't do anything for the system process */
|
||||||
if (Process == PsInitialSystemProcess) return;
|
if (Process == PsInitialSystemProcess) return;
|
||||||
|
@ -217,18 +199,13 @@ PsChargeProcessPoolQuota(IN PEPROCESS Process,
|
||||||
/* Don't do anything for the system process */
|
/* Don't do anything for the system process */
|
||||||
if (Process == PsInitialSystemProcess) return STATUS_SUCCESS;
|
if (Process == PsInitialSystemProcess) return STATUS_SUCCESS;
|
||||||
|
|
||||||
#ifdef PS_QUOTA_ENABLE_QUOTA_CODE
|
|
||||||
return PspChargeProcessQuotaSpecifiedPool(Process,
|
return PspChargeProcessQuotaSpecifiedPool(Process,
|
||||||
(PoolType & PAGED_POOL_MASK),
|
(PoolType & PAGED_POOL_MASK),
|
||||||
Amount);
|
Amount);
|
||||||
#else
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
return STATUS_SUCCESS;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -236,26 +213,16 @@ PsReturnPoolQuota(IN PEPROCESS Process,
|
||||||
IN POOL_TYPE PoolType,
|
IN POOL_TYPE PoolType,
|
||||||
IN SIZE_T Amount)
|
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 */
|
/* Don't do anything for the system process */
|
||||||
if (Process == PsInitialSystemProcess) return;
|
if (Process == PsInitialSystemProcess) return;
|
||||||
|
|
||||||
#ifdef PS_QUOTA_ENABLE_QUOTA_CODE
|
|
||||||
PspReturnProcessQuotaSpecifiedPool(Process,
|
PspReturnProcessQuotaSpecifiedPool(Process,
|
||||||
(PoolType & PAGED_POOL_MASK),
|
(PoolType & PAGED_POOL_MASK),
|
||||||
Amount);
|
Amount);
|
||||||
#else
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -265,15 +232,11 @@ PsReturnProcessNonPagedPoolQuota(IN PEPROCESS Process,
|
||||||
/* Don't do anything for the system process */
|
/* Don't do anything for the system process */
|
||||||
if (Process == PsInitialSystemProcess) return;
|
if (Process == PsInitialSystemProcess) return;
|
||||||
|
|
||||||
#ifdef PS_QUOTA_ENABLE_QUOTA_CODE
|
|
||||||
PsReturnPoolQuota(Process, NonPagedPool, Amount);
|
PsReturnPoolQuota(Process, NonPagedPool, Amount);
|
||||||
#else
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -283,13 +246,12 @@ PsReturnProcessPagedPoolQuota(IN PEPROCESS Process,
|
||||||
/* Don't do anything for the system process */
|
/* Don't do anything for the system process */
|
||||||
if (Process == PsInitialSystemProcess) return;
|
if (Process == PsInitialSystemProcess) return;
|
||||||
|
|
||||||
#ifdef PS_QUOTA_ENABLE_QUOTA_CODE
|
|
||||||
PsReturnPoolQuota(Process, PagedPool, Amount);
|
PsReturnPoolQuota(Process, PagedPool, Amount);
|
||||||
#else
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
PsReturnProcessPageFileQuota(IN PEPROCESS Process,
|
PsReturnProcessPageFileQuota(IN PEPROCESS Process,
|
||||||
|
@ -298,12 +260,7 @@ PsReturnProcessPageFileQuota(IN PEPROCESS Process,
|
||||||
/* Don't do anything for the system process */
|
/* Don't do anything for the system process */
|
||||||
if (Process == PsInitialSystemProcess) return STATUS_SUCCESS;
|
if (Process == PsInitialSystemProcess) return STATUS_SUCCESS;
|
||||||
|
|
||||||
#ifdef PS_QUOTA_ENABLE_QUOTA_CODE
|
|
||||||
PspReturnProcessQuotaSpecifiedPool(Process, 2, Amount);
|
PspReturnProcessQuotaSpecifiedPool(Process, 2, Amount);
|
||||||
#else
|
|
||||||
/* Otherwise, not implemented */
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
#endif
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue