mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Setup quota blocks for processes.
svn path=/trunk/; revision=16942
This commit is contained in:
parent
50398b7a03
commit
f28b5f7302
4 changed files with 59 additions and 14 deletions
|
@ -509,6 +509,8 @@ PspExitProcess(PEPROCESS Process)
|
||||||
|
|
||||||
PspRunCreateProcessNotifyRoutines(Process, FALSE);
|
PspRunCreateProcessNotifyRoutines(Process, FALSE);
|
||||||
|
|
||||||
|
PspDestroyQuotaBlock(Process);
|
||||||
|
|
||||||
/* close all handles associated with our process, this needs to be done
|
/* close all handles associated with our process, this needs to be done
|
||||||
when the last thread still runs */
|
when the last thread still runs */
|
||||||
ObKillProcess(Process);
|
ObKillProcess(Process);
|
||||||
|
|
|
@ -20,6 +20,8 @@ PEPROCESS EXPORTED PsInitialSystemProcess = NULL;
|
||||||
PEPROCESS PsIdleProcess = NULL;
|
PEPROCESS PsIdleProcess = NULL;
|
||||||
POBJECT_TYPE EXPORTED PsProcessType = NULL;
|
POBJECT_TYPE EXPORTED PsProcessType = NULL;
|
||||||
|
|
||||||
|
EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock;
|
||||||
|
|
||||||
LIST_ENTRY PsActiveProcessHead;
|
LIST_ENTRY PsActiveProcessHead;
|
||||||
FAST_MUTEX PspActiveProcessMutex;
|
FAST_MUTEX PspActiveProcessMutex;
|
||||||
LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
|
LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
|
||||||
|
@ -295,8 +297,8 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
Process->Session = pParentProcess->Session;
|
Process->Session = pParentProcess->Session;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Set up the Quota Block from the Parent
|
/* Set up the Quota Block from the Parent */
|
||||||
PspInheritQuota(Parent, Process); */
|
PspInheritQuota(Process, pParentProcess);
|
||||||
|
|
||||||
/* FIXME: Set up Dos Device Map from the Parent
|
/* FIXME: Set up Dos Device Map from the Parent
|
||||||
ObInheritDeviceMap(Parent, Process) */
|
ObInheritDeviceMap(Parent, Process) */
|
||||||
|
|
|
@ -126,7 +126,7 @@ PsInitProcessManagment(VOID)
|
||||||
|
|
||||||
DPRINT("Creating Process Object Type\n");
|
DPRINT("Creating Process Object Type\n");
|
||||||
|
|
||||||
/* Initialize the Thread type */
|
/* Initialize the Process type */
|
||||||
RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
|
RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
|
||||||
RtlInitUnicodeString(&Name, L"Process");
|
RtlInitUnicodeString(&Name, L"Process");
|
||||||
ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
|
ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
|
||||||
|
@ -141,6 +141,15 @@ PsInitProcessManagment(VOID)
|
||||||
InitializeListHead(&PsActiveProcessHead);
|
InitializeListHead(&PsActiveProcessHead);
|
||||||
ExInitializeFastMutex(&PspActiveProcessMutex);
|
ExInitializeFastMutex(&PspActiveProcessMutex);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the default quota block.
|
||||||
|
*/
|
||||||
|
|
||||||
|
RtlZeroMemory(&PspDefaultQuotaBlock, sizeof(PspDefaultQuotaBlock));
|
||||||
|
PspDefaultQuotaBlock.QuotaEntry[PagedPool].Limit = (SIZE_T)-1;
|
||||||
|
PspDefaultQuotaBlock.QuotaEntry[NonPagedPool].Limit = (SIZE_T)-1;
|
||||||
|
PspDefaultQuotaBlock.QuotaEntry[2].Limit = (SIZE_T)-1; /* Page file */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the idle process
|
* Initialize the idle process
|
||||||
*/
|
*/
|
||||||
|
@ -175,6 +184,7 @@ PsInitProcessManagment(VOID)
|
||||||
FALSE);
|
FALSE);
|
||||||
PsIdleProcess->Pcb.DirectoryTableBase.QuadPart = (ULONG_PTR)MmGetPageDirectory();
|
PsIdleProcess->Pcb.DirectoryTableBase.QuadPart = (ULONG_PTR)MmGetPageDirectory();
|
||||||
strcpy(PsIdleProcess->ImageFileName, "Idle");
|
strcpy(PsIdleProcess->ImageFileName, "Idle");
|
||||||
|
PspInheritQuota(PsIdleProcess, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the system process
|
* Initialize the system process
|
||||||
|
@ -207,6 +217,7 @@ PsInitProcessManagment(VOID)
|
||||||
sizeof(EPROCESS),
|
sizeof(EPROCESS),
|
||||||
FALSE);
|
FALSE);
|
||||||
KProcess = &PsInitialSystemProcess->Pcb;
|
KProcess = &PsInitialSystemProcess->Pcb;
|
||||||
|
PspInheritQuota(PsInitialSystemProcess, NULL);
|
||||||
|
|
||||||
MmInitializeAddressSpace(PsInitialSystemProcess,
|
MmInitializeAddressSpace(PsInitialSystemProcess,
|
||||||
&PsInitialSystemProcess->AddressSpace);
|
&PsInitialSystemProcess->AddressSpace);
|
||||||
|
|
|
@ -15,6 +15,36 @@
|
||||||
|
|
||||||
/* FUNCTIONS ***************************************************************/
|
/* FUNCTIONS ***************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
STDCALL
|
||||||
|
PspInheritQuota(PEPROCESS Process, PEPROCESS ParentProcess)
|
||||||
|
{
|
||||||
|
PEPROCESS_QUOTA_BLOCK QuotaBlock;
|
||||||
|
|
||||||
|
if (ParentProcess != NULL)
|
||||||
|
QuotaBlock = ParentProcess->QuotaBlock;
|
||||||
|
else
|
||||||
|
QuotaBlock = &PspDefaultQuotaBlock;
|
||||||
|
|
||||||
|
ASSERT(QuotaBlock != NULL);
|
||||||
|
|
||||||
|
InterlockedIncrement(&QuotaBlock->ReferenceCount);
|
||||||
|
Process->QuotaBlock = QuotaBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
STDCALL
|
||||||
|
PspDestroyQuotaBlock(PEPROCESS Process)
|
||||||
|
{
|
||||||
|
PEPROCESS_QUOTA_BLOCK QuotaBlock = Process->QuotaBlock;
|
||||||
|
|
||||||
|
if (InterlockedDecrement(&QuotaBlock->ReferenceCount) == 0)
|
||||||
|
{
|
||||||
|
if (QuotaBlock != &PspDefaultQuotaBlock)
|
||||||
|
ExFreePool(QuotaBlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue