More for the POSIX+ subsystem

svn path=/trunk/; revision=647
This commit is contained in:
Emanuele Aliberti 1999-09-07 17:12:39 +00:00
parent 8c0b595a5e
commit af1ff6be3b
5 changed files with 149 additions and 39 deletions

View file

@ -1,30 +1,61 @@
/* $Id: api.c,v 1.1 1999/07/17 23:10:30 ea Exp $ /* $Id: api.c,v 1.2 1999/09/07 17:12:39 ea Exp $
* *
* reactos/subsys/psxss/api.c * reactos/subsys/psxss/api.c
* *
* ReactOS Operating System * ReactOS Operating System
* *
* --------------------------------------------------------------------
* *
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*
* --------------------------------------------------------------------
*/ */
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/lpc.h> #include <psxss/api.h>
#include "api.h" #include "api/api.h"
BOOL TerminationRequestPending = FALSE; BOOL TerminationRequestPending = FALSE;
long LPC_RETURN_CODE
port_dispatcher_api( PortRequestDispatcher_PsxApi (
PLPC_REQUEST_REPLY pLpcRequestReply PLPC_REQUEST_REPLY pLpcRequestReply
) )
{ {
switch (pLpcRequestReply->Function) switch (pLpcRequestReply->Function)
{ {
case LPC_PSX_API_PROCESS_CREATE: /* PROCESS Management */
case PSX_SS_API_PROCESS_CREATE:
return POSIX_PROCESS_Create(pLpcRequestReply); return POSIX_PROCESS_Create(pLpcRequestReply);
case LPC_PSX_API_PROCESS_TERMINATE:
case PSX_SS_API_PROCESS_TERMINATE:
return POSIX_PROCESS_Terminate(pLpcRequestReply); return POSIX_PROCESS_Terminate(pLpcRequestReply);
/* THREAD Management */
case PSX_SS_API_THREAD_CREATE:
return POSIX_THREAD_Create(pLpcRequestReply);
case PSX_SS_API_THREAD_TERMINATE:
return POSIX_THREAD_Terminate(pLpcRequestReply);
/* Subsystem Control */
case PSX_SS_API_SUBSYSTEM_SHUTDOWN:
return POSIX_SS_Shutdown(pLpcRequestReply);
} }
return LPC_ERROR_INVALID_FUNCTION; return LPC_ERROR_INVALID_FUNCTION;
} }
/* EOF */ /* EOF */

View file

@ -1,12 +1,30 @@
/* $Id: init.c,v 1.1 1999/07/17 23:10:31 ea Exp $ /* $Id: init.c,v 1.2 1999/09/07 17:12:39 ea Exp $
* *
* init.c * init.c
* *
* ReactOS Operating System * ReactOS Operating System
* *
* --------------------------------------------------------------------
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*
* --------------------------------------------------------------------
*/ */
#define PROTO_LPC
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/lpc.h>
struct _SERVER_DIRECTORIES struct _SERVER_DIRECTORIES
{ {
@ -110,7 +128,7 @@ Thread_SbApi(void * pPort)
* when the Interix(tm) subsystem is installed. * when the Interix(tm) subsystem is installed.
*/ */
BOOL BOOL
InitializeServer(void) InitializeServer (void)
{ {
NTSTATUS Status; NTSTATUS Status;
OBJECT_ATTRIBUTES ObAttributes; OBJECT_ATTRIBUTES ObAttributes;
@ -125,40 +143,74 @@ InitializeServer(void)
PSXSS_DIRECTORY_NAME_ROOT PSXSS_DIRECTORY_NAME_ROOT
& Server.Directory.Root & Server.Directory.Root
); );
if (!NT_SUCCESS(Status))
{
return FALSE;
}
/* /*
* STEP 2 * STEP 2
* Create the LPC port "\PSXSS\ApiPort" * Create the LPC port "\PSXSS\ApiPort"
* *
*/ */
Server.Api.Port = ObAttributes.Name = PSXSS_PORT_NAME_APIPORT;
NtCreatePort( Status = NtCreatePort(
PSXSS_PORT_NAME_APIPORT, & Server.Api.Port,
... & ObAttributes,
0,
0,
0,
0
); );
NtCreateThread( if (!NT_SUCCESS(Status))
& Server.Api.Thread, {
0, /* desired access */ return FALSE;
& ObAttributes, /* object attributes */ }
NtCurrentProcess(), /* process' handle */ Status = NtCreateThread(
0, /* client id */ & Server.Api.Thread,
Thread_ApiPort, 0, /* desired access */
(void*) & Server.Api.Port & ObAttributes, /* object attributes */
); NtCurrentProcess(), /* process' handle */
0, /* client id */
Thread_ApiPort,
(void*) & Server.Api.Port
);
if (!NT_SUCCESS(Status))
{
NtClose(Server.Api.Port);
return FALSE;
}
/* /*
* STEP 3 * STEP 3
* Create the LPC port "\PSXSS\SbApiPort" * Create the LPC port "\PSXSS\SbApiPort"
* *
*/ */
Server.SbApi.Port = ObAttributes.Name = PSXSS_PORT_NAME_SBAPIPORT;
NtCreatePort( Status = NtCreatePort(
PSXSS_PORT_NAME_SBAPIPORT, & Server.SbApi.Port,
... & ObAttributes,
0,
0,
0,
0
); );
if (!NT_SUCCESS(Status))
{
NtClose(Server.Api.Port);
NtTerminateThread(/*FIXME*/);
return FALSE;
}
Status = NtCreateThread( Status = NtCreateThread(
& Server.SbApi.Thread, & Server.SbApi.Thread,
Thread_SbApi, Thread_SbApi,
(void*) & Server.SbApi.Port (void*) & Server.SbApi.Port
); );
if (!NT_SUCCESS(Status))
{
NtClose(Server.Api.Port);
NtTerminateThread(/*FIXME*/);
NtClose(Server.SbApi.Port);
return FALSE;
}
/* /*
* STEP 4 * STEP 4
* Create the POSIX+ session directory object * Create the POSIX+ session directory object
@ -169,6 +221,13 @@ InitializeServer(void)
PSXSS_DIRECTORY_NAME_SESSIONS PSXSS_DIRECTORY_NAME_SESSIONS
& Server.Directory.Sessions & Server.Directory.Sessions
); );
if (!NT_SUCCESS(Status))
{
NtClose(Server.Api.Port);
NtTerminateThread(Server.Api.Thread);
NtClose(Server.SbApi.Port);
NtTerminateThread(Server.SbApi.Thread);
return FALSE;
/* /*
* STEP 5 * STEP 5
* Create the POSIX+ system directory object * Create the POSIX+ system directory object

View file

@ -1,14 +1,16 @@
# $Id: makefile,v 1.2 1999/08/29 13:45:07 dwelch Exp $ # $Id: makefile,v 1.3 1999/09/07 17:12:39 ea Exp $
# #
# CSRSS: Client/server run-time subsystem # PSXSS: POSIX+ Subsystem server process
# #
# ReactOS Operating System # ReactOS Operating System
# #
TARGET=csrss TARGET=psxss
BASE_CFLAGS = -I../../include OBJECTS_API = api/process.o api/thread.o api/subsys.o
OBJECTS = $(TARGET).o init.o $(TARGET).coff OBJECTS_MISC = $(TARGET).o init.o $(TARGET).coff
OBJECTS = $(OBJECTS_MISC) $(OBJECTS_API)
LIBS = ../../lib/ntdll/ntdll.a LIBS = ../../lib/ntdll/ntdll.a
@ -17,10 +19,11 @@ all: $(TARGET).exe
.phony: all .phony: all
clean: clean:
- $(RM) $(TARGET).o - $(RM) *.o
- $(RM) $(TARGET).exe - $(RM) $(TARGET).exe
- $(RM) $(TARGET).sym - $(RM) $(TARGET).sym
- $(RM) $(TARGET).coff - $(RM) $(TARGET).coff
- $(RM) api/*.o
.phony: clean .phony: clean

View file

@ -1,4 +1,4 @@
/* $Id: psxss.c,v 1.1 1999/07/17 23:10:31 ea Exp $ /* $Id: psxss.c,v 1.2 1999/09/07 17:12:39 ea Exp $
* *
* reactos/subsys/psxss/psxss.c * reactos/subsys/psxss/psxss.c
* *
@ -16,10 +16,10 @@
* This software is distributed in the hope that it will be useful, * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING.LIB. If not, write * along with this software; see the file COPYING. If not, write
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, * to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA. * MA 02139, USA.
* *

View file

@ -1,18 +1,35 @@
/* $Id: sbapi.c,v 1.1 1999/07/17 23:10:31 ea Exp $ /* $Id: sbapi.c,v 1.2 1999/09/07 17:12:39 ea Exp $
* *
* sbapi.c - Displatcher for the \SbApiPort * sbapi.c - Displatcher for the \SbApiPort
* *
* ReactOS Operating System * ReactOS Operating System
* *
* --------------------------------------------------------------------
* *
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*
* --------------------------------------------------------------------
*/ */
#define PROTO_LPC
#include <ddk/ntddk.h> #include <ddk/ntddk.h>
#include <internal/lpc.h>
/* The \SbApi dispatcher: what is this port for? */ /* The \SbApi dispatcher: what is this port for? */
LPC_RETURN_CODE LPC_RETURN_CODE
port_dispatcher_sbapi( PortRequestDispatcher_PsxSbApi (
PLPC_REQUEST_REPLY pLpcRequestReply PLPC_REQUEST_REPLY pLpcRequestReply
) )
{ {