initialize the job management and export PsJobType

svn path=/trunk/; revision=10987
This commit is contained in:
Thomas Bluemel 2004-09-22 22:31:46 +00:00
parent ba27e813a3
commit 40637ed24b
4 changed files with 62 additions and 4 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 * FILE: ntoskrnl/ke/kthread.c
* PURPOSE: Process manager definitions * PURPOSE: Process manager definitions
@ -641,6 +641,8 @@ typedef struct _EJOB
} EJOB; } EJOB;
#include <poppack.h> #include <poppack.h>
VOID INIT_FUNCTION PsInitJobManagment(VOID);
#endif /* ASSEMBLER */ #endif /* ASSEMBLER */
#endif /* __INCLUDE_INTERNAL_PS_H */ #endif /* __INCLUDE_INTERNAL_PS_H */

View file

@ -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 ; reactos/ntoskrnl/ntoskrnl.def
; ;
@ -920,7 +920,7 @@ PsIsProcessBeingDebugged@4
PsIsSystemThread@4 PsIsSystemThread@4
PsIsThreadImpersonating@4 PsIsThreadImpersonating@4
PsIsThreadTerminating@4 PsIsThreadTerminating@4
;PsJobType DATA PsJobType DATA
PsLookupProcessByProcessId@8 PsLookupProcessByProcessId@8
PsLookupProcessThreadByCid@12 PsLookupProcessThreadByCid@12
PsLookupThreadByThreadId@8 PsLookupThreadByThreadId@8

View file

@ -14,8 +14,63 @@
#include <ntoskrnl.h> #include <ntoskrnl.h>
#include <internal/debug.h> #include <internal/debug.h>
/* 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 *****************************************************************/ /* 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 * @unimplemented
*/ */

View file

@ -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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -25,6 +25,7 @@ VOID PiShutdownProcessManager(VOID)
VOID INIT_FUNCTION VOID INIT_FUNCTION
PiInitProcessManager(VOID) PiInitProcessManager(VOID)
{ {
PsInitJobManagment();
PsInitProcessManagment(); PsInitProcessManagment();
PsInitThreadManagment(); PsInitThreadManagment();
PsInitIdleThread(); PsInitIdleThread();