From 40637ed24bf3b1562851c6e52c29bafa8218384b Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Wed, 22 Sep 2004 22:31:46 +0000 Subject: [PATCH] initialize the job management and export PsJobType svn path=/trunk/; revision=10987 --- reactos/ntoskrnl/include/internal/ps.h | 4 +- reactos/ntoskrnl/ntoskrnl.def | 4 +- reactos/ntoskrnl/ps/job.c | 55 ++++++++++++++++++++++++++ reactos/ntoskrnl/ps/psmgr.c | 3 +- 4 files changed, 62 insertions(+), 4 deletions(-) diff --git a/reactos/ntoskrnl/include/internal/ps.h b/reactos/ntoskrnl/include/internal/ps.h index c71543a2214..c3f9014ba1e 100644 --- a/reactos/ntoskrnl/include/internal/ps.h +++ b/reactos/ntoskrnl/include/internal/ps.h @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: ps.h,v 1.67 2004/09/22 14:53:26 weiden Exp $ +/* $Id: ps.h,v 1.68 2004/09/22 22:31:46 weiden Exp $ * * FILE: ntoskrnl/ke/kthread.c * PURPOSE: Process manager definitions @@ -641,6 +641,8 @@ typedef struct _EJOB } EJOB; #include +VOID INIT_FUNCTION PsInitJobManagment(VOID); + #endif /* ASSEMBLER */ #endif /* __INCLUDE_INTERNAL_PS_H */ diff --git a/reactos/ntoskrnl/ntoskrnl.def b/reactos/ntoskrnl/ntoskrnl.def index 30eedcc65d4..97d1762b749 100644 --- a/reactos/ntoskrnl/ntoskrnl.def +++ b/reactos/ntoskrnl/ntoskrnl.def @@ -1,4 +1,4 @@ -; $Id: ntoskrnl.def,v 1.191 2004/09/16 11:46:17 ekohl Exp $ +; $Id: ntoskrnl.def,v 1.192 2004/09/22 22:31:46 weiden Exp $ ; ; reactos/ntoskrnl/ntoskrnl.def ; @@ -920,7 +920,7 @@ PsIsProcessBeingDebugged@4 PsIsSystemThread@4 PsIsThreadImpersonating@4 PsIsThreadTerminating@4 -;PsJobType DATA +PsJobType DATA PsLookupProcessByProcessId@8 PsLookupProcessThreadByCid@12 PsLookupThreadByThreadId@8 diff --git a/reactos/ntoskrnl/ps/job.c b/reactos/ntoskrnl/ps/job.c index fcecb6baecb..1933fd5d109 100644 --- a/reactos/ntoskrnl/ps/job.c +++ b/reactos/ntoskrnl/ps/job.c @@ -14,8 +14,63 @@ #include #include +/* GLOBALS *******************************************************************/ + +POBJECT_TYPE EXPORTED PsJobType = NULL; + +LIST_ENTRY PsJobListHead; +static KSPIN_LOCK PsJobListLock; + +static GENERIC_MAPPING PiJobMapping = {PROCESS_READ, + PROCESS_WRITE, + PROCESS_EXECUTE, + PROCESS_ALL_ACCESS}; + /* FUNCTIONS *****************************************************************/ +VOID STDCALL +PiDeleteJob(PVOID ObjectBody) +{ + KIRQL oldIrql; + PEJOB Job = (PEJOB)ObjectBody; + + KeAcquireSpinLock(&PsJobListLock, &oldIrql); + RemoveEntryList(&Job->JobLinks); + KeReleaseSpinLock(&PsJobListLock, oldIrql); +} + +VOID INIT_FUNCTION +PsInitJobManagment(VOID) +{ + PsJobType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE)); + + PsJobType->Tag = TAG('E', 'J', 'O', 'B'); + PsJobType->TotalObjects = 0; + PsJobType->TotalHandles = 0; + PsJobType->MaxObjects = ULONG_MAX; + PsJobType->MaxHandles = ULONG_MAX; + PsJobType->PagedPoolCharge = 0; + PsJobType->NonpagedPoolCharge = sizeof(EJOB); + PsJobType->Mapping = &PiJobMapping; + PsJobType->Dump = NULL; + PsJobType->Open = NULL; + PsJobType->Close = NULL; + PsJobType->Delete = PiDeleteJob; + PsJobType->Parse = NULL; + PsJobType->Security = NULL; + PsJobType->QueryName = NULL; + PsJobType->OkayToClose = NULL; + PsJobType->Create = NULL; + PsJobType->DuplicationNotify = NULL; + + RtlRosInitUnicodeStringFromLiteral(&PsJobType->TypeName, L"Job"); + + ObpCreateTypeObject(PsJobType); + + InitializeListHead(&PsJobListHead); + KeInitializeSpinLock(&PsJobListLock); +} + /* * @unimplemented */ diff --git a/reactos/ntoskrnl/ps/psmgr.c b/reactos/ntoskrnl/ps/psmgr.c index 2aefaa15d0a..76d411a5f95 100644 --- a/reactos/ntoskrnl/ps/psmgr.c +++ b/reactos/ntoskrnl/ps/psmgr.c @@ -1,4 +1,4 @@ -/* $Id: psmgr.c,v 1.21 2004/08/15 16:39:10 chorns Exp $ +/* $Id: psmgr.c,v 1.22 2004/09/22 22:31:46 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -25,6 +25,7 @@ VOID PiShutdownProcessManager(VOID) VOID INIT_FUNCTION PiInitProcessManager(VOID) { + PsInitJobManagment(); PsInitProcessManagment(); PsInitThreadManagment(); PsInitIdleThread();