Compare commits

..

2 Commits

Author SHA1 Message Date
Casper Hornstrup
66141934f6 Added modified page writer branch
svn path=/branches/mpw/; revision=2949
2002-05-13 20:37:01 +00:00
The ReactOS Team
ebcc66ae1b This commit was manufactured by cvs2svn to create branch 'mpw'.
svn path=/branches/mpw/; revision=2948
2002-05-13 20:16:26 +00:00
6513 changed files with 314060 additions and 1202212 deletions

32
os2/apps/bepslep/Makefile Normal file
View File

@@ -0,0 +1,32 @@
# $Id: Makefile,v 1.1 2002/03/23 19:23:27 robertk Exp $
#
# To run it in Win32 console mode, undefine __SUBSYSTEM_WINDOWS__
# and pass "console" in the ld's --subsystem option.
#
#
PATH_TO_TOP=../../../..
PATH_TO_OS2_TOP=../..
TARGET_NAME=bepslep
CFLAGS=-D__SUBSYSTEM_WINDOWS__
OBJECTS=$(TARGET_NAME).o
LIBRARIES=\
$(PATH_TO_OS2_TOP)/dll/doscalls.dll
$(TARGET_NAME): $(OBJECTS) $(LIBRARIES)
$(CC) \
$(CFLAGS) \
$(OBJECTS) \
$(LIBRARIES)\
-o $@ \
-Wl,--subsystem,windows\
-nostartfiles \
-nostdlib
include $(PATH_TO_TOP)/rules.mak
# EOF

View File

@@ -0,0 +1,19 @@
#include "../../dll/doscalls/doscalls.h"
void Eingang()
{
DosBeep(3000,300);
DosSleep(1000);
DosBeep(4000,200);
DosExit(0,0);
}
void WinMainCRTStartup()
{
int a, b;
a= b+3;
b=a+3;
Eingang();
}

50
os2/dirstruct.txt Normal file
View File

@@ -0,0 +1,50 @@
Win32 and os2ss sight to the system partition
+C < contains under os2ss a autogenerated config.sys
|
+-ROS
+-NATIVE < NTDLL, ntoskrnl, hal.dll, csrss.exe os2.exe psx.exe ...
| +-DRIVERS < *.SYS
| +-CONFIG < registry
+-WIN32
| +-SYSTEM < user32.dll kernel32.dll ...
| +-FONTS
| +...
+-OS2
| +-DLL < doscalls.dll ....
| +-SYSTEM
| +-...
+-PSX
+-etc < mountpoint for posix apps
+-bin
+-dev
+-lib < posix.dll
+-tmp
+-var
+-mnt < empty
posix sight to the system partition
/
+-etc < mountpoint for posix apps
+-bin
+-dev < link to OB-mans Devices
+-lib < posix.dll
+-tmp < alias to systemtemp
+-var
+-mnt
+-C < win32-driveletters
| |
| +-ROS
| +-NATIVE < NTDLL, ntoskrnl, hal.dll, csrss.exe os2.exe psx.exe ...
| | +-DRIVERS < *.SYS
| | +-CONFIG < registry
| +-WIN32
| | +-SYSTEM < user32.dll kernel32.dll ...
| | +-FONTS
| | +...
| +-OS2 <some apps
| | +-DLL < doscalls.dll ....
| | +-SYSTEM
| | +-...
| +-PSX < empty
+-D
+-E...

67
os2/doc/index.html Normal file
View File

@@ -0,0 +1,67 @@
<html>
<head>
<title>OS/2 subsystem for ReactOS</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<h1><b>OS/2 subsystem for ReactOS (ROS/2)</b></h1>
<h2><font color="#009966">Introduction</font></h2>
<p>The OS/2 subsystem is being developed to enable NT-like systems (like WinNT
and ReactOS) to run 32-Bit OS/2 applications natively. With this it shall provide
binary compatiblility on x86-Based systems. It is intended to port the ROS/2
also to other platforms supported by ReactOS / NT. It is planned to provide
source code compatibility on these platforms. Yeeahh, OS/2 for PowerPC is in
sight.</p>
<h2><font color="#009966">Components</font></h2>
<p>ROS/2 consists of the following components:</p>
<ul>
<li>OS2SS.EXE - A native application that implements the personality of the
OS/2 kernel.</li>
<li>OS2.EXE - A win32 application that does the interaction of the OS/2 apps
with the desktop.</li>
<li>Core DLLs - These DLLs that make OS/2 programs interface with the kernel/sub
system (i.E. DOSCALLS.DLL). </li>
<li>Additional DLLs - DLLs that provide additional APIs for OS/2 apps. This
includes Presentation Manager.</li>
</ul>
<h2><font color="#009966">Current state</font></h2>
<p>Up to now just a fragment of DOSCALLS.DLL exists. The biggest problem are the
os2 API headers which are (C) by IBM. So help is still welcome.</p>
<h2><font color="#009966">16-Bit issues</font></h2>
<p>It is not intended to support 16-bit OS/2 applications. This would make the
system inconsistent and produce much more work that use. But there is still
one issue: Current textmode applications are either 16-bit or use thunking to
call the 16-bit APIs. These 32-Bit thunking applications have to be supported.
We are still thinking how to accomplish that. </p>
<h2><font color="#009966">32-Bit issues</font></h2>
<p>It is planned to replace the current MOU- KBD- MSG- and VIO- subsystems with
the <a href="http://homepages.tesco.net/%7EJ.deBoynePollard/Softwares/conapi.html">Unicode
Console API</a>. This is also the foundation for other platforms we want to
provide source code compatibility with. So nearly every 32-Bit processor can
be supported. It sould even be possible to implement a 64-bit OS/2 API.</p>
<h2><font color="#009966">Architecture</font></h2>
<p>To understand the architecture of ReactOS or WinNT read a book from the &quot;Inside
Windows NT&quot;-series. The architecture of ROS/2 is like every normal subsystem.
When OS2SS.EXE starts, it creates an object directory named os2 and therein
it creates a port object with the name Os2API. A port is something like a socket.
Two programs can comunicate with each other via a port. The port Os2API provides
the LPC API of the OS2SS.EXE - the actual subsystem. <br>
Every OS/2 program that is loaded, is linked with DOSCALLS.DLL and NTDLL.DLL
- the interface to the NT-kernel. Since DOSCALLS is implemented using NTDLL.DLL,
every OS/2 app has it in its adress space. Many functions in DOSCALLS.DLL are
implemented by just wrapping NTDLL.DLL functions. Some functions however need
assistance by the subsystem. For this reason the app makes an LPC to OS2SS.EXE.
LPC means local procedure call and it is a very fast version of RPC. Together
with the first application also OS2.EXE starts up. OS2.EXE runs in the win32
subsystem with the security of the current user. OS2.EXE is used to gather keyboard
and mouse input and to show console windows and PM-windows of all OS/2 programms
of the current user. In order to accomplish this OS2.EXE creates a port object
in the os2 object directory named Os2Interact. OS/2 applications have a connection
to OS2.EXE, too. OS2SS.EXE and OS2.EXE also talk to each other. An OS/2 application
then makes LPCs either to OS2.EXE directly or if required via OS2SS.EXE.</p>
<p>Details</p>
<p>&nbsp;</p>
<p>LPC Documentation</p>
</body>
</html>

View File

@@ -0,0 +1,23 @@
; $Id: doscalls.def,v 1.3 2002/03/24 18:55:38 ea Exp $
;
; Def for doscalls.dll - part of the OS/2-sub system
; for ReactOS. Provides Access to OS/2 kernel services.
LIBRARY doscalls.dll
DESCRIPTION "Part of the ReactOS OS/2 sub system, provides base kernel services to OS/2-apps"
EXPORTS
; FIXME: fill in all exports
Dos32Sleep@4 @229
Dos32Close@4 @257
Dos32Open@32 @273
Dos32Read@16 @281
Dos32Write@16 @282
Dos32DevIOCtl@36 @284
Dos32Beep@8 @286
Dos32Exit@8 @234
Dos32CreateThread@20 @311
; EOF

View File

@@ -0,0 +1,23 @@
; $Id: doscalls.edf,v 1.2 2002/03/24 18:55:38 ea Exp $
;
; Def for doscalls.dll - part of the OS/2-sub system
; for ReactOS. Provides Access to OS/2 kernel services.
LIBRARY doscalls.dll
DESCRIPTION "Part of the ReactOS OS/2 sub system, provides base kernel services to OS/2-apps"
EXPORTS
; FIXME: fill in all exports
Dos32Sleep=Dos32Sleep@4 @229
Dos32Close=Dos32Close@4 @257
Dos32Open=Dos32Open@32 @273
Dos32Read=Dos32Read@16 @281
Dos32Write=Dos32Write@16 @282
Dos32DevIOCtl=Dos32DevIOCtl@36 @284
Dos32Beep=Dos32Beep@8 @286
Dos32Exit=Dos32Exit@8 @234
Dos32CreateThread=Dos32CreateThread@20 @311
; EOF

View File

@@ -0,0 +1,38 @@
#include <defines.h>
#include <reactos/resource.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO VERSIONINFO
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", RES_STR_COMPANY_NAME
VALUE "FileDescription", "OS2 subsystem base services\0"
VALUE "FileVersion", RES_STR_FILE_VERSION
VALUE "InternalName", "doscalls\0"
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
VALUE "OriginalFilename", "doscalls.dll\0"
VALUE "ProductName", RES_STR_PRODUCT_NAME
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

File diff suppressed because it is too large Load Diff

36
os2/lib/doscalls/makefile Normal file
View File

@@ -0,0 +1,36 @@
# $Id: makefile,v 1.2 2002/03/24 18:52:10 ea Exp $
PATH_TO_TOP = ../../../..
TARGET_TYPE = dynlink
TARGET_NAME = doscalls
TARGET_BASE = 0x30000000
TARGET_CFLAGS = -DDOSCALLS_BASE=$(TARGET_DLLBASE)
TARGET_LFLAGS = -nostartfiles
TARGET_SDKLIBS = ntdll.a
TARGET_GCCLIBS = gcc
TARGET_OBJECTS = $(TARGET_NAME).o
TARGET_CLEAN = file/*.o vio/*.o sync/*.o mem/*.o \
misc/*.o mou/*.o kbd/*.o run/*.o
DOSCALLS_MISC_OBJECTS = misc/doscalls.o
#SYNC_OBJECTS =
TARGET_OBJECTS = $(DOSCALLS_MISC_OBJECTS)
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

View File

@@ -0,0 +1,341 @@
/* $Id: doscalls.c,v 1.4 2002/04/18 23:49:42 robertk Exp $
*/
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* FILE: dll/doscalls.c
* PURPOSE: Kernelservices for OS/2 apps
* PROGRAMMER: Robert K. robertk@mok.lvcm.com
* REVISION HISTORY:
* 13-03-2002 Created
*/
#include <ddk/ntddk.h>
#include "doscalls.h"
/* Process variables. This section conains
per process variables that are used for caching or
other stuff. */
DWORD PROC_Pid; // contains the current processes pid. (or is it also in PEB)
/* Implementation of the system calls */
APIRET STDCALL Dos32Sleep(ULONG msec)
{
NTSTATUS stat;
TIME Interv;
Interv.QuadPart= -(10000 * msec);
stat = NtDelayExecution( TRUE, &Interv );
return 0;
}
APIRET STDCALL Dos32CreateThread(PTID ptid, PFNTHREAD pfn,
ULONG param, ULONG flag, ULONG cbStack)
{
return 0;
}
APIRET STDCALL Dos32Open(PSZ pszFileName, PHFILE pHf,
PULONG pulAction, ULONG cbFile,
ULONG ulAttribute, ULONG fsOpenFlags,
ULONG fsOpenMode, PVOID reserved ) //ULONGPEAOP2 peaop2)
{
/* NTAPI
ZwCreateFile(
OUT PHANDLE FileHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes,
OUT PIO_STATUS_BLOCK IoStatusBlock,
IN PLARGE_INTEGER AllocationSize OPTIONAL,
IN ULONG FileAttributes,
IN ULONG ShareAccess,
IN ULONG CreateDisposition,
IN ULONG CreateOptions,
IN PVOID EaBuffer OPTIONAL,
IN ULONG EaLength
);*/
OBJECT_ATTRIBUTES ObjectAttributes;
IO_STATUS_BLOCK IoStatusBlock;
UNICODE_STRING NtPathU;
HANDLE FileHandle;
NTSTATUS Status;
ULONG Flags = 0;
switch (dwCreationDisposition)
{
case CREATE_NEW:
dwCreationDisposition = FILE_CREATE;
break;
case CREATE_ALWAYS:
dwCreationDisposition = FILE_OVERWRITE_IF;
break;
case OPEN_EXISTING:
dwCreationDisposition = FILE_OPEN;
break;
case OPEN_ALWAYS:
dwCreationDisposition = OPEN_ALWAYS;
break;
case TRUNCATE_EXISTING:
dwCreationDisposition = FILE_OVERWRITE;
}
DPRINT("CreateFileW(lpFileName %S)\n",lpFileName);
if (dwDesiredAccess & GENERIC_READ)
dwDesiredAccess |= FILE_GENERIC_READ;
if (dwDesiredAccess & GENERIC_WRITE)
dwDesiredAccess |= FILE_GENERIC_WRITE;
if (!(dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED))
{
Flags |= FILE_SYNCHRONOUS_IO_ALERT;
}
if (!RtlDosPathNameToNtPathName_U ((LPWSTR)lpFileName,
&NtPathU,
NULL,
NULL))
return INVALID_HANDLE_VALUE;
DPRINT("NtPathU \'%S\'\n", NtPathU.Buffer);
ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
ObjectAttributes.RootDirectory = NULL;
ObjectAttributes.ObjectName = &NtPathU;
ObjectAttributes.Attributes = OBJ_CASE_INSENSITIVE;
ObjectAttributes.SecurityDescriptor = NULL;
ObjectAttributes.SecurityQualityOfService = NULL;
Status = NtCreateFile (&FileHandle,
dwDesiredAccess,
&ObjectAttributes,
&IoStatusBlock,
NULL,
dwFlagsAndAttributes,
dwShareMode,
dwCreationDisposition,
Flags,
NULL,
0);
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus (Status);
return INVALID_HANDLE_VALUE;
}
return FileHandle;
return 0;
}
/* close a Handle. seems finished */
APIRET STDCALL Dos32Close(HFILE hFile)
{
NTSTATUS nErrCode;
nErrCode = NtClose( (HANDLE)hFile );
switch( nErrCode )
{
case STATUS_SUCCESS:
return NO_ERROR;
case STATUS_INVALID_HANDLE:
return ERROR_INVALID_HANDLE;
case STATUS_HANDLE_NOT_CLOSABLE:
return ERROR_FILE_NOT_FOUND;
}
return nErrCode;
}
APIRET STDCALL Dos32Read(HFILE hFile, PVOID pBuffer,
ULONG cbRead, PULONG pcbActual)
{
NTSTATUS nErrCode;
IO_STATUS_BLOCK isbStatus;
// read data from file
nErrCode = NtReadFile( (HANDLE)hFile, NULL, NULL, NULL,
&isbStatus, pBuffer, cbRead,
NULL, NULL );
// contains the # bytes actually read.
*pcbActual = isbStatus.Information;
switch(nErrCode)
{
case STATUS_INVALID_HANDLE:
return ERROR_INVALID_HANDLE;
// FIXME: complete this
}
return NO_ERROR;
}
/* Generic write to a stream given by hFile */
APIRET STDCALL Dos32Write(HFILE hFile, PVOID pBuffer,
ULONG cbWrite, PULONG pcbActual)
{
NTSTATUS nErrCode;
IO_STATUS_BLOCK StatusBlk;
nErrCode = NtWriteFile( (HANDLE)hFile, NULL, NULL, NULL,
&StatusBlk, pBuffer, cbWrite, 0, NULL );
*pcbActual = StatusBlk.Information;
// do an errorcode translation FIXME: correct
switch(nErrCode)
{
case STATUS_SUCCESS:
case STATUS_PENDING:
case STATUS_ACCESS_DENIED:
case STATUS_INVALID_HANDLE:
case STATUS_FILE_LOCK_CONFLICT:
return 0;
}
return 0;
}
/*******************************************/
/* DosDevIOCtl performs control functions */
/* on a device specified by an opened */
/* device handle. */
/*******************************************/
/*HFILE hDevice; Device handle returned by DosOpen, or a standard (open) device handle. */
/*ULONG category; Device category. */
/*ULONG function; Device-specific function code. */
/*PVOID pParams; Address of the command-specific argument list. */
/*ULONG cbParmLenMax; Length, in bytes, of pParams. */
/*PULONG pcbParmLen; Pointer to the length of parameters. */
/*PVOID pData; Address of the data area. */
/*ULONG cbDataLenMax; Length, in bytes, of pData. */
/*PULONG pcbDataLen; Pointer to the length of data. */
/*APIRET ulrc; Return Code.
ulrc (APIRET) - returns
Return Code.
DosDevIOCtl returns one of the following values:
0 NO_ERROR
1 ERROR_INVALID_FUNCTION
6 ERROR_INVALID_HANDLE
15 ERROR_INVALID_DRIVE
31 ERROR_GEN_FAILURE
87 ERROR_INVALID_PARAMETER
111 ERROR_BUFFER_OVERFLOW
115 ERROR_PROTECTION_VIOLATION
117 ERROR_INVALID_CATEGORY
119 ERROR_BAD_DRIVER_LEVEL
163 ERROR_UNCERTAIN_MEDIA
165 ERROR_MONITORS_NOT_SUPPORTED
*/
APIRET STDCALL Dos32DevIOCtl(HFILE hDevice, ULONG category, ULONG function,
PVOID pParams,ULONG cbParmLenMax,PULONG pcbParmLen,
PVOID pData,ULONG cbDataLenMax,PULONG pcbDataLen)
{
return 0;
}
APIRET STDCALL Dos32Beep(ULONG freq, ULONG dur)
{
if( freq<0x25 || freq>0x7FFF )
return 395; // ERROR_INVALID_FREQUENCY
HANDLE hBeep;
IO_STATUS_BLOCK ComplStatus;
//UNICODE_STRING
OBJECT_ATTRIBUTES oa = {sizeof oa, 0, {8,8,"\\\\.\\Beep"l}, OBJ_CASE_INSENSITIVE};
NTSTATUS stat;
stat = NtOpenFile( &hBeep,
FILE_READ_DATA | FILE_WRITE_DATA,
&oa,
&ComplStatus,
0, // no sharing
FILE_OPEN );
if (!NT_SUCCESS(stat))
{
}
if( ComplStatus->
/* HANDLE hBeep;
BEEP_SET_PARAMETERS BeepSetParameters;
DWORD dwReturned;
hBeep = Dos32Open("\\\\.\\Beep",
FILE_GENERIC_READ | FILE_GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
if (hBeep == INVALID_HANDLE_VALUE)
return FALSE;
*/
// Set beep data
/* BeepSetParameters.Frequency = dwFreq;
BeepSetParameters.Duration = dwDuration;
DeviceIoControl(hBeep,
IOCTL_BEEP_SET,
&BeepSetParameters,
sizeof(BEEP_SET_PARAMETERS),
NULL,
0,
&dwReturned,
NULL);
CloseHandle (hBeep);
return TRUE;
*/
return 0;
}
/* Terminates the current thread or the current Process.
Decission is made by action
FIXME: move this code to OS2.EXE */
VOID STDCALL Dos32Exit(ULONG action, ULONG result)
{
// decide what to do
if( action == EXIT_THREAD)
{
NtTerminateThread( NULL, result );
}
else // EXIT_PROCESS
{
NtTerminateProcess( NULL, result );
}
}
BOOL STDCALL DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
switch (ul_reason_for_call)
{
case 1://DLL_PROCESS_ATTACH:
case 2://DLL_THREAD_ATTACH:
case 3://DLL_THREAD_DETACH:
case 0://DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

View File

@@ -0,0 +1,84 @@
/* $Id: doscalls.h,v 1.3 2002/03/24 18:55:39 ea Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS OS/2 sub system
* FILE: dll/doscalls.h
* PURPOSE: Kernelservices for OS/2 apps
* PROGRAMMER: Robert K. robertk@mok.lvcm.com
* REVISION HISTORY:
* 13-03-2002 Created
*/
#include "os2def.h"
// FIXME: use ib headers
#define EXIT_THREAD 0
#define EXIT_PROCESS 1
#define NO_ERROR 0
#define ERROR_INVALID_HANDLE 5
#define ERROR_FILE_NOT_FOUND 6
// for this
// Give the user nicer names that the internal ones
#define DosSleep Dos32Sleep
#define DosCreateThread Dos32CreateThread
#define DosOpen Dos32Open
#define DosClose Dos32Close
#define DosRead Dos32Read
#define DosWrite Dos32Write
#define DosBeep Dos32Beep
#define DosExit Dos32Exit
APIRET STDCALL Dos32Sleep(ULONG msec);
APIRET STDCALL Dos32CreateThread(PTID ptid,
PFNTHREAD pfn,
ULONG param,
ULONG flag,
ULONG cbStack);
APIRET STDCALL Dos32Open(PSZ pszFileName,
PHFILE pHf,
PULONG pulAction,
ULONG cbFile,
ULONG ulAttribute,
ULONG fsOpenFlags,
ULONG fsOpenMode,
PVOID reserved ); //ULONGPEAOP2 peaop2)
APIRET STDCALL Dos32Close(HFILE hFile);
APIRET STDCALL Dos32Read(HFILE hFile,
PVOID pBuffer,
ULONG cbRead,
PULONG pcbActual);
APIRET STDCALL Dos32Write(HFILE hFile,
PVOID pBuffer,
ULONG cbWrite,
PULONG pcbActual);
APIRET STDCALL Dos32DevIOCtl(HFILE hDevice, ULONG category, ULONG function,
PVOID pParams,ULONG cbParmLenMax,PULONG pcbParmLen,
PVOID pData,ULONG cbDataLenMax,PULONG pcbDataLen);
APIRET STDCALL Dos32Beep(ULONG freq,
ULONG dur);
VOID STDCALL Dos32Exit(ULONG action,
ULONG result);

View File

@@ -0,0 +1,287 @@
/* $Id: errorcodes.c,v 1.2 2002/03/24 18:55:39 ea Exp $
*/
/* some header*/
#include <os2errores>
#include <nt's status.h>
/* This file defines a big array of #defines that are
used to translate OS/2 errorcodes to ntdll error codes. */
/* OS/2 to NTDLL error mapping */
#define NO_ERROR STATUS_SUCCESS
#define ERROR_INVALID_FUNCTION STATUS_ILLEGAL_FUNCTION
#define ERROR_FILE_NOT_FOUND 2 /* MSG%FILE_NOT_FOUND */
#define ERROR_PATH_NOT_FOUND 3 /* MSG%PATH_NOT_FOUND */
#define ERROR_TOO_MANY_OPEN_FILES 4 /* MSG%OUT_OF_HANDLES */
#define ERROR_ACCESS_DENIED 5 /* MSG%ACCESS_DENIED */
#define ERROR_INVALID_HANDLE 6 /* MSG%INVALID_HANDLE */
#define ERROR_ARENA_TRASHED 7 /* MSG%MEMORY_BLOCKS_BAD */
#define ERROR_NOT_ENOUGH_MEMORY 8 /* MSG%NO_MEMORY */
#define ERROR_INVALID_BLOCK 9 /* MSG%INVALID_MEM_ADDR */
#define ERROR_BAD_ENVIRONMENT 10 /* MSG%INVALID_ENVIRON */
#define ERROR_BAD_FORMAT 11 /* MSG%INVALID_FORMAT */
#define ERROR_INVALID_ACCESS 12 /* MSG%INVALID_ACC_CODE */
#define ERROR_INVALID_DATA 13 /* MSG%INVALID_DATA */
#define ERROR_INVALID_DRIVE 15 /* MSG%INVALID_DRIVE */
#define ERROR_CURRENT_DIRECTORY 16 /* MSG%ATT_RD_CURDIR */
#define ERROR_NOT_SAME_DEVICE 17 /* MSG%NOT_SAME_DEVICE */
#define ERROR_NO_MORE_FILES 18 /* MSG%NO_MORE_FILES */
#define ERROR_WRITE_PROTECT 19 /* MSG%ATT_WRITE_PROT */
#define ERROR_BAD_UNIT 20 /* MSG%UNKNOWN_UNIT */
#define ERROR_NOT_READY 21 /* MSG%DRIVE_NOT_READY */
#define ERROR_BAD_COMMAND 22 /* MSG%UNKNOWN_COMMAND */
#define ERROR_CRC 23 /* MSG%DATA_ERROR */
#define ERROR_BAD_LENGTH 24 /* MSG%BAD_REQ_STRUCTURE */
#define ERROR_SEEK 25 /* MSG%SEEK_ERROR */
#define ERROR_NOT_DOS_DISK 26 /* MSG%UNKNOWN_MEDIA */
#define ERROR_SECTOR_NOT_FOUND 27 /* MSG%SECTOR_NOT_FOUND */
#define ERROR_OUT_OF_PAPER 28 /* MSG%OUT_OF_PAPER */
#define ERROR_WRITE_FAULT 29 /* MSG%WRITE_FAULT */
#define ERROR_READ_FAULT 30 /* MSG%READ_FAULT */
#define ERROR_GEN_FAILURE 31 /* MSG%GENERAL_FAILURE */
#define ERROR_SHARING_VIOLATION 32 /* MSG%SHARING_VIOLATION */
/* 32%msg%SHAR_VIOLAT_FIND */
#define ERROR_LOCK_VIOLATION 33 /* MSG%LOCK_VIOLATION */
#define ERROR_WRONG_DISK 34 /* MSG%INVALID_DISK_CHANGE */
#define ERROR_FCB_UNAVAILABLE 35 /* MSG%35 */
#define ERROR_SHARING_BUFFER_EXCEEDED 36 /* MSG%SHARING_BUFF_OFLOW */
#define ERROR_CODE_PAGE_MISMATCHED 37 /* MSG%ERROR_WRITE_PROTECT */
#define ERROR_HANDLE_EOF 38 /* MSG%ERROR_BAD_UNIT */
#define ERROR_HANDLE_DISK_FULL 39 /* MSG%ERROR_NOT_READY */
/* 40%msg%ERROR_BAD_COMMAND */
/* 41%msg%ERROR_CRC */
/* 42%msg%ERROR_BAD_LENGTH */
/* 43%msg%ERROR_SEEK */
/* 44%msg%ERROR_NOT_DOS_DISK */
/* 45%msg%ERROR_SECTOR_NOT_FOUND */
/* 46%msg%ERROR_OUT_OF_PAPER */
/* 47%msg%ERROR_WRITE_FAULT */
/* 48%msg%ERROR_READ_FAULT */
/* 49%msg%ERROR_GEN_FAILURE */
#define ERROR_NOT_SUPPORTED 50 /* MSG%NET_REQ_NOT_SUPPORT */
#define ERROR_REM_NOT_LIST 51 /* MSG%NET_REMOTE_NOT_ONLINE */
#define ERROR_DUP_NAME 52 /* MSG%NET_DUP_FILENAME */
#define ERROR_BAD_NETPATH 53 /* MSG%NET_PATH_NOT_FOUND */
#define ERROR_NETWORK_BUSY 54 /* MSG%NET_BUSY */
#define ERROR_DEV_NOT_EXIST 55 /* MSG%NET_DEV_NOT_INSTALLED */
#define ERROR_TOO_MANY_CMDS 56 /* MSG%NET_BIOS_LIMIT_REACHED */
#define ERROR_ADAP_HDW_ERR 57 /* MSG%NET_ADAPT_HRDW_ERROR */
#define ERROR_BAD_NET_RESP 58 /* MSG%NET_INCORRECT_RESPONSE */
#define ERROR_UNEXP_NET_ERR 59 /* MSG%NET_UNEXPECT_ERROR */
#define ERROR_BAD_REM_ADAP 60 /* MSG%NET_REMOT_ADPT_INCOMP */
#define ERROR_PRINTQ_FULL 61 /* MSG%NET_PRINT_Q_FULL */
#define ERROR_NO_SPOOL_SPACE 62 /* MSG%NET_NO_SPACE_TO_PRINT_FL */
#define ERROR_PRINT_CANCELLED 63 /* MSG%NET_PRINT_FILE_DELETED */
#define ERROR_NETNAME_DELETED 64 /* MSG%NET_NAME_DELETED */
#define ERROR_NETWORK_ACCESS_DENIED 65 /* MSG%NET_ACCESS_DENIED */
#define ERROR_BAD_DEV_TYPE 66 /* MSG%NET_DEV_TYPE_INVALID */
#define ERROR_BAD_NET_NAME 67 /* MSG%NET_NAME_NOT_FOUND */
#define ERROR_TOO_MANY_NAMES 68 /* MSG%NET_NAME_LIMIT_EXCEED */
#define ERROR_TOO_MANY_SESS 69 /* MSG%NET_BIOS_LIMIT_EXCEED */
#define ERROR_SHARING_PAUSED 70 /* MSG%NET_TEMP_PAUSED */
#define ERROR_REQ_NOT_ACCEP 71 /* MSG%NET_REQUEST_DENIED */
#define ERROR_REDIR_PAUSED 72 /* MSG%NET_PRT_DSK_REDIR_PAUSE */
#define ERROR_SBCS_ATT_WRITE_PROT 73 /* Attempted write on protected disk */
#define ERROR_SBCS_GENERAL_FAILURE 74 /* General failure */
#define ERROR_XGA_OUT_MEMORY 75 /* MSG%XGA_OUT_MEMORY */
#define ERROR_FILE_EXISTS 80 /* MSG%FILE_EXISTS */
#define ERROR_DUP_FCB 81 /* MSG%none */
#define ERROR_CANNOT_MAKE 82 /* MSG%CANNOT_MAKE */
#define ERROR_FAIL_I24 83 /* MSG%NET_FAIL_INT_TWO_FOUR */
#define ERROR_OUT_OF_STRUCTURES 84 /* MSG%NET_TOO_MANY_REDIRECT */
#define ERROR_ALREADY_ASSIGNED 85 /* MSG%NET_DUP_REDIRECTION */
#define ERROR_INVALID_PASSWORD 86 /* MSG%NET_INVALID_PASSWORD */
#define ERROR_INVALID_PARAMETER 87 /* MSG%NET_INCORR_PARAMETER */
#define ERROR_NET_WRITE_FAULT 88 /* MSG%NET_DATA_FAULT */
#define ERROR_NO_PROC_SLOTS 89 /* MSG%NO_PROC_SLOTS */
#define ERROR_NOT_FROZEN 90 /* MSG%none */
#define ERROR_SYS_COMP_NOT_LOADED ERROR_NOT_FROZEN
#define ERR_TSTOVFL 91 /* MSG%none */
#define ERR_TSTDUP 92 /* MSG%none */
#define ERROR_NO_ITEMS 93 /* MSG%none */
#define ERROR_INTERRUPT 95 /* MSG%none */
#define ERROR_DEVICE_IN_USE 99 /* MSG%DEVICE_IN_USE */
#define ERROR_TOO_MANY_SEMAPHORES 100 /* MSG%TOO_MANY_SEMAPHORES */
#define ERROR_EXCL_SEM_ALREADY_OWNED 101 /* MSG%EXCL_SEM_ALREADY_OWNED */
#define ERROR_SEM_IS_SET 102 /* MSG%SEM_IS_SET */
#define ERROR_TOO_MANY_SEM_REQUESTS 103 /* MSG%TOO_MANY_SEM_REQUESTS */
#define ERROR_INVALID_AT_INTERRUPT_TIME 104 /* MSG%INVALID_AT_INTERRUPT_TIME */
#define ERROR_SEM_OWNER_DIED 105 /* MSG%SEM_OWNER_DIED */
#define ERROR_SEM_USER_LIMIT 106 /* MSG%ERROR_DISK_CHANGE */
#define ERROR_DISK_CHANGE 107 /* MSG%DISK_CHANGE */
#define ERROR_DRIVE_LOCKED 108 /* MSG%DRIVE_LOCKED */
#define ERROR_BROKEN_PIPE 109 /* MSG%BROKEN_PIPE */
#define ERROR_OPEN_FAILED 110 /* MSG%ERROR_OPEN_FAILED */
#define ERROR_BUFFER_OVERFLOW 111 /* MSG%ERROR_FILENAME_LONG */
#define ERROR_DISK_FULL 112 /* MSG%DISK_FULL */
#define ERROR_NO_MORE_SEARCH_HANDLES 113 /* MSG%NO_SEARCH_HANDLES */
#define ERROR_INVALID_TARGET_HANDLE 114 /* MSG%ERR_INV_TAR_HANDLE */
#define ERROR_PROTECTION_VIOLATION 115 /* MSG%none */
#define ERROR_VIOKBD_REQUEST 116 /* MSG%none */
#define ERROR_INVALID_CATEGORY 117 /* MSG%INVALID_CATEGORY */
#define ERROR_INVALID_VERIFY_SWITCH 118 /* MSG%INVALID_VERIFY_SWITCH */
#define ERROR_BAD_DRIVER_LEVEL 119 /* MSG%BAD_DRIVER_LEVEL */
#define ERROR_CALL_NOT_IMPLEMENTED 120 /* MSG%BAD_DYNALINK */
#define ERROR_SEM_TIMEOUT 121 /* MSG%SEM_TIMEOUT */
#define ERROR_INSUFFICIENT_BUFFER 122 /* MSG%INSUFFICIENT_BUFFER */
#define ERROR_INVALID_NAME 123 /* MSG%INVALID_NAME */
/* 123%msg%HPFS_INVALID_VOLUME_CHAR */
#define ERROR_INVALID_LEVEL 124 /* MSG%INVALID_LEVEL */
#define ERROR_NO_VOLUME_LABEL 125 /* MSG%NO_VOLUME_LABEL */
#define ERROR_MOD_NOT_FOUND 126 /* MSG%MOD_NOT_FOUND */
#define ERROR_PROC_NOT_FOUND 127 /* MSG%PROC_NOT_FOUND */
#define ERROR_WAIT_NO_CHILDREN 128 /* MSG%none */
#define ERROR_CHILD_NOT_COMPLETE 129 /* MSG%PROT_MODE_ONLY */
#define ERROR_DIRECT_ACCESS_HANDLE 130 /* MSG%APPL_SINGLEFRAMECHAR */
#define ERROR_NEGATIVE_SEEK 131 /* MSG%APPL_DOUBLEFRAMECHAR */
#define ERROR_SEEK_ON_DEVICE 132 /* MSG%APPL_ARROWCHAR */
#define ERROR_IS_JOIN_TARGET 133 /* MSG%JOIN_ON_DRIV_IS_TAR */
#define ERROR_IS_JOINED 134 /* MSG%JOIN_DRIVE_IS */
#define ERROR_IS_SUBSTED 135 /* MSG%SUB_DRIVE_IS */
#define ERROR_NOT_JOINED 136 /* MSG%DRIVE_IS_NOT_JOINED */
#define ERROR_NOT_SUBSTED 137 /* MSG%DRIVE_NOT_SUBSTED */
#define ERROR_JOIN_TO_JOIN 138 /* MSG%JOIN_CANNOT_JOIN_DRIVE */
#define ERROR_SUBST_TO_SUBST 139 /* MSG%SUB_CANNOT_SUBST_DRIVE */
#define ERROR_JOIN_TO_SUBST 140 /* MSG%JOIN_CANNOT_SUB_DRIVE */
#define ERROR_SUBST_TO_JOIN 141 /* MSG%SUB_CANNOT_JOIN_DRIVE */
#define ERROR_BUSY_DRIVE 142 /* MSG%DRIVE_IS_BUSY */
#define ERROR_SAME_DRIVE 143 /* MSG%JOIN_SUB_SAME_DRIVE */
#define ERROR_DIR_NOT_ROOT 144 /* MSG%DIRECT_IS_NOT_SUBDIR */
#define ERROR_DIR_NOT_EMPTY 145 /* MSG%DIRECT_IS_NOT_EMPTY */
#define ERROR_IS_SUBST_PATH 146 /* MSG%PATH_USED_SUBST_JOIN */
#define ERROR_IS_JOIN_PATH 147 /* MSG%NO_NEEDED_RESOURCES */
#define ERROR_PATH_BUSY 148 /* MSG%PATH_BUSY */
#define ERROR_IS_SUBST_TARGET 149 /* MSG%SUB_ON_DRIVE_IS_JOIN */
#define ERROR_SYSTEM_TRACE 150 /* MSG%SYSTEM_TRACE */
#define ERROR_INVALID_EVENT_COUNT 151 /* MSG%INVALID_EVENT_COUNT */
#define ERROR_TOO_MANY_MUXWAITERS 152 /* MSG%TOO_MANY_MUXWAITERS */
#define ERROR_INVALID_LIST_FORMAT 153 /* MSG%INVALID_LIST_FORMAT */
#define ERROR_LABEL_TOO_LONG 154 /* MSG%VOLUME_TOO_LONG */
/* 154%msg%HPFS_VOL_LABEL_LONG */
#define ERROR_TOO_MANY_TCBS 155 /* MSG%TOO_MANY_TCBS */
#define ERROR_SIGNAL_REFUSED 156 /* MSG%SIGNAL_REFUSED */
#define ERROR_DISCARDED 157 /* MSG%DISCARDED */
#define ERROR_NOT_LOCKED 158 /* MSG%NOT_LOCKED */
#define ERROR_BAD_THREADID_ADDR 159 /* MSG%BAD_THREADID_ADDR */
#define ERROR_BAD_ARGUMENTS 160 /* MSG%BAD_ARGUMENTS */
#define ERROR_BAD_PATHNAME 161 /* MSG%none */
#define ERROR_SIGNAL_PENDING 162 /* MSG%SIGNAL_PENDING */
#define ERROR_UNCERTAIN_MEDIA 163 /* MSG%none */
#define ERROR_MAX_THRDS_REACHED 164 /* MSG%MAX_THRDS_REACHED */
#define ERROR_MONITORS_NOT_SUPPORTED 165 /* MSG%none */
#define ERROR_UNC_DRIVER_NOT_INSTALLED 166 /* MSG%UNC_DRIVER_NOT_INSTALLED */
#define ERROR_LOCK_FAILED 167 /* MSG%LOCK_FAILED */
#define ERROR_SWAPIO_FAILED 168 /* MSG%SWAPIO_FAILED */
#define ERROR_SWAPIN_FAILED 169 /* MSG%SWAPIN_ATTEMPT_FAILED */
#define ERROR_BUSY 170 /* MSG%SEGMENT_BUSY */
/* 171%msg%INT_TOO_LONG */
#define ERROR_CANCEL_VIOLATION 173 /* MSG%UNLOCK_VIOLATION */
#define ERROR_ATOMIC_LOCK_NOT_SUPPORTED 174 /* MSG%none */
#define ERROR_READ_LOCKS_NOT_SUPPORTED 175 /* MSG%none */
#define ERROR_INVALID_SEGMENT_NUMBER 180 /* MSG%INVALID_SEGMENT_NUM */
#define ERROR_INVALID_CALLGATE 181 /* MSG%none */
#define ERROR_INVALID_ORDINAL 182 /* MSG%INVALID_ORDINAL */
#define ERROR_ALREADY_EXISTS 183 /* MSG%none */
#define ERROR_NO_CHILD_PROCESS 184 /* MSG%none */
#define ERROR_CHILD_ALIVE_NOWAIT 185 /* MSG%none */
#define ERROR_INVALID_FLAG_NUMBER 186 /* MSG%INVALID_FLAG_NUMBER */
#define ERROR_SEM_NOT_FOUND 187 /* MSG%SEM_NOT_FOUND */
#define ERROR_INVALID_STARTING_CODESEG 188 /* MSG%INVALID_STARTING_CODESEG */
#define ERROR_INVALID_STACKSEG 189 /* MSG%INVALID_STACKSEG */
#define ERROR_INVALID_MODULETYPE 190 /* MSG%INVALID_MODULETYPE */
#define ERROR_INVALID_EXE_SIGNATURE 191 /* MSG%INVALID_EXE_SIGNATURE */
#define ERROR_EXE_MARKED_INVALID 192 /* MSG%EXE_MARKED_INVALID */
#define ERROR_BAD_EXE_FORMAT 193 /* MSG%BAD_EXE_FORMAT */
#define ERROR_ITERATED_DATA_EXCEEDS_64k 194 /* MSG%ITERATED_DATA_EXCEEDS_64K */
#define ERROR_INVALID_MINALLOCSIZE 195 /* MSG%INVALID_MINALLOCSIZE */
#define ERROR_DYNLINK_FROM_INVALID_RING 196 /* MSG%DYNLINK_FROM_INVALID_RING */
#define ERROR_IOPL_NOT_ENABLED 197 /* MSG%IOPL_NOT_ENABLED */
#define ERROR_INVALID_SEGDPL 198 /* MSG%INVALID_SEGDPL */
#define ERROR_AUTODATASEG_EXCEEDS_64k 199 /* MSG%AUTODATASEG_EXCEEDS_64K */
#define ERROR_RING2SEG_MUST_BE_MOVABLE 200 /* MSG%CODESEG_CANNOT_BE_64K */
#define ERROR_RELOC_CHAIN_XEEDS_SEGLIM 201 /* MSG%RELOC_CHAIN_XEEDS_SEGMENT */
#define ERROR_INFLOOP_IN_RELOC_CHAIN 202 /* MSG%INFLOOP_IN_RELOC_CHAIN */
#define ERROR_ENVVAR_NOT_FOUND 203 /* MSG%ENVVAR_NOT_FOUND */
#define ERROR_NOT_CURRENT_CTRY 204 /* MSG%none */
#define ERROR_NO_SIGNAL_SENT 205 /* MSG%SIGNAL_NOT_SENT */
#define ERROR_FILENAME_EXCED_RANGE 206 /* MSG%NAME_TOO_LONG */
#define ERROR_RING2_STACK_IN_USE 207 /* MSG%RING2_STACK_IN_USE */
#define ERROR_META_EXPANSION_TOO_LONG 208 /* MSG%WILD_CARD_NAME */
#define ERROR_INVALID_SIGNAL_NUMBER 209 /* MSG%INVALID_SIGNAL_NUMBER */
#define ERROR_THREAD_1_INACTIVE 210 /* MSG%THREAD_1_INACTIVE */
#define ERROR_INFO_NOT_AVAIL 211 /* MSG%none */
#define ERROR_LOCKED 212 /* MSG%LOCKED */
#define ERROR_BAD_DYNALINK 213 /* MSG%none */
#define ERROR_TOO_MANY_MODULES 214 /* MSG%TOO_MANY_MODULES */
#define ERROR_NESTING_NOT_ALLOWED 215 /* MSG%none */
#define ERROR_CANNOT_SHRINK 216 /* MSG%CANNOT_SHRINK */
#define ERROR_ZOMBIE_PROCESS 217 /* MSG%none */
#define ERROR_STACK_IN_HIGH_MEMORY 218 /* MSG%none */
#define ERROR_INVALID_EXITROUTINE_RING 219 /* MSG%INVALID_EXITROUTINE_RING */
#define ERROR_GETBUF_FAILED 220 /* MSG%none */
#define ERROR_FLUSHBUF_FAILED 221 /* MSG%none */
#define ERROR_TRANSFER_TOO_LONG 222 /* MSG%none */
#define ERROR_FORCENOSWAP_FAILED 223 /* MSG%none */
#define ERROR_SMG_NO_TARGET_WINDOW 224 /* PM ID can't be selected */
#define ERROR_NO_CHILDREN 228 /* MSG%NO_CHILDREN */
#define ERROR_INVALID_SCREEN_GROUP 229 /* MSG%none */
#define ERROR_BAD_PIPE 230 /* MSG%ERROR_BAD_PIPE */
#define ERROR_PIPE_BUSY 231 /* MSG%ERROR_PIPE_BUSY */
#define ERROR_NO_DATA 232 /* MSG%ERROR_NO_DATA */
#define ERROR_PIPE_NOT_CONNECTED 233 /* MSG%ERROR_PIPE_NOT_CONNECTED */
#define ERROR_MORE_DATA 234 /* MSG%ERROR_MORE_DATA */
#define ERROR_VC_DISCONNECTED 240 /* MSG%ERROR_VC_DISCONNECTED */
#define ERROR_CIRCULARITY_REQUESTED 250 /* MSG%CIRCULARITY_REQUESTED */
#define ERROR_DIRECTORY_IN_CDS 251 /* MSG%DIRECTORY_IN_CDS */
#define ERROR_INVALID_FSD_NAME 252 /* MSG%INVALID_FSD_NAME */
#define ERROR_INVALID_PATH 253 /* MSG%INVALID_PATH */
#define ERROR_INVALID_EA_NAME 254 /* MSG%INVALID_EA_NAME */
#define ERROR_EA_LIST_INCONSISTENT 255 /* MSG%EA_LIST_INCONSISTENT */
#define ERROR_EA_LIST_TOO_LONG 256 /* MSG%EA_LIST_TOO_LONG */
#define ERROR_NO_META_MATCH 257 /* MSG%NO_META_MATCH */
#define ERROR_FINDNOTIFY_TIMEOUT 258 /* MSG%FINDNOTIFY_TIMEOUT */
#define ERROR_NO_MORE_ITEMS 259 /* MSG%NO_MORE_ITEMS */
#define ERROR_SEARCH_STRUC_REUSED 260 /* MSG%SEARCH_STRUC_REUSED */
#define ERROR_CHAR_NOT_FOUND 261 /* MSG%CHAR_NOT_FOUND */
#define ERROR_TOO_MUCH_STACK 262 /* MSG%TOO_MUCH_STACK */
#define ERROR_INVALID_ATTR 263 /* MSG%INVALID_ATTR */
#define ERROR_INVALID_STARTING_RING 264 /* MSG%INVALID_STARTING_RING */
#define ERROR_INVALID_DLL_INIT_RING 265 /* MSG%INVALID_DLL_INIT_RING */
#define ERROR_CANNOT_COPY 266 /* MSG%CANNOT_COPY */
#define ERROR_DIRECTORY 267 /* MSG%DIRECTORY */
#define ERROR_OPLOCKED_FILE 268 /* MSG%OPLOCKED_FILE */
#define ERROR_OPLOCK_THREAD_EXISTS 269 /* MSG%OPLOCK_THREAD_EXISTS */
#define ERROR_VOLUME_CHANGED 270 /* MSG%none */
#define ERROR_FINDNOTIFY_HANDLE_IN_USE 271 /* MSG%none */
#define ERROR_FINDNOTIFY_HANDLE_CLOSED 272 /* MSG%none */
#define ERROR_NOTIFY_OBJECT_REMOVED 273 /* MSG%none */
#define ERROR_ALREADY_SHUTDOWN 274 /* MSG%none */
#define ERROR_EAS_DIDNT_FIT 275 /* MSG%none */
#define ERROR_EA_FILE_CORRUPT 276 /* MSG%ERROR_EAS_CORRUPT */
#define ERROR_EA_TABLE_FULL 277 /* MSG%EA_TABLE_FULL */
#define ERROR_INVALID_EA_HANDLE 278 /* MSG%INVALID_EA_HANDLE */
#define ERROR_NO_CLUSTER 279 /* MSG%NO_CLUSTER */
#define ERROR_CREATE_EA_FILE 280 /* MSG%ERROR_CREATE_EA_FILE */
#define ERROR_CANNOT_OPEN_EA_FILE 281 /* MSG%CANNOT_OPEN_FILE */
#define ERROR_EAS_NOT_SUPPORTED 282 /* MSG%EAS_NOT_SUPPORTED */
#define ERROR_NEED_EAS_FOUND 283 /* MSG%NEED_EAS_FOUND */
#define ERROR_DUPLICATE_HANDLE 284 /* MSG%EAS_DISCARDED */
#define ERROR_DUPLICATE_NAME 285 /* MSG%DUPLICATE_SEM_NAME */
#define ERROR_EMPTY_MUXWAIT 286 /* MSG%EMPTY_MUXWAIT_SEM */
#define ERROR_MUTEX_OWNED 287 /* MSG%MUTEX_SEM_OWNED */
#define ERROR_NOT_OWNER 288 /* MSG%NOT_MUTEX_SEM_OWNER */
#define ERROR_PARAM_TOO_SMALL 289 /* MSG%QUERY_MUX_PARAM_TOO_SMALL */
#define ERROR_TOO_MANY_HANDLES 290 /* MSG%TOO_MANY_SEM_HANDLES */
#define ERROR_TOO_MANY_OPENS 291 /* MSG%TOO_MANY_SEM_OPENS */
#define ERROR_WRONG_TYPE 292 /* MSG%SEM_WRONG_TYPE */
#define ERROR_UNUSED_CODE 293 /* MSG%none */
#define ERROR_THREAD_NOT_TERMINATED 294 /* MSG%none */
#define ERROR_INIT_ROUTINE_FAILED 295 /* MSG%none */
#define ERROR_MODULE_IN_USE 296 /* MSG%none */
#define ERROR_NOT_ENOUGH_WATCHPOINTS 297 /* MSG%none */
#define ERROR_TOO_MANY_POSTS 298 /* MSG%TOO_MANY_EVENT_SEM_POSTS */
#define ERROR_ALREADY_POSTED 299 /* MSG%EVENT_SEM_ALREADY_POSTED */
#define ERROR_ALREADY_RESET 300 /* MSG%EVENT_SEM_ALREADY_RESET */
#define ERROR_SEM_BUSY 301 /* MSG%SEM_BUSY */

View File

@@ -0,0 +1,54 @@
/* $Id: os2def.h,v 1.3 2002/04/18 23:49:42 robertk Exp $ */
/* This file conains common OS/2 types that are needed to build this dll */
/* this file should have temporal character until a better idea is born */
#ifndef __OS2DEF__
#define __OS2DEF__
typedef unsigned long __stdcall APIRET;
#define APIENTRY
typedef char *PSZ;
typedef char *NPSZ;
typedef char *NPCH;
#define VOID void
//
/* define these types only when ntdll is not included */
#if( !defined( __INCLUDE_NTDEF_H ))
#define CHAR char
#define SHORT short
#define LONG long
typedef char BYTE;
typedef unsigned char UCHAR;
typedef unsigned short USHORT;
typedef unsigned long ULONG;
typedef CHAR *PCHAR;
typedef SHORT *PSHORT;
typedef LONG *PLONG;
typedef UCHAR *PUCHAR;
typedef USHORT *PUSHORT;
typedef ULONG *PULONG;
typedef VOID *PVOID;
#endif
//typedef char *PCH;
//typedef const char *PCSZ;
typedef unsigned long LHANDLE;
typedef LHANDLE HMODULE; /* hmod */
typedef LHANDLE PID; /* pid */
typedef LHANDLE TID; /* tid */
typedef LHANDLE HFILE;
typedef HFILE *PHFILE;
typedef HMODULE *PHMODULE;
typedef PID *PPID;
typedef TID *PTID;
typedef VOID APIENTRY FNTHREAD(ULONG);
typedef FNTHREAD *PFNTHREAD;
#endif //__OS2DEF__

View File

@@ -0,0 +1,18 @@
/* $Id: process.cpp,v 1.2 2002/03/24 18:55:39 ea Exp $ */
/* Terminates the current thread or the current Process.
Decission is made by action
FIXME: move this code to OS2.EXE */
VOID APIENTRY Dos32Exit(ULONG action, ULONG result)
{
// decide what to do
if( action == EXIT_THREAD)
{
NtTerminateThread( NULL, result );
}
else // EXIT_PROCESS
{
NtTerminateProcess( NULL, result );
}
}
/* EOF */

29
os2/server/makefile Normal file
View File

@@ -0,0 +1,29 @@
# $Id: makefile,v 1.1 2002/03/23 19:23:28 robertk Exp $
PATH_TO_TOP = ../../..
TARGET_TYPE = program
TARGET_APPTYPE = native
TARGET_NAME = os2ss
TARGET_INSTALLDIR = system32
TARGET_CFLAGS = -D__NTAPP__
#OBJECTS_API =
OBJECTS_MISC = \
$(TARGET_NAME).o
TARGET_OBJECTS = \
$(OBJECTS_API)
# \
# $(OBJECTS_MISC)
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

115
os2/server/os2ss.cpp Normal file
View File

@@ -0,0 +1,115 @@
/* $Id: os2ss.cpp,v 1.1 2002/03/23 19:23:28 robertk Exp $
*
* reactos/subsys/csrss/api/process.c
*
* "\windows\ApiPort" port process management functions
*
* ReactOS Operating System
*/
// TODO: Rewrite the whole file. This is just a copy
#include <ddk/ntddk.h>
#include <ntdll/rtl.h>
/* server variables */
int NumProcesses;
/* Native image's entry point */
void NtProcessStartup (PPEB Peb)
{
PRTL_USER_PROCESS_PARAMETERS ProcParams;
PWSTR ArgBuffer;
PWSTR *argv;
ULONG argc = 0;
int i = 0;
int afterlastspace = 0;
OBJECT_ATTRIBUTES ObjectAttributes;
HANDLE CsrssInitEvent;
UNICODE_STRING UnicodeString;
NTSTATUS Status;
ProcParams = RtlNormalizeProcessParams (Peb->ProcessParameters);
argv = (PWSTR *)RtlAllocateHeap (Peb->ProcessHeap,
0, 512 * sizeof(PWSTR));
ArgBuffer = (PWSTR)RtlAllocateHeap (Peb->ProcessHeap,
0,
ProcParams->CommandLine.Length + sizeof(WCHAR));
memcpy (ArgBuffer,
ProcParams->CommandLine.Buffer,
ProcParams->CommandLine.Length + sizeof(WCHAR));
while (ArgBuffer[i])
{
if (ArgBuffer[i] == L' ')
{
argc++;
ArgBuffer[i] = L'\0';
argv[argc-1] = &(ArgBuffer[afterlastspace]);
i++;
while (ArgBuffer[i] == L' ')
i++;
afterlastspace = i;
}
else
{
i++;
}
}
if (ArgBuffer[afterlastspace] != L'\0')
{
argc++;
ArgBuffer[i] = L'\0';
argv[argc-1] = &(ArgBuffer[afterlastspace]);
}
RtlInitUnicodeString(&UnicodeString,
L"\\CsrssInitDone");
InitializeObjectAttributes(&ObjectAttributes,
&UnicodeString,
EVENT_ALL_ACCESS,
0,
NULL);
Status = NtOpenEvent(&CsrssInitEvent,
EVENT_ALL_ACCESS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
DbgPrint("CSR: Failed to open csrss notification event\n");
}
if (CsrServerInitialization (argc, argv) == TRUE)
{
NtSetEvent(CsrssInitEvent,
NULL);
RtlFreeHeap (Peb->ProcessHeap,
0, argv);
RtlFreeHeap (Peb->ProcessHeap,
0,
ArgBuffer);
/* terminate the current thread only */
NtTerminateThread( NtCurrentThread(), 0 );
}
else
{
DisplayString( L"CSR: Subsystem initialization failed.\n" );
RtlFreeHeap (Peb->ProcessHeap,
0, argv);
RtlFreeHeap (Peb->ProcessHeap,
0,
ArgBuffer);
/*
* Tell SM we failed.
*/
NtTerminateProcess( NtCurrentProcess(), 0 );
}

BIN
os2/utils/LXDUMP.EXE Normal file

Binary file not shown.

30
posix/Makefile Normal file
View File

@@ -0,0 +1,30 @@
# $Id: Makefile,v 1.1 2002/04/10 21:30:20 ea Exp $
#
# ReactOS POSIX+ Personality
#
PATH_TO_TOP=../..
CFLAGS=-Iinclude
all: lib/crt0w32.o
make -C tools
make -C server
make -C lib/psxdll
make -C lib/psxx
make -C apps/baresh
make -C apps/csrterm
lib/crt0w32.o: lib/crt0w32.c
clean:
make -C tools clean
make -C server clean
make -C lib/psxdll clean
make -C lib/psxx clean
make -C apps/baresh clean
make -C apps/csrterm clean
- $(RM) lib/crt0w32.o
include $(PATH_TO_TOP)/rules.mak
# EOF

View File

@@ -0,0 +1,40 @@
# $Id: Makefile,v 1.2 2002/04/07 13:53:51 ea Exp $
#
# Tu run it in Win32 console mode, undefine __SUBSYSTEM_WINDOWS__
# and pass "console" in the ld's --subsystem option.
#
#
PATH_TO_TOP=../../../..
PATH_TO_PSX_TOP=../..
TARGET_NAME=sh
CFLAGS=-D__SUBSYSTEM_WINDOWS__
OBJECTS=$(TARGET_NAME).o $(TARGET_NAME).coff
LIBRARIES=\
$(PATH_TO_PSX_TOP)/lib/crt0w32.o \
$(PATH_TO_TOP)/dk/psx/lib/psxdll.a
$(TARGET_NAME): $(OBJECTS) $(LIBRARIES)
$(CC) \
$(CFLAGS) \
$(OBJECTS) \
$(LIBRARIES)\
-o $@ \
-Wl,--subsystem,windows\
-nostartfiles \
-nostdlib
$(TARGET_NAME).coff: $(TARGET_NAME).rc
$(RC) \
--include-dir $(PATH_TO_TOP)/include \
--output-format coff \
$< $@
include $(PATH_TO_TOP)/rules.mak
# EOF

60
posix/apps/baresh/sh.c Normal file
View File

@@ -0,0 +1,60 @@
/* $Id: sh.c,v 1.1 2002/01/20 21:22:29 ea Exp $
*
* baresh - Bare Shell for the PSX subsystem.
* Copyright (c) 2002 Emanuele Aliberti
* License: GNU GPL v2
*/
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
#define INPUT_BUFFER_SIZE 128
int run=1;
void cmd_exit(char*buf)
{
run=0;
}
void cmd_pwd(char * buf)
{
char pwd[1024];
getcwd(pwd,sizeof pwd);
printf("%s\n",pwd);
}
void cmd_ls(char*buf)
{
char pwd[1024];
DIR * dir;
struct dirent * entry;
getcwd(pwd,sizeof pwd);
dir=opendir(pwd);
while (NULL!=(entry=readdir(dir)))
{
printf("%s\n",entry->d_name);
}
closedir(dir);
}
int main(int argc,char*argv[])
{
char buf[INPUT_BUFFER_SIZE];
while (run)
{
printf("# ");
if (gets(buf))
{
if (!strcmp("exit",buf)) cmd_exit(buf);
else if (!strcmp("pwd",buf)) cmd_pwd(buf);
else if (!strcmp("ls",buf)) cmd_ls(buf);
else printf("%s: unknown command\n",argv[0]);
}
}
return 0;
}
/* EOF */

38
posix/apps/baresh/sh.rc Normal file
View File

@@ -0,0 +1,38 @@
#include <defines.h>
#include <reactos/resource.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO VERSIONINFO
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", RES_STR_COMPANY_NAME
VALUE "FileDescription", "Bare sh for POSIX+\0"
VALUE "FileVersion", RES_STR_FILE_VERSION
VALUE "InternalName", "sh\0"
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
VALUE "OriginalFilename", "sh\0"
VALUE "ProductName", RES_STR_PRODUCT_NAME
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View File

@@ -0,0 +1,90 @@
08/08/96 - John L. Miller, johnmil@cs.cmu.edu, johnmil@jprc.com
FILES INCLUDED:
00readme.txt - this file
VT100.H - Definitions for VT-100 emulator.
VT100.C - Front end parsing code for VT-100 emulator
CONSOLE.C - Back-end code to allow VT-100 in WinNt/Win95 console
Many UNIX users take terminals for granted, as something you get for free
with the operating system. Unfortunately, this isn't the case for many
non-unix operating systems, especially PC-based ones. After a number of
projects, I decided it would be nice if there was source publicly available
for doing VT-100 emulation.
The files included with this distribution are not a complete implementation
of VT-100 terminal emulation, but do provide complete enough coverage to
use many vt-100 functions over the network. For instance, its enough to
use EMACS to edit, or to connect up to your favorite mud with ANSI color
and graphics characters.
The VT-100 emulator is broken into two parts. The first is the front end,
vt100.c and vt100.h. These files were written to be fairly device-independant,
though admittedly if you're running under a 16-bit operating system instead
of a 32-bit, you might need to change some of the 'int' values to 'long.'
Otherwise, it should work 'as-is'.
The second part is a back-end. The back-end is responsible for doing the
workhorse activities. The front-end parses a character stream, and decides
whether to clear a part of the screen, or move the cursor, or switch fonts.
Then it calls routines in the back-end to perform these activities.
The back-end functions are, for the most part, very straight forward, and
quite easy to implement compared to writing a vt-100 emulator from scratch.
CONSOLE.C is a back-end for use in console (command, dos) windows under
Windows 95 and Windows NT. This console vt-100 emulator is also being used
in my TINTIN-III port and kerberized encrypted telnet port.
TO USE THIS VT-100 EMULATOR:
First, it's intended to be linked directly into source code. You'll need
to change printf's and puts' in your source code to call vtprintf() and
vtputs() instead. You can add additional functions to vt100.c as you see
fit to handle other output functions like putchar() and write(). Another
routine you may want to use is vtProcessedTextOut(), which accepts a
buffer to output, and a count of characters in that buffer.
Second, you need to make sure that your source code calls vtInitVT100()
before it does ANYTHING else. This initializes the vt-100 emulator.
Third, if you want to use this VT-100 emulator with anything besides
Windows NT and Windows 95 consoles, you'll need to implement your own
back end. The list of functions you will need to supply, as well as what
they need to do is contained in vt100.h. The list (minus descriptions)
is as follows:
int beInitVT100Terminal();
int beAbsoluteCursor(int row, int col);
int beOffsetCursor(int row, int column);
int beRestoreCursor(void);
int beSaveCursor(void);
int beSetTextAttributes(int fore, int back);
int beRawTextOut(char *text, int len);
int beEraseText(int rowFrom, int colFrom, int rowTo, int colTo);
int beDeleteText(int rowFrom, int colFrom, int rowTo, int colTo);
int beInsertRow(int row);
int beTransmitText(char *text, int len);
int beAdvanceToTab(void);
int beClearTab(int col);
int beSetScrollingRows(int fromRow, int toRow);
int beRingBell(void);
int beGetTermMode();
int beSetTermMode(int newMode);
For details on what each of these does, read the descriptions of each
function included in vt100.h, and read over CONSOLE.C for examples. I've
included copious comments in all of these files to try to make them as
easy to use as possible.
In any case, it should be easier than writing a VT-100 emulator from
scratch.
KNOWN BUGS -
o Many features of VT-100 emulation aren't implemented. This includes
support for graphics character set 0 and many of the
answerback functions.
Well, good luck!

View File

@@ -0,0 +1,23 @@
# $Id: Makefile,v 1.1 2002/03/17 22:15:39 ea Exp $
#
# POSIX+ Terminal Emulator that runs in the W32 subsystem.
#
PATH_TO_TOP=../../../..
PATH_TO_TOP_PSX=../..
TARGET_NAME=csrterm
TARGET_TYPE=program
TARGET_APPTYPE=console
TARGET_CFLAGS =-I$(PATH_TO_TOP_PSX)/include
TARGET_SDKLIBS=ntdll.a kernel32.a
TARGET_OBJECTS=\
$(TARGET_NAME).o \
console.o \
vt100.o \
$(TARGET_NAME).coff
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF

1243
posix/apps/csrterm/console.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,609 @@
/* $Id: csrterm.c,v 1.4 2002/04/10 21:12:41 ea Exp $
*
* PROJECT : ReactOS Operating System / POSIX+ Environment Subsystem
* DESCRIPTION: CSRTERM - A DEC VT-100 terminal emulator for the PSX subsystem
* DESCRIPTION: that runs in the Win32 subsystem.
* COPYRIGHT : Copyright (c) 2001-2002 Emanuele Aliberti
* LICENSE : GNU GPL v2
* DATE : 2001-05-05
* AUTHOR : Emanuele Aliberti <ea@iol.it>
* NOTE : This IS a Win32 program, but will fail if the PSX subsystem
* NOTE : is not installed. The PSX subsystem consists of two more
* NOTE : files: PSXSS.EXE, PSXDLL.DLL.
* WARNING : If you use this program under a real NT descendant, be
* WARNING : sure to have disabled the PSX subsystem.
* --------------------------------------------------------------------
*
* 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.
*
* --------------------------------------------------------------------
* 2002-03-16 EA Today it actually compiled.
*/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#define NTOS_MODE_USER
#include <ntos.h>
#include <psx/lpcproto.h>
#include "vt100.h"
#include "csrterm.h"
/*** OPTIONS *********************************************************/
#define PRIVATE static
#define INPUT_QUEUE_SIZE 32
#ifdef NDEBUG
#define TRACE
#else
#define TRACE OutputDebugString(__FUNCTION__)
#endif
/*** GLOBALS *********************************************************/
PRIVATE LPCSTR MyName = "CSRTERM";
PRIVATE CSRTERM_SESSION Session =
{
0, //Identifier
{ //ServerPort
{0,0,NULL},
L"\\"PSX_NS_SUBSYSTEM_DIRECTORY_NAME"\\"PSX_NS_SESSIONAPI_PORT_NAME,
INVALID_HANDLE_VALUE
}
};
/*** PRIVATE FUNCTIONS ***********************************************/
VOID STDCALL Debug_Print (LPCSTR Format, ...)
{
CHAR Buffer [512];
va_list ArgumentPointer;
va_start(ArgumentPointer, Format);
vsprintf(Buffer, Format, ArgumentPointer);
va_end(ArgumentPointer);
OutputDebugStringA (Buffer);
}
/**********************************************************************
* OutPort/2 PRIVATE
*
* DESCRIPTION
* Notify to PSXSS that input data is ready by sending a
* software interrupt on the \POSIX+\SessionPort port.
*/
PRIVATE DWORD STDCALL OutPort (PCHAR Buffer, ULONG Size)
{
NTSTATUS Status;
PSX_TERMINAL_READ TerminalRead;
TRACE;
if (Size > 0)
{
/* LPC */
TerminalRead.Header.MessageType = LPC_NEW_MESSAGE;
TerminalRead.PsxHeader.Context = PSX_CONNECTION_TYPE_TERMINAL;
TerminalRead.PsxHeader.Procedure = PSX_TERMINAL_INTERRUPT;
/* Terminal I/O */
TerminalRead.Size = Size;
#if 0
RtlCopyMemory (TerminalRead.Buffer, Buffer, Size);
Status = NtRequestWaitReplyPort (
Session.ServerPort.Handle,
& TerminalRead
/* FIXME */
);
#endif
if (!NT_SUCCESS(Status))
{
vtprintf ("%s: %s: NtRequestWaitReplyPort failed with %08x\n",
MyName, __FUNCTION__, Status);
return 0;
}
}
return Size;
}
/**********************************************************************
* ProcessConnectionRequest/1 PRIVATE
*
* DESCRIPTION
* Initialize our data for managing the control connection
* initiated by the PSXSS.EXE process.
*/
PRIVATE NTSTATUS STDCALL ProcessConnectionRequest (PLPC_MAX_MESSAGE Request)
{
PPSX_CONNECT_PORT_DATA ConnectData = (PPSX_CONNECT_PORT_DATA) & Request->Data;
TRACE;
if (PSX_CONNECTION_TYPE_SERVER != ConnectData->ConnectionType)
{
return STATUS_UNSUCCESSFUL;
}
if (PSX_LPC_PROTOCOL_VERSION != ConnectData->Version)
{
return STATUS_UNSUCCESSFUL;
}
Session.SsLinkIsActive = TRUE;
return STATUS_SUCCESS;
}
/**********************************************************************
* ProcessRequest/1 PRIVATE
*
* DESCRIPTION
*
*/
PRIVATE NTSTATUS STDCALL ProcessRequest (PPSX_MAX_MESSAGE Request)
{
TRACE;
/* TODO */
vtprintf("TEST VT-100\n");
return STATUS_SUCCESS;
}
/**********************************************************************
* PsxSessionPortListener/1 PRIVATE
*
* DESCRIPTION
* Manage messages from the PSXSS, that is LPC messages we get
* from the PSXSS process to our \POSIX+\Sessions\P<pid> port.
*
* NOTE
* This function is the thread 's entry point created in
* CreateSessionObiects().
*/
PRIVATE DWORD STDCALL PsxSessionPortListener (LPVOID Arg)
{
NTSTATUS Status;
LPC_TYPE RequestType;
PSX_MAX_MESSAGE Request;
PPSX_MAX_MESSAGE Reply = NULL;
BOOL NullReply = FALSE;
TRACE;
while (TRUE)
{
Reply = NULL;
NullReply = FALSE;
while (!NullReply)
{
Status = NtReplyWaitReceivePort (
Session.Port.Handle,
0,
(PLPC_MESSAGE) Reply,
(PLPC_MESSAGE) & Request
);
if (!NT_SUCCESS(Status))
{
break;
}
RequestType = PORT_MESSAGE_TYPE(Request);
switch (RequestType)
{
case LPC_CONNECTION_REQUEST:
ProcessConnectionRequest ((PLPC_MAX_MESSAGE) & Request);
NullReply = TRUE;
continue;
case LPC_CLIENT_DIED:
case LPC_PORT_CLOSED:
case LPC_DEBUG_EVENT:
case LPC_ERROR_EVENT:
case LPC_EXCEPTION:
NullReply = TRUE;
continue;
default:
if (RequestType != LPC_REQUEST)
{
NullReply = TRUE;
continue;
}
}
Reply = & Request;
Reply->PsxHeader.Status = ProcessRequest (& Request);
NullReply = FALSE;
}
if ((STATUS_INVALID_HANDLE == Status) ||
(STATUS_OBJECT_TYPE_MISMATCH == Status))
{
break;
}
}
Session.SsLinkIsActive = FALSE;
TerminateThread (GetCurrentThread(), Status);
}
/**********************************************************************
* CreateSessionObiects/1 PRIVATE
*
* DESCRIPTION
* Create the session objects which are mananged by our side:
*
* \POSIX+\Sessions\P<pid>
* \POSIX+\Sessions\D<pid>
*/
PRIVATE NTSTATUS STDCALL CreateSessionObjects (DWORD Pid)
{
NTSTATUS Status;
ULONG Id = 0;
OBJECT_ATTRIBUTES Oa;
LARGE_INTEGER SectionSize = {PSX_TERMINAL_SECTION_SIZE,0};
TRACE;
/* Critical section */
Status = RtlInitializeCriticalSection (& Session.Lock);
if (!NT_SUCCESS(Status))
{
vtprintf (
"%s: %s: RtlInitializeCriticalSection failed with %08x\n",
MyName, __FUNCTION__, Status);
return Status;
}
/* Port and port management thread */
swprintf (
Session.Port.NameBuffer,
PSX_NS_SESSION_PORT_TEMPLATE,
PSX_NS_SUBSYSTEM_DIRECTORY_NAME,
PSX_NS_SESSION_DIRECTORY_NAME,
Pid
);
OutputDebugStringW(Session.Port.NameBuffer);
RtlInitUnicodeString (& Session.Port.Name, Session.Port.NameBuffer);
InitializeObjectAttributes (& Oa, & Session.Port.Name, 0, NULL, NULL);
Status = NtCreatePort (& Session.Port.Handle, & Oa, 0, 0, 0x10000);
if (!NT_SUCCESS(Status))
{
RtlDeleteCriticalSection (& Session.Lock);
vtprintf ("%s: %s: NtCreatePort failed with %08x\n",
MyName, __FUNCTION__, Status);
return Status;
}
Session.Port.Thread.Handle =
CreateThread (
NULL,
0,
PsxSessionPortListener,
0,
CREATE_SUSPENDED,
& Session.Port.Thread.Id
);
if ((HANDLE) NULL == Session.Port.Thread.Handle)
{
Status = (NTSTATUS) GetLastError();
NtClose (Session.Port.Handle);
RtlDeleteCriticalSection (& Session.Lock);
vtprintf ("%s: %s: CreateThread failed with %d\n",
MyName, __FUNCTION__, Status);
return Status;
}
/* Section */
swprintf (
Session.Section.NameBuffer,
PSX_NS_SESSION_DATA_TEMPLATE,
PSX_NS_SUBSYSTEM_DIRECTORY_NAME,
PSX_NS_SESSION_DIRECTORY_NAME,
Pid
);
OutputDebugStringW(Session.Section.NameBuffer);
RtlInitUnicodeString (& Session.Section.Name, Session.Section.NameBuffer);
InitializeObjectAttributes (& Oa, & Session.Section.Name, 0, 0, 0);
Status = NtCreateSection (
& Session.Section.Handle,
SECTION_ALL_ACCESS, /* DesiredAccess */
& Oa,
& SectionSize,
PAGE_READWRITE, /* Protect 4 */
SEC_COMMIT, /* Attributes */
0 /* FileHandle: 0=pagefile.sys */
);
if (!NT_SUCCESS(Status))
{
NtClose (Session.Port.Handle);
NtTerminateThread (Session.Port.Thread.Handle, Status);
RtlDeleteCriticalSection (& Session.Lock);
vtprintf ("%s: %s: NtCreateSection failed with %08x\n",
MyName, __FUNCTION__, Status);
return Status;
}
Session.Section.BaseAddress = NULL;
Session.Section.ViewSize = SectionSize.u.LowPart;
Status = NtMapViewOfSection (
Session.Section.Handle,
NtCurrentProcess(),
& Session.Section.BaseAddress,
0, /* ZeroBits */
0, /* Commitsize */
0, /* SectionOffset */
& Session.Section.ViewSize,
ViewUnmap,
0, /* AllocationType */
PAGE_READWRITE /* Protect 4 */
);
if (!NT_SUCCESS(Status))
{
NtClose (Session.Port.Handle);
NtTerminateThread (Session.Port.Thread.Handle, Status);
NtClose (Session.Section.Handle);
RtlDeleteCriticalSection (& Session.Lock);
vtprintf ("%s: %s: NtMapViewOfSection failed with %08x\n",
MyName, __FUNCTION__, Status);
return Status;
}
return Status;
}
/**********************************************************************
* CreateTerminalToPsxChannel/0 PRIVATE
*
* DESCRIPTION
*
*/
PRIVATE NTSTATUS STDCALL CreateTerminalToPsxChannel (VOID)
{
PSX_CONNECT_PORT_DATA ConnectData;
ULONG ConnectDataLength = sizeof ConnectData;
SECURITY_QUALITY_OF_SERVICE Sqos;
NTSTATUS Status;
TRACE;
/*
* Initialize the connection data object before
* calling PSXSS.
*/
ConnectData.ConnectionType = PSX_CONNECTION_TYPE_TERMINAL;
ConnectData.Version = PSX_LPC_PROTOCOL_VERSION;
/*
* Try connecting to \POSIX+\SessionPort.
*/
RtlInitUnicodeString (& Session.ServerPort.Name, Session.ServerPort.NameBuffer);
OutputDebugStringW(Session.ServerPort.Name.Buffer);
Status = NtConnectPort (
& Session.ServerPort.Handle,
& Session.ServerPort.Name,
& Sqos,
NULL,
NULL,
0,
& ConnectData,
& ConnectDataLength
);
if (STATUS_SUCCESS != Status)
{
vtprintf ("%s: %s: NtConnectPort failed with %08x\n",
MyName, __FUNCTION__, Status);
return Status;
}
Session.Identifier = ConnectData.PortIdentifier;
return STATUS_SUCCESS;
}
/**********************************************************************
* InitializeSsIoChannel PRIVATE
*
* DESCRIPTION
* Create our objects in the system name space
* (CreateSessionObjects) and then connect to the session port
* (CreateControChannel).
*/
PRIVATE NTSTATUS STDCALL InitializeSsIoChannel (VOID)
{
NTSTATUS Status = STATUS_SUCCESS;
DWORD Pid = GetCurrentProcessId();
TRACE;
Status = CreateSessionObjects (Pid);
if (STATUS_SUCCESS != Status)
{
vtprintf ("%s: %s: CreateSessionObjects failed with %08x\n",
MyName, __FUNCTION__, Status);
return Status;
}
Status = CreateTerminalToPsxChannel ();
if (STATUS_SUCCESS != Status)
{
vtprintf ("%s: %s: CreateTerminalToPsxChannel failed with %08x\n",
MyName, __FUNCTION__, Status);
return Status;
}
return STATUS_SUCCESS;
}
/**********************************************************************
* PsxCreateLeaderProcess/1 PRIVATE
*
* DESCRIPTION
* Create a new PSXSS process.
*/
PRIVATE NTSTATUS STDCALL PsxCreateLeaderProcess (char * Command)
{
NTSTATUS Status;
TRACE;
if (NULL == Command)
{
Command = "sh";
}
/* TODO: request PSXSS to init the process slot */
vtprintf ("%s: %s: calling CSRSS not implemented!", MyName, __FUNCTION__);
return STATUS_SUCCESS;
}
/**********************************************************************
* PrintInformationProcess/0
*
* DESCRIPTION
*/
PRIVATE VOID STDCALL PrintInformationProcess (VOID)
{
TRACE;
vtputs ("Leader:");
vtprintf (" UniqueProcess %08x\n", Session.Client.UniqueProcess);
vtprintf (" UniqueThread %08x\n", Session.Client.UniqueThread);
}
/**********************************************************************
* PostMortem/0
*
* DESCRIPTION
*/
PRIVATE INT STDCALL PostMortem (VOID)
{
DWORD ExitCode;
TRACE;
PrintInformationProcess ();
if (TRUE == GetExitCodeProcess (Session.Client.UniqueProcess, & ExitCode))
{
vtprintf (" ExitCode %d\n", ExitCode);
}
return 0;
}
/**********************************************************************
* InputTerminalEmulator/0
*
* DESCRIPTION
* Process user terminal input.
*
* NOTE
* This code is run in the main thread.
*/
PRIVATE BOOL STDCALL InputTerminalEmulator (VOID)
{
HANDLE StandardInput;
INPUT_RECORD InputRecord [INPUT_QUEUE_SIZE];
DWORD NumberOfEventsRead = 0;
INT CurrentEvent;
TRACE;
StandardInput = GetStdHandle (STD_INPUT_HANDLE);
if (INVALID_HANDLE_VALUE == StandardInput)
{
return FALSE;
}
while ((TRUE == Session.SsLinkIsActive) &&
ReadConsoleInput (
StandardInput,
InputRecord,
(sizeof InputRecord) / sizeof (INPUT_RECORD),
& NumberOfEventsRead
))
{
for ( CurrentEvent = 0;
(CurrentEvent < NumberOfEventsRead);
CurrentEvent ++
)
{
switch (InputRecord [CurrentEvent].EventType)
{
case KEY_EVENT:
OutPort (& InputRecord [CurrentEvent].Event.KeyEvent.uChar.AsciiChar, 1);
break;
case MOUSE_EVENT:
/* TODO: send a sequence of move cursor codes */
/* InputRecord [CurrentEvent].Event.MouseEvent; */
break;
case WINDOW_BUFFER_SIZE_EVENT:
/* TODO: send a SIGWINCH signal to the leader process. */
/* InputRecord [CurrentEvent].Event.WindowBufferSizeEvent.dwSize; */
break;
/* Next events should be ignored. */
case MENU_EVENT:
vtprintf ("%s: %s: MENU_EVENT received from CSRSS\n", MyName, __FUNCTION__);
case FOCUS_EVENT:
vtprintf ("%s: %s: FOCUS_EVENT received from CSRSS\n", MyName, __FUNCTION__);
break;
}
}
NumberOfEventsRead = 0;
}
return TRUE;
}
/**********************************************************************
* Startup/1
*
* DESCRIPTION
* Initialize the program.
*/
PRIVATE VOID STDCALL Startup (LPSTR Command)
{
NTSTATUS Status;
DWORD ThreadId;
TRACE;
/* PSX process info */
Session.Client.UniqueProcess = INVALID_HANDLE_VALUE;
Session.Client.UniqueThread = INVALID_HANDLE_VALUE;
/* Initialize the VT-100 emulator */
vtInitVT100 ();
/* Connect to PSXSS */
Status = InitializeSsIoChannel ();
if (!NT_SUCCESS(Status))
{
vtprintf ("%s: failed to connect to PSXSS (Status=%08x)!\n",
MyName, Status);
exit (EXIT_FAILURE);
}
/* Create the leading process for this session */
Status = PsxCreateLeaderProcess (Command);
if (!NT_SUCCESS(Status))
{
vtprintf ("%s: failed to create the PSX process (Status=%08x)!\n",
MyName, Status);
exit (EXIT_FAILURE);
}
}
/**********************************************************************
* Shutdown/0 PRIVATE
*
* DESCRIPTION
* Shutdown the program.
*/
PRIVATE INT STDCALL Shutdown (VOID)
{
TRACE;
/* TODO: try exiting cleanly: close any open resource */
/* TODO: notify PSXSS the session is terminating */
RtlDeleteCriticalSection (& Session.Lock);
return PostMortem ();
}
/**********************************************************************
*
* ENTRY POINT PUBLIC
*
*********************************************************************/
int main (int argc, char * argv [])
{
TRACE;
Startup (argv[1]); /* Initialization */
InputTerminalEmulator (); /* Process user input */
return Shutdown ();
}
/* EOF */

View File

@@ -0,0 +1,53 @@
#ifndef _CSRTERM_H
#define _CSRTERM_H
/* PSX session: CSR terminal emulator side */
#define NAME_BUFFER_SIZE 64
typedef struct _PSXSS_PORT
{
UNICODE_STRING Name;
WCHAR NameBuffer [NAME_BUFFER_SIZE];
HANDLE Handle;
} PSXSS_PORT, * PPSXSS_PORT;
typedef struct _CSRTERM_SESSION_PORT
{
UNICODE_STRING Name;
WCHAR NameBuffer [NAME_BUFFER_SIZE];
HANDLE Handle;
struct {
HANDLE Handle;
DWORD Id;
} Thread;
} CSRTERM_SESSION_PORT;
typedef struct _CSRTERM_SESSION_SECTION
{
UNICODE_STRING Name;
WCHAR NameBuffer [NAME_BUFFER_SIZE];
HANDLE Handle;
ULONG Size;
PVOID BaseAddress;
ULONG ViewSize;
} CSRTERM_SESSION_SECTION;
typedef struct _CSRTERM_SESSION
{
ULONG Identifier; /* PortID for ServerPort in PSXSS */
PSXSS_PORT ServerPort; /* \POSIX+\SessionPort */
CSRTERM_SESSION_PORT Port; /* \POSIX+\Sessions\P<pid> */
CSRTERM_SESSION_SECTION Section; /* \POSIX+\Sessions\D<pid> */
CLIENT_ID Client;
CRITICAL_SECTION Lock;
BOOL SsLinkIsActive;
} CSRTERM_SESSION, * PCSRTERM_SESSION;
#define LOCK_SESSION RtlEnterCriticalSection(& Session.Lock)
#define UNLOCK_SESSION RtlLeaveCriticalSection(& Session.Lock)
#endif /* ndef _CSRTERM_H */

View File

@@ -0,0 +1,38 @@
#include <defines.h>
#include <reactos/resource.h>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
VS_VERSION_INFO VERSIONINFO
FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", RES_STR_COMPANY_NAME
VALUE "FileDescription", "CSR Terminal Emulator for POSIX+\0"
VALUE "FileVersion", RES_STR_FILE_VERSION
VALUE "InternalName", "csrterm\0"
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
VALUE "OriginalFilename", "csrterm.exe\0"
VALUE "ProductName", RES_STR_PRODUCT_NAME
VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View File

@@ -0,0 +1,79 @@
$Id: readme.txt,v 1.1 2002/03/17 22:15:39 ea Exp $
csrterm - a CSR client terminal emulator for the POSIX+ subsystem
SYNOPSYS
csrterm [program]
program program to be run in the terminal; if none is given,
the shell for the current user (W32 session's) is
used.
DESCRIPTION
csrterm emulates a DEC VT-100 terminal (on top of the CSRSS
subsystem, hence the name) which is the controlling terminal
for a process [program] running in the context of the PSX
subsystem. csrterm is a Win32 console application, not a PSX
application. The process created by the PSX subsystem on behalf
of csrterm is not the child of the csrterm instance that
requested it. csrterm simply performs terminal I/O in the CSRSS
world (the W32 world!) for [program].
NOTES
The role of csrterm is creating a session in the PSX subsystem
managing any I/O for it. This is how it works:
1. csrterm creates two well known named objects in the system
name space that will allow the PSX subsystem server to build
the I/O channel for the session. To let the PSX subsystem
process recognize the objects, they contain a numeric suffix
which is the process identifier (n) the system gives to each
instance of csrterm:
\POSIX+\Session\Pn LPC port (IPC rendez-vous object)
\POSIX+\Session\Dn section (shared memory object)
csrterm also creates a new thread to manage the calls though
the LPC port. Port Pn is used by the subsystem to control the
terminal which csrterm emulates.
2. csrterm connects to the PSX subsystem session port
\POSIX+\SessionPort
and asks the subsystem to create a new session.
3. The PSX subsystem, if it decides to accept the request, creates
a new session for that calling instance of csrterm (n), and in
turn connects back to the terminal control port
\POSIX+\Session\Pn
4. When csrterm makes the PSX subsystem create the new session, it
also tells the subsystem what program should be the session
leader process. The PSX subsystem creates that process (the
image file to start must be marked IMAGE_SUBSYSTEM_POSIX_GUI or
IMAGE_SUBSYSTEM_POSIX_CUI).
5. The requested process [program] runs in the context of the
PSX subsystem and performs any terminal I/O via the channel
csrterm and the PSX susbstem created.
REVISIONS
2001-05-05 created
2002-03-03 simplified
AUTHOR
Emanuele Aliberti <ea@iol.it>
CREDITS
John L. Miller (johnmil@cs.cmu.edu, johnmil@jprc.com) code for
a basic VT-100 emulator for Win32 consoles is used to process
tc* calls output.
EOF

1124
posix/apps/csrterm/vt100.c Normal file

File diff suppressed because it is too large Load Diff

320
posix/apps/csrterm/vt100.h Normal file
View File

@@ -0,0 +1,320 @@
/* vt100.h
*
* AUTHOR: John L. Miller, johnmil@cs.cmu.edu / johnmil@jprc.com
* DATE: 8/4/96
*
* Copyright (c) 1996 John L. Miller
*
* Full permission is granted to use, modify and distribute
* this code, provided:
* 1) This comment field is included in its entirity
* 2) No money is charged for any work including or based on
* portions of this code.
*
* If you're a nice person and find this useful, I'd appreciate a
* note letting me know about it. e-mail is usually what spurs me
* on to improve and support software I've written.
*
*/
/* This identifier should be spit back to the computer when a terminal
* id is requested.
*/
#define ANSWERBACK_MESSAGE "vt100"
/* Various terminal-related modes Entries are as follows:
* Identification esc. ID If set, if clear
*/
/* Keyboard action 2 Locked Unlocked */
#define CAPS_MODE 0x00000001
/* Insertion 4 Insert Overwrite */
#define INSERT_MODE 0x00000002
/* Send - Receive 12 Full Echo */
#define FULLDUPLEX_MODE 0x00000004
/* Line feed/New line 20 New line Line feed */
#define NEWLINE_MODE 0x00000008
#define NUM_TERM_ATTR_MODES 9 /* We only track eight '?' escape sequences */
/* Cursor key ?1 Application Cursor */
#define CURSORAPPL_MODE 0x00000010
/* ANSI/VT52 ?2 ANSI VT52 */
#define ANSI_MODE 0x00000020
/* Column ?3 132 80 */
#define COL132_MODE 0x00000040
/* Scrolling ?4 Smooth Jump */
#define SMOOTHSCROLL_MODE 0x00000080
/* Screen ?5 Reverse Normal */
#define REVSCREEN_MODE 0x00000100
/* Origin ?6 Relative Absolute */
#define ORIGINREL_MODE 0x00000200
/* Wraparound ?7 Wrap Truncate */
#define WRAP_MODE 0x00000400
/* Auto key repeat ?8 Repeating No repeat */
#define REPEAT_MODE 0x00000800
/* Print form feed ?18 Yes No */
#define PRINTFF_MODE 0x00001000
/* Print extent ?19 Full screen Scrolling region */
#define PRINTFULLSCR_MODE 0x00002000
/* Keypad application 'Esc =' numeric 'Esc >' */
#define KEYPADNUMERIC_MODE 0x00004000
/* default mode that we start the emulator with */
#define DEFAULT_MODE (NEWLINE_MODE|ANSI_MODE|REPEAT_MODE)
/* This constant is VERY important - the size of the buffer for
* unprocessed vt-100 prints!
*/
#define MAXVTBUFLEN 4096
/* Constants used in place of actual row and column numbers
* for the cursor movement and text erasing and deleting functions.
*/
#define CUR_ROW -999
#define CUR_COL -999
#define ALL_TABS -1999
#define LEFT_EDGE 0
#define RIGHT_EDGE 12000
#define TOP_EDGE 0
#define BOTTOM_EDGE 12000
/* Text attribute definitions; color, font, bold. */
#define NUM_SC_ATTRIBUTES 11
#define SC_RED 0x0001
#define SC_GREEN 0x0002
#define SC_BLUE 0x0004
#define SC_BOLD 0x0010
#define SC_UL 0x0020 /* Underlined */
#define SC_BL 0x0040 /* Blinking */
#define SC_RV 0x0080 /* Reverse video */
#define SC_ASCII 0x0100 /* Normal ASCII (USASCII) */
#define SC_G0 0x0200 /* graphics set G0 */
#define SC_G1 0x0400 /* Graphics set G1 */
#define SC_GRAPHICS 0x0800 /* Good question */
/* forward variable declarations */
extern int termAttrMode[NUM_TERM_ATTR_MODES];
extern int alltermAttrModes;
/* prototypes from vt100.c */
/* functions meant for use outside of the emulator */
int vtputs(char *f);
int vtprintf(char *format, ...);
int vtInitVT100(void);
int vtProcessedTextOut(char *cbuf, int count);
/* Prototype for functions which MUST BE SUPPLIED BY THE BACK END!!! */
/* Back-end specific initialization is performed in this function.
* this is gauranteed to be called before any other requests are made
* of the back end.
*/
/* beInitVT100Terminal() -
*
* This function is called by the VT100 emulator as soon as the
* front-end terminal is initialized. It's responsible for setting
* initial state of the terminal, and initing our many wacky variables.
*/
int beInitVT100Terminal();
/* beAbsoluteCursor -
*
* Given an input row and column, move the cursor to the
* absolute screen coordinates requested. Note that if the
* display window has scrollbars, the column is adjusted
* to take that into account, but the row is not. This allows
* for large scrollback in terminal windows.
*
* ROW must be able to accept CUR_ROW, TOP_EDGE, BOTTOM_EDGE,
* or a row number.
*
* COLUMN must be able to accept CUR_COL, LEFT_EDGE, RIGHT_EDGE,
* or a column number.
*/
int beAbsoluteCursor(int row, int col);
/* beOffsetCursor -
*
* Given an input row and column offset, move the cursor by that
* many positions. For instance, row=0 and column=-1 would move
* the cursor left a single column.
*
* If the cursor can't move the requested amount, results are
* unpredictable.
*/
int beOffsetCursor(int row, int column);
/* beRestoreCursor -
*
* Saved cursor position should be stored in a static
* variable in the back end. This function restores the
* cursor to the position stored in that variable.
*/
int beRestoreCursor(void);
/* beSaveCursor -
*
* The back-end should maintain a static variable with the
* last STORED cursor position in it. This function replaces
* the contents of that variable with the current cursor position.
* The cursor may be restored to this position by using the
* beRestoreCursor function.
*/
int beSaveCursor(void);
/* beGetTextAttributes -
*
* given a pointer to 'fore'ground and 'back'ground ints,
* fill them with a device-independant description of the
* current foreground and background colors, as well as any
* font information in the foreground variable.
*/
int beGetTextAttributes(int *fore, int *back);
/* beSetTextAttributes -
*
* Given a foreground and a background device independant (SC) color and font
* specification, apply these to the display, and save the state in the
* static screen variables.
*
* Note that many font-specific constants (bold/underline/reverse, G0/G1/ASCII)
* are stored ONLY in the foreground specification.
*/
int beSetTextAttributes(int fore, int back);
/* beRawTextOut-
*
* The name of this function is misleading. Given a pointer to
* ascii text and a count of bytes to print, print them to the
* display device. If wrapping is enabled, wrap text. If there is a
* scrolling region set and the cursor is in it,
* scroll only within that region. 'beRawTextOut' means that it's guaranteed
* not to have control sequences within the text.
*/
int beRawTextOut(char *text, int len);
/* beEraseText -
*
* Given a 'from' and a 'to' position in display coordinates,
* this function will fill in all characters between the two
* (inclusive) with spaces. Note that the coordinates do NOT
* specify a rectangle. erasing from (1,1) to (2,2) erases
* all of the first row, and the first two characters of the
* second.
*
* Note that this routine must be able to handle TOP_EDGE,
* BOTTOM_EDGE, LEFT_EDGE, RIGHT_EDGE, CUR_ROW, and CUR_COL
* in the appropriate parameters.
*/
int beEraseText(int rowFrom, int colFrom, int rowTo, int colTo);
/* beDeleteText -
*
* Given a screen cursor 'from' and 'to' position, this function
* will delete all text between the two. Text will be scrolled
* up as appropriate to fill the deleted space. Note that, as in
* beEraseText, the two coordinates don't specify a rectangle, but
* rather a starting position and ending position. In other words,
* deleting from (1,1) to (2,2) should move the text from (2,3) to the
* end of the second row to (1,1), move line 3 up to line 2, and so on.
*
* This function must be able to process TOP_EDGE, BOTTOM_EDGE, LEFT_EDGE,
* RIGHT_EDGE, CUR_ROW, and CUR_COL specifications in the appropriate
* variables as well as regular row and column specifications.
*/
int beDeleteText(int rowFrom, int colFrom, int rowTo, int colTo);
/* beInsertRow -
*
* Given a row number or CUR_ROW, TOP_EDGE or BOTTOM_EDGE as an input,
* this function will scroll all text from the current row down down by one,
* and create a blank row under the cursor.
*/
int beInsertRow(int row);
/* beTransmitText -
*
* Given a pointer to text and byte count, this routine should transmit data
* to whatever host made the request it's responding to. Typically this routin
* should transmit data as though the user had typed it in.
*/
int beTransmitText(char *text, int len);
/* beAdvanceToTab -
*
* This routine will destructively advance the cursor to the
* next set tab, or to the end of the line if there are no
* more tabs to the right of the cursor.
*/
int beAdvanceToTab(void);
/* beClearTab -
*
* This function accepts a constant, and will try to clear tabs
* appropriately. Its argument is either
* ALL_TABS, meaning all tabs should be removed
* CUR_COL, meaning the tab in the current column should be wiped, or
* a column value, meaning if there's a tab there it should be wiped.
*
*/
int beClearTab(int col);
/* beSetScrollingRows -
*
* Given a pair of row numbers, this routine will set the scrolling
* rows to those values. Note that this routine will accept
* TOP_ROW and BOTTOM_ROW as values, meaning that scrolling should
* be enabled for the entire display, regardless of resizing.
*/
int beSetScrollingRows(int fromRow, int toRow);
/* beRingBell -
*
* Ring the system bell once.
*/
int beRingBell(void);
/* beGetTermMode -
*
* Return the value of conTermMode, which is the terminal settings which
* can be queried/set by <esc>[?#h/l.
*/
int beGetTermMode();
/* beSetTermMode -
*
* Set the terminal as requested, assuming we can. Right now we only handle a
* couple of the possible flags, but we store many of the others.
*/
int beSetTermMode(int newMode);

74
posix/include/aio.h Normal file
View File

@@ -0,0 +1,74 @@
/* $Id: aio.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* aio.h
*
* asynchronous input and output (REALTIME). Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __AIO_H_INCLUDED__
#define __AIO_H_INCLUDED__
/* INCLUDES */
#include <fcntl.h>
#include <signal.h>
#include <sys/types.h>
#include <time.h>
/* OBJECTS */
/* TYPES */
typedef struct _tag_aiocb
{
int aio_fildes; /* file descriptor */
off_t aio_offset; /* file offset */
volatile void* aio_buf; /* location of buffer */
size_t aio_nbytes; /* length of transfer */
int aio_reqprio; /* request priority offset */
struct sigevent aio_sigevent; /* signal number and value */
int aio_lio_opcode; /* operation to be performed */
} aiocb;
/* CONSTANTS */
#define AIO_CANCELED 0
#define AIO_NOTCANCELED 1
#define AIO_ALLDONE 2
#define LIO_WAIT 0
#define LIO_NOWAIT 1
#define LIO_READ 2
#define LIO_WRITE 3
#define LIO_NOP 4
/* PROTOTYPES */
int aio_cancel(int, struct aiocb *);
int aio_error(const struct aiocb *);
int aio_fsync(int, struct aiocb *);
int aio_read(struct aiocb *);
ssize_t aio_return(struct aiocb *);
int aio_suspend(const struct aiocb *const[], int, const struct timespec *);
int aio_write(struct aiocb *);
int lio_listio(int, struct aiocb *const[], int, struct sigevent *);
/* MACROS */
#endif /* __AIO_H_INCLUDED__ */
/* EOF */

56
posix/include/arpa/inet.h Normal file
View File

@@ -0,0 +1,56 @@
/* $Id: inet.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
*/
/*
* arpa/inet.h
*
* definitions for internet operations. Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __ARPA_INET_H_INCLUDED__
#define __ARPA_INET_H_INCLUDED__
/* INCLUDES */
#include <netinet/in.h>
#include <inttypes.h>
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
uint32_t htonl(uint32_t hostlong);
uint16_t htons(uint16_t hostshort);
uint32_t ntohl(uint32_t netlong);
uint16_t ntohs(uint16_t netshort);
in_addr_t inet_addr(const char *cp);
in_addr_t inet_lnaof(struct in_addr in);
struct in_addr inet_makeaddr(in_addr_t net, in_addr_t lna);
in_addr_t inet_netof(struct in_addr in);
in_addr_t inet_network(const char *cp);
char *inet_ntoa(struct in_addr in);
/* MACROS */
#endif /* __ARPA_INET_H_INCLUDED__ */
/* EOF */

65
posix/include/assert.h Normal file
View File

@@ -0,0 +1,65 @@
/* $Id: assert.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* assert.h
*
* verify program assertion. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __ASSERT_H_INCLUDED__
#define __ASSERT_H_INCLUDED__
/* types */
/* constants */
/* prototypes */
/* macros */
#ifdef NDEBUG
#define assert(ignore) ((void) 0)
#else /* !NDEBUG */
#define assert(expression) \
#ifdef __PSXDLL__
/* headers for internal usage by psxdll.dll and ReactOS */
#include <psxdll/stdio.h>
#include <psxdll/stdlib.h>
#else /* ! __PSXDLL__ */
/* standard POSIX headers */
#include <stdio.h>
#include <stdlib.h>
#endif
if(!(expression)) \
{ \
fputs("__FILE__, line __LINE__: assertion \"expression\" failed\n", stderr); \
abort(); \
}
#endif /* NDEBUG */
#endif /* __ASSERT_H_INCLUDED__ */
/* EOF */

63
posix/include/cpio.h Normal file
View File

@@ -0,0 +1,63 @@
/* $Id: cpio.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* cpio.h
*
* cpio archive values. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __CPIO_H_INCLUDED__
#define __CPIO_H_INCLUDED__
/* INCLUDES */
/* TYPES */
/* CONSTANTS */
#define C_IRUSR (0000400) /* read by owner */
#define C_IWUSR (0000200) /* write by owner */
#define C_IXUSR (0000100) /* execute by owner */
#define C_IRGRP (0000040) /* read by group */
#define C_IWGRP (0000020) /* write by group */
#define C_IXGRP (0000010) /* execute by group */
#define C_IROTH (0000004) /* read by others */
#define C_IWOTH (0000002) /* write by others */
#define C_IXOTH (0000001) /* execute by others */
#define C_ISUID (0004000) /* set user ID */
#define C_ISGID (0002000) /* set group ID */
#define C_ISVTX (0001000) /* on directories, restricted deletion flag */
#define C_ISDIR (0040000) /* directory */
#define C_ISFIFO (0010000) /* FIFO */
#define C_ISREG (0100000) /* regular file */
#define C_ISBLK (0060000) /* block special */
#define C_ISCHR (0020000) /* character special */
#define C_ISCTG (0110000) /* reserved */
#define C_ISLNK (0120000) /* symbolic link */
#define C_ISSOCK (0140000) /* socket */
#define MAGIC "070707"
/* PROTOTYPES */
/* MACROS */
#endif /* __CPIO_H_INCLUDED__ */
/* EOF */

61
posix/include/ctype.h Normal file
View File

@@ -0,0 +1,61 @@
/* $Id: ctype.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* ctype.h
*
* character types. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __CTYPE_H_INCLUDED__
#define __CTYPE_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
int isalnum(int);
int isalpha(int);
int isascii(int);
int iscntrl(int);
int isdigit(int);
int isgraph(int);
int islower(int);
int isprint(int);
int ispunct(int);
int isspace(int);
int isupper(int);
int isxdigit(int);
int toascii(int);
int tolower(int);
int toupper(int);
/* MACROS */
/* FIXME: the standard isn't clear about these */
#define _toupper(c) (toupper(c))
#define _tolower(c) (tolower(c))
#endif /* __CTYPE_H_INCLUDED__ */
/* EOF */

71
posix/include/dirent.h Normal file
View File

@@ -0,0 +1,71 @@
/* $Id: dirent.h,v 1.3 2002/03/22 01:26:28 hyperion Exp $
*/
/*
* dirent.h
*
* format of directory entries. Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __DIRENT_H_INCLUDED__
#define __DIRENT_H_INCLUDED__
/* INCLUDES */
#include <sys/types.h>
#include <stddef.h>
#include <limits.h>
/* TYPES */
typedef void DIR;
struct dirent
{
ino_t d_ino; /* file serial number */
char d_name[NAME_MAX + 1]; /* name of entry */
};
/* for Unicode filenames */
struct _Wdirent
{
ino_t d_ino; /* file serial number */
wchar_t d_name[NAME_MAX + 1]; /* name of entry */
};
/* CONSTANTS */
/* PROTOTYPES */
int closedir(DIR *);
DIR *opendir(const char *);
struct dirent *readdir(DIR *);
int readdir_r(DIR *, struct dirent *, struct dirent **);
void rewinddir(DIR *);
void seekdir(DIR *, long int);
long int telldir(DIR *);
/* for Unicode filenames */
DIR *_Wopendir(const wchar_t *);
struct _Wdirent *_Wreaddir(DIR *);
int _Wreaddir_r(DIR *, struct _Wdirent *, struct _Wdirent **);
/* MACROS */
#endif /* __DIRENT_H_INCLUDED__ */
/* EOF */

58
posix/include/dlfcn.h Normal file
View File

@@ -0,0 +1,58 @@
/* $Id: dlfcn.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* dlfcn.h
*
* dynamic linking. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __DLFCN_H_INCLUDED__
#define __DLFCN_H_INCLUDED__
/* INCLUDES */
/* TYPES */
/* CONSTANTS */
#define RTLD_LAZY (0x00000000) /* Relocations are performed at an \
implementation-dependent time. */
#define RTLD_NOW (0x00000001) /* Relocations are performed when \
the object is loaded. */
#define RTLD_GLOBAL (0x00000010) /* All symbols are available for \
relocation processing of other \
modules. */
#define RTLD_LOCAL (0x00000020) /* All symbols are not made available \
for relocation processing by other \
modules. */
#define RTLD_NEXT ((void *)(-1))
/* PROTOTYPES */
void *dlopen(const char *, int);
void *dlsym(void *, const char *);
int dlclose(void *);
char *dlerror(void);
/* MACROS */
#endif /* __DLFCN_H_INCLUDED__ */
/* EOF */

131
posix/include/errno.h Normal file
View File

@@ -0,0 +1,131 @@
/* $Id: errno.h,v 1.3 2002/03/22 01:26:28 hyperion Exp $
*/
/*
* errno.h
*
* system error numbers. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __ERRNO_H_INCLUDED__
#define __ERRNO_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* errors from 0 to 42 are the same as in Microsoft POSIX */
#define EZERO ( 0) /* No error. */
#define EPERM ( 1) /* Operation not permitted. */
#define ENOENT ( 2) /* No such file or directory. */
#define ESRCH ( 3) /* No such process. */
#define EINTR ( 4) /* Interrupted function. */
#define EIO ( 5) /* I/O error. */
#define ENXIO ( 6) /* No such device or address. */
#define E2BIG ( 7) /* Argument list too long. */
#define ENOEXEC ( 8) /* Executable file format error. */
#define EBADF ( 9) /* Bad file descriptor. */
#define ECHILD ( 10) /* No child processes. */
#define EAGAIN ( 11) /* Resource unavailable, try again */
#define ENOMEM ( 12) /* Not enough space. */
#define EACCES ( 13) /* Permission denied. */
#define EFAULT ( 14) /* Bad address. */
#define ENOTBLK ( 15) /* Reserved. */
#define EBUSY ( 16) /* Device or resource busy. */
#define EEXIST ( 17) /* File exists. */
#define EXDEV ( 18) /* Cross-device link. */
#define ENODEV ( 19) /* No such device. */
#define ENOTDIR ( 20) /* Not a directory. */
#define EISDIR ( 21) /* Is a directory. */
#define EINVAL ( 22) /* Invalid argument. */
#define ENFILE ( 23) /* Too many files open in system. */
#define EMFILE ( 24) /* Too many open files. */
#define ENOTTY ( 25) /* Inappropriate I/O control operation. */
#define ETXTBSY ( 26) /* Text file busy. */
#define EFBIG ( 27) /* File too large. */
#define ENOSPC ( 28) /* No space left on device. */
#define ESPIPE ( 29) /* Invalid seek. */
#define EROFS ( 30) /* Read-only file system. */
#define EMLINK ( 31) /* Too many links. */
#define EPIPE ( 32) /* Broken pipe. */
#define EDOM ( 33) /* Mathematics argument out of domain of function. */
#define ERANGE ( 34) /* Result too large. */
#define EUCLEAN ( 35) /* Reserved. */
#define EDEADLK ( 36) /* Resource deadlock would occur. */
#define UNKNOWN ( 37) /* Reserved. */
#define ENAMETOOLONG ( 38) /* Filename too long. */
#define ENOLCK ( 39) /* No locks available. */
#define ENOSYS ( 40) /* Function not supported. */
#define ENOTEMPTY ( 41) /* Directory not empty. */
#define EILSEQ ( 42) /* Illegal byte sequence. */
/* from this point, constants are in no particular order */
#define ENODATA ( 44) /* No message is available on the STREAM head read queue. */
#define ENOSR ( 45) /* No STREAM resources. */
#define ENOSTR ( 46) /* Not a STREAM. */
#define ECANCELED ( 47) /* Operation canceled. */
#define ENOBUFS ( 48) /* No buffer space available. */
#define EOVERFLOW ( 49) /* Value too large to be stored in data type. */
#define ENOTSUP ( 50) /* Not supported. */
#define EADDRINUSE ( 51) /* Address in use. */
#define EADDRNOTAVAIL ( 52) /* Address not available. */
#define EAFNOSUPPORT ( 53) /* Address family not supported. */
#define ECONNABORTED ( 54) /* Connection aborted. */
#define ECONNREFUSED ( 55) /* Connection refused. */
#define ECONNRESET ( 56) /* Connection reset. */
#define EALREADY ( 57) /* Connection already in progress. */
#define EDESTADDRREQ ( 58) /* Destination address required. */
#define EHOSTUNREACH ( 59) /* Host is unreachable. */
#define EISCONN ( 60) /* Socket is connected. */
#define ENETDOWN ( 61) /* Network is down. */
#define ENETUNREACH ( 62) /* Network unreachable. */
#define ENOPROTOOPT ( 63) /* Protocol not available. */
#define ENOTCONN ( 64) /* The socket is not connected. */
#define ENOTSOCK ( 65) /* Not a socket. */
#define EPROTO ( 66) /* Protocol error. */
#define EPROTONOSUPPORT ( 67) /* Protocol not supported. */
#define EPROTOTYPE ( 68) /* Socket type not supported. */
#define EOPNOTSUPP ( 69) /* Operation not supported on socket. */
#define ETIMEDOUT ( 70) /* Connection timed out. */
#define EINPROGRESS ( 71) /* Operation in progress. */
#define EBADMSG ( 72) /* Bad message. */
#define EMSGSIZE ( 73) /* Message too large. */
#define ENOMSG ( 74) /* No message of the desired type. */
#define EDQUOT ( 75) /* Reserved. */
#define EIDRM ( 76) /* Identifier removed. */
#define ELOOP ( 77) /* Too many levels of symbolic links. */
#define EMULTIHOP ( 78) /* Reserved. */
#define ENOLINK ( 79) /* Reserved. */
#define ESTALE ( 80) /* Reserved. */
#define ETIME ( 81) /* Streamioctl() timeout. */
#define EWOULDBLOCK ( 82) /* Operation would block */
#define EDEADLOCK EDEADLK /* Resource deadlock avoided */
/* PROTOTYPES */
int * __PdxGetThreadErrNum(void); /* returns a pointer to the current thread's errno */
/* MACROS */
#define errno (*__PdxGetThreadErrNum())
#endif /* __ERRNO_H_INCLUDED__ */
/* EOF */

149
posix/include/fcntl.h Normal file
View File

@@ -0,0 +1,149 @@
/* $Id: fcntl.h,v 1.4 2002/03/22 01:26:28 hyperion Exp $
*/
/*
* fcntl.h
*
* file control options. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __FCNTL_H_INCLUDED__
#define __FCNTL_H_INCLUDED__
/* INCLUDES */
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
/* OBJECTS */
/* TYPES */
/*
the structure flock describes a file lock
*/
struct flock
{
short l_type; /* type of lock; F_RDLCK, F_WRLCK, F_UNLCK */
short l_whence; /* flag for starting offset */
off_t l_start; /* relative offset in bytes */
off_t l_len; /* size; if 0 then until EOF */
pid_t l_pid; /* process ID of the process holding the lock;
returned with F_GETLK */
};
/* CONSTANTS */
/*
values for cmd used by fcntl()
*/
enum __fcntl_cmd
{
F_DUPFD, /* duplicate file descriptor */
F_GETFD, /* get file descriptor flags */
F_GETLK, /* get record locking information */
F_SETFD, /* set file descriptor flags */
F_GETFL, /* get file status flags and file access modes */
F_SETFL, /* set file status flags */
F_SETLK, /* set record locking information */
F_SETLKW, /* set record locking information; wait if blocked */
/* ReactOS-specific */
F_NEWFD, /* create new file descriptor */
F_DELFD, /* delete file descriptor */
F_GETALL, /* get a copy of the internal descriptor object */
F_SETALL, /* initialize internal descriptor object */
F_GETXP, /* get file descriptor extra data pointer */
F_SETXP, /* set file descriptor extra data pointer */
F_GETXS, /* get file descriptor extra data size */
F_SETXS, /* set file descriptor extra data size */
F_GETFH, /* get file handle */
F_SETFH /* set file handle */
};
/*
file descriptor flags used for fcntl()
*/
/* Close the file descriptor upon execution of an exec family function. */
#define FD_CLOEXEC (0x00000001)
/*
values for l_type used for record locking with fcntl()
*/
/* Shared or read lock. */
#define F_RDLCK (1)
/* Unlock. */
#define F_UNLCK (2)
/* Exclusive or write lock. */
#define F_WRLCK (3)
/*
file flags used for open()
*/
/* Create file if it does not exist. */
#define O_CREAT (0x00000100)
/* Truncate flag. */
#define O_TRUNC (0x00000200)
/* Exclusive use flag. */
#define O_EXCL (0x00000400)
/* Do not assign controlling terminal. */
#define O_NOCTTY (0x00000800)
/* ReactOS-specific */
/* File must be a directory */
#define _O_DIRFILE (0x00100000)
/*
file status flags used for open() and fcntl()
*/
/* Set append mode. */
#define O_APPEND (0x00000008)
/* Non-blocking mode. */
#define O_NONBLOCK (0x00001000)
/* Write according to synchronised I/O data integrity completion. */
#define O_DSYNC (0x00002000)
/* Synchronised read I/O operations. */
#define O_RSYNC (0x00004000)
/* Write according to synchronised I/O file integrity completion. */
#define O_SYNC (0x00008000)
/*
file access modes used for open() and fcntl()
*/
/* Open for reading only. */
#define O_RDONLY (0x00000000)
/* Open for writing only. */
#define O_WRONLY (0x00000001)
/* Open for reading and writing. */
#define O_RDWR (0x00000002)
/*
mask for use with file access modes
*/
#define O_ACCMODE (0x00000007)
/* PROTOTYPES */
int creat(const char *, mode_t);
int fcntl(int, int, ...);
int open(const char *, int, ...);
int _Wcreat(const wchar_t *, mode_t);
int _Wopen(const wchar_t *, int, ...);
/* MACROS */
#endif /* __FCNTL_H_INCLUDED__ */
/* EOF */

93
posix/include/fmtmsg.h Normal file
View File

@@ -0,0 +1,93 @@
/* $Id: fmtmsg.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* fmtmsg.h
*
* message display structures. Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __FMTMSG_H_INCLUDED__
#define __FMTMSG_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* Major Classifications */
/* NOTE: these are unique values, not flags. Their bits can overlap, but
cannot overlap with those of other categories */
#define MM_HARD (0x00000001) /* Source of the condition is hardware. */
#define MM_SOFT (0x00000002) /* Source of the condition is software. */
#define MM_FIRM (0x00000003) /* Source of the condition is firmware. */
/* Message Source Subclassifications */
/* NOTE: these are unique values, not flags. Their bits can overlap, but
cannot overlap with those of other categories */
#define MM_APPL (0x00000010) /* Condition detected by application. */
#define MM_UTIL (0x00000020) /* Condition detected by utility. */
#define MM_OPSYS (0x00000030) /* Condition detected by operating system. */
/* Status Subclassifications */
/* NOTE: these are unique values, not flags. Their bits can overlap, but
cannot overlap with those of other categories */
#define MM_RECOVER (0x00000100) /* Recoverable error. */
#define MM_NRECOV (0x00000200) /* Non-recoverable error. */
/* Display Subclassifications */
/* NOTE: these, unlike other classification constants, are flags. Their
bits must be distinct */
#define MM_PRINT (0x00001000) /* Display message on standard error. */
#define MM_CONSOLE (0x00002000) /* Display message on system console. */
/* Identifiers for the levels of severity */
#define MM_NOSEV (0) /* No severity level provided for the message. */
#define MM_INFO (1) /* Informative message. */
#define MM_WARNING (2) /* Application has detected unusual non-error \
condition. */
#define MM_ERROR (3) /* Application has encountered a non-fatal fault. */
#define MM_HALT (4) /* Error causing application to halt. */
/* Null values and identifiers */
#define MM_NULLLBL ((char *)0) /* Null label */
#define MM_NULLSEV (0) /* Null severity */
#define MM_NULLMC (0L) /* Null class */
#define MM_NULLTXT ((char *)0) /* Null text */
#define MM_NULLACT ((char *)0) /* Null action */
#define MM_NULLTAG ((char *)0) /* Null tag */
/* Return values */
#define MM_OK ( 0) /* The function succeeded. */
#define MM_NOTOK (-1) /* The function failed completely. */
#define MM_NOMSG (-2) /* The function was unable to generate a message on \
standard error, but otherwise succeeded. */
#define MM_NOCON (-3) /* The function was unable to generate a console \
message, but otherwise succeeded. */
/* PROTOTYPES */
int fmtmsg(long, const char*, int, const char*, const char*, const char*);
/* MACROS */
#endif /* __FMTMSG_H_INCLUDED__ */
/* EOF */

66
posix/include/fnmatch.h Normal file
View File

@@ -0,0 +1,66 @@
/* $Id: fnmatch.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* fnmatch.h
*
* filename-matching types. Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __FNMATCH_H_INCLUDED__
#define __FNMATCH_H_INCLUDED__
/* INCLUDES */
#ifdef __PSXDLL__
/* headers for internal usage by psxdll.dll and ReactOS */
#else /* ! __PSXDLL__ */
/* standard POSIX headers */
#endif
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* Flags */
#define FNM_PATHNAME (0x00000001) /* Slash in string only matches slash \
in pattern. */
#define FNM_PERIOD (0x00000002) /* Leading period in string must be \
exactly matched by period in \
pattern. */
#define FNM_NOESCAPE (0x00000004) /* Disable backslash escaping. */
/* Return values */
#define FNM_NOMATCH (1) /* The string does not match the specified \
pattern. */
#define FNM_NOSYS (2) /* The implementation does not support this \
function. */
/* PROTOTYPES */
int fnmatch(const char *, const char *, int);
/* MACROS */
#endif /* __FNMATCH_H_INCLUDED__ */
/* EOF */

73
posix/include/ftw.h Normal file
View File

@@ -0,0 +1,73 @@
/* $Id: ftw.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* ftw.h
*
* file tree traversal. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __FTW_H_INCLUDED__
#define __FTW_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
struct FTW
{
int base;
int level;
};
/* CONSTANTS */
/* Values of the third argument to the application-supplied function
that is passed as the second argument to ftw() and nftw() */
#define FTW_F (1) /* File. */
#define FTW_D (2) /* Directory. */
#define FTW_DNR (3) /* Directory without read permission. */
#define FTW_DP (4) /* Directory with subdirectories visited. */
#define FTW_NS (5) /* Unknown type, stat() failed. */
#define FTW_SL (6) /* Symbolic link. */
#define FTW_SLN (7) /* Symbolic link that names a non-existent file. */
/* Values of the fourth argument to nftw() */
#define FTW_PHYS (0x00000001) /* Physical walk, does not follow symbolic \
links. Otherwise, nftw() will follow \
links but will not walk down any path \
that crosses itself. */
#define FTW_MOUNT (0x00000002) /* The walk will not cross a mount point. */
#define FTW_DEPTH (0x00000004) /* All subdirectories will be visited before \
the directory itself. */
#define FTW_CHDIR (0x00000008) /* The walk will change to each directory \
before reading it. */
/* PROTOTYPES */
int ftw(const char *,
int (*)(const char *, const struct stat *, int), int);
int nftw(const char *, int (*)
(const char *, const struct stat *, int, struct FTW*),
int, int);
/* MACROS */
#endif /* __FTW_H_INCLUDED__ */
/* EOF */

73
posix/include/glob.h Normal file
View File

@@ -0,0 +1,73 @@
/* $Id: glob.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* glob.h
*
* pathname pattern-matching types. Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __GLOB_H_INCLUDED__
#define __GLOB_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
typedef struct __tagglob_t
{
size_t gl_pathc; /* count of paths matched by pattern */
char **gl_pathv; /* pointer to a list of matched pathnames */
size_t gl_offs; /* slots to reserve at the beginning of gl_pathv */
} glob_t;
/* CONSTANTS */
/* Values for the flags argument */
#define GLOB_APPEND (0x00000001) /* Append generated pathnames to \
those previously obtained. */
#define GLOB_DOOFFS (0x00000002) /* Specify how many null pointers to \
add to the beginning of */
#define GLOB_ERR (0x00000004) /* Cause glob() to return on error. */
#define GLOB_MARK (0x00000008) /* Each pathname that is a directory \
that matches pattern has a slash \
appended. */
#define GLOB_NOCHECK (0x00000010) /* If pattern does not match any pathname, \
then return a list consisting of only \
pattern. */
#define GLOB_NOESCAPE (0x00000020) /* Disable backslash escaping. */
#define GLOB_NOSORT (0x00000040) /* Do not sort the pathnames returned. */
/* Error return values */
#define GLOB_ABORTED (-1) /* The scan was stopped because GLOB_ERR was set \
or errfunc returned non-zero. */
#define GLOB_NOMATCH (-2) /* The pattern does not match any existing pathname, \
and GLOB_NOCHECK was not set in flags. */
#define GLOB_NOSPACE (-3) /* An attempt to allocate memory failed. */
#define GLOB_NOSYS (-4) /* The implementation does not support this function. */
/* PROTOTYPES */
int glob(const char *, int, int (*)(const char *, int), glob_t *);
void globfree (glob_t *);
/* MACROS */
#endif /* __GLOB_H_INCLUDED__ */
/* EOF */

59
posix/include/grp.h Normal file
View File

@@ -0,0 +1,59 @@
/* $Id: grp.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* grp.h
*
* group structure. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __GRP_H_INCLUDED__
#define __GRP_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
struct group
{
char *gr_name; /* the name of the group */
gid_t gr_gid; /* numerical group ID */
char **gr_mem; /* pointer to a null-terminated array of character
pointers to member names */
};
/* CONSTANTS */
/* PROTOTYPES */
struct group *getgrgid(gid_t);
struct group *getgrnam(const char *);
int getgrgid_r(gid_t, struct group *, char *,
size_t, struct group **);
int getgrnam_r(const char *, struct group *, char *,
size_t , struct group **);
struct group *getgrent(void);
void endgrent(void);
void setgrent(void);
/* MACROS */
#endif /* __GRP_H_INCLUDED__ */
/* EOF */

47
posix/include/iconv.h Normal file
View File

@@ -0,0 +1,47 @@
/* $Id: iconv.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* iconv.h
*
* codeset conversion facility. Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __ICONV_H_INCLUDED__
#define __ICONV_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
typedef (void *) iconv_t;
/* CONSTANTS */
/* PROTOTYPES */
iconv_t iconv_open(const char *, const char *);
size_t iconv(iconv_t, char **, size_t *, char **, size_t *);
int iconv_close(iconv_t);
/* MACROS */
#endif /* __ICONV_H_INCLUDED__ */
/* EOF */

60
posix/include/inttypes.h Normal file
View File

@@ -0,0 +1,60 @@
/* $Id: inttypes.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* inttypes.h
*
* fixed size integral types. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __INTTYPES_H_INCLUDED__
#define __INTTYPES_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* signed */
typedef signed char int8_t; /* 8-bit signed integral type. */
typedef signed short int int16_t; /* 16-bit signed integral type. */
typedef signed long int int32_t; /* 32-bit signed integral type. */
typedef signed long long int64_t; /* 64-bit signed integral type. */
/* unsigned */
typedef unsigned char uint8_t; /* 8-bit unsigned integral type. */
typedef unsigned short int uint16_t; /* 16-bit unsigned integral type. */
typedef unsigned long int uint32_t; /* 32-bit unsigned integral type. */
typedef unsigned long long uint64_t; /* 64-bit unsigned integral type. */
/* pointer-sized */
typedef signed long int intptr_t; /* Signed integral type large enough
to hold any pointer. */
typedef unsigned long int uintptr_t; /* Unsigned integral type large
enough to hold any pointer. */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __INTTYPES_H_INCLUDED__ */
/* EOF */

54
posix/include/iso646.h Normal file
View File

@@ -0,0 +1,54 @@
/* $Id: iso646.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* iso646.h
*
* alternative spellings. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __ISO646_H_INCLUDED__
#define __ISO646_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#define and &&
#define and_eq &=
#define bitand &
#define bitor |
#define compl ~
#define not !
#define not_eq !=
#define or ||
#define or_eq |=
#define xor ^
#define xor_eq ^=
#endif /* __ISO646_H_INCLUDED__ */
/* EOF */

52
posix/include/libgen.h Normal file
View File

@@ -0,0 +1,52 @@
/* $Id: libgen.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* libgen.h
*
* definitions for pattern matching functions. Conforming to the Single
* UNIX(r) Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __LIBGEN_H_INCLUDED__
#define __LIBGEN_H_INCLUDED__
/* INCLUDES */
#include <stddef.h>
/* OBJECTS */
extern char *__loc1; /* LEGACY */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
char *basename(char *);
char *dirname(char *);
char *regcmp(const char *, ...); /* LEGACY */
char *regex(const char *, const char *, ...); /* LEGACY */
wchar_t *_Wbasename(wchar_t *);
wchar_t *_Wdirname(wchar_t *);
/* MACROS */
#endif /* __LIBGEN_H_INCLUDED__ */
/* EOF */

45
posix/include/limits.h Normal file
View File

@@ -0,0 +1,45 @@
/* $Id: limits.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* limits.h
*
* implementation-dependent constants. Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __LIMITS_H_INCLUDED__
#define __LIMITS_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* TODO */
#define OPEN_MAX (256)
/* PROTOTYPES */
/* MACROS */
#endif /* __LIMITS_H_INCLUDED__ */
/* EOF */

65
posix/include/math.h Normal file
View File

@@ -0,0 +1,65 @@
/* $Id: math.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* math.h
*
* mathematical declarations. Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __MATH_H_INCLUDED__
#define __MATH_H_INCLUDED__
/* INCLUDES */
#ifdef __PSXDLL__
/* headers for internal usage by psxdll.dll and ReactOS */
#else /* ! __PSXDLL__ */
/* standard POSIX headers */
#endif
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
#define M_E ((double) 2.7182818285) /* Value of e */
#define M_LOG2E ((double) 1.4426950419) /* Value of log2(e) */
#define M_LOG10E ((double) 0.4342944819) /* Value of log10(e) */
#define M_LN2 ((double)-0.6931471806) /* Value of loge2 */
#define M_LN10 ((double) 2.3025850929) /* Value of loge10 */
#define M_PI ((double) 3.1415926536) /* Value of Pi */
#define M_PI_2 ((double) 1.5707963268) /* Value of Pi/2 */
#define M_PI_4 ((double) 0.7853981634) /* Value of Pi/4 */
#define M_1_PI ((double) 0.3183098862) /* Value of 1/Pi */
#define M_2_PI ((double) 0.6366197724) /* Value of 2/Pi */
#define M_2_SQRTPI ((double) 1.1283791671) /* Value of 2/Sqrt(Pi) */
#define M_SQRT2 ((double) 1.4142135624) /* Value of Sqrt(2) */
#define M_SQRT1_2 ((double) 0.7071067812) /* Value of Sqrt(1/2) */
/* PROTOTYPES */
/* MACROS */
#endif /* __MATH_H_INCLUDED__ */
/* EOF */

View File

@@ -0,0 +1,43 @@
/* $Id: in.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
*/
/*
* netinet/in.h
*
* Internet Protocol family. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __NETINET_IN_H_INCLUDED__
#define __NETINET_IN_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __NETINET_IN_H_INCLUDED__ */
/* EOF */

146
posix/include/psx/debug.h Normal file
View File

@@ -0,0 +1,146 @@
/* $Id: debug.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
*/
/*
* psx/debug.h
*
* debugging utilities
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __PSX_DEBUG_H_INCLUDED__
#define __PSX_DEBUG_H_INCLUDED__
/* INCLUDES */
#ifdef __PSX_DEBUG_TO_STDERR__
#include <stdio.h>
#else /* !defined(__PSX_DEBUG_TO_STDERR__) */
#include <ddk/ntddk.h>
#endif /* defined(__PSX_DEBUG_TO_STDERR__) */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#define __PSX_MODULE__ "psxdll.dll"
#ifndef NDEBUG
#ifdef __PSX_DEBUG_TO_STDERR__
#if 0
#define DEBUGOUT(MODULE,TYPE,ARGS...) \
do{ \
fprintf(stderr,"%s:%s:%s:%d:%s():\n\t",(MODULE),(TYPE),__FILE__,__LINE__,__FUNCTION__); \
fprintf(stderr,ARGS); \
fprintf("\n"); \
} \
while(0)
#endif
#define DEBUGOUT(MODULE,TYPE,ARGS...) \
do{ \
printf("%s:%s:%s:%d:%s():\n\t",(MODULE),(TYPE),__FILE__,__LINE__,__FUNCTION__); \
printf(ARGS); \
printf("\n"); \
} \
while(0)
#else /* !defined(__PSX_DEBUG_TO_STDERR__) */
#define DEBUGOUT(MODULE,TYPE,ARGS...) \
do{ \
DbgPrint("%s:%s:%s:%d:%s():\n\t",(MODULE),(TYPE),__FILE__,__LINE__,__FUNCTION__); \
DbgPrint(ARGS); \
DbgPrint("\n"); \
} \
while(0)
#endif /* defined(__PSX_DEBUG_TO_STDERR__) */
#define DEBUGOUTIF(CONDITION,MODULE,TYPE,ARGS...) \
if((CONDITION)) \
{ \
DEBUGOUT((MODULE),(TYPE),ARGS); \
}
#else /* defined(NDEBUG) */
#define DEBUGOUTIF(c,m,t,args...)
#define DEBUGOUT(m,t,args...)
#endif /* !defined(NDEBUG) */
#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_HINTS__)
#define HINT(args...) DEBUGOUT(__PSX_MODULE__,"HINT",args)
#define HINTIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"HINT",args)
#else
#define HINT(args...)
#define HINTIF(c,args...)
#endif
#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_INFOS__)
#define INFO(args...) DEBUGOUT(__PSX_MODULE__,"INFO",args)
#define INFOIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"INFO",args)
#else
#define INFO(args...)
#define INFOIF(c,args...)
#endif
#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_WARNS__)
#define WARN(args...) DEBUGOUT(__PSX_MODULE__,"WARN",args)
#define WARNIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"WARN",args)
#else
#define WARN(args...)
#define WARNIF(c,args...)
#endif
#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_ERRS__)
#define ERR(args...) DEBUGOUT(__PSX_MODULE__,"ERR",args)
#define ERRIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"ERR",args)
#else
#define ERR(args...)
#define ERRIF(c,args...)
#endif
#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_TODOS__)
#define TODO(args...) DEBUGOUT(__PSX_MODULE__,"TODO",args)
#define TODOIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"TODO",args)
#else
#define TODO(args...)
#define TODOIF(c,args...)
#endif
#if defined(__PSX_DEBUG_WANT_ALL__) || defined(__PSX_DEBUG_WANT_FIXMES__)
#define FIXME(args...) DEBUGOUT(__PSX_MODULE__,"FIXME",args)
#define FIXMEIF(c,args...) DEBUGOUTIF((c),__PSX_MODULE__,"FIXME",args)
#else
#define FIXME(args...)
#define FIXMEIF(c,args...)
#endif
#endif /* __PSX_DEBUG_H_INCLUDED__ */
/* EOF */

View File

@@ -0,0 +1,57 @@
/* $Id: dirent.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
*/
/*
* psx/dirent.h
*
* internal dirent.h
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __PSX_DIRENT_H_INCLUDED__
#define __PSX_DIRENT_H_INCLUDED__
/* INCLUDES */
#include <ddk/ntddk.h>
#include <dirent.h>
#include <psx/safeobj.h>
/* OBJECTS */
/* TYPES */
struct __internal_DIR
{
__magic_t signature; /* signature to verify object's validity across calls */
union __any_dirent{
struct dirent de_ansi;
struct _Wdirent de_unicode;
} ent; /* storage for return buffer of readdir() */
int fildes; /* file descriptor of the directory */
FILE_DIRECTORY_INFORMATION info; /* directory entry information */
WCHAR name[MAX_PATH]; /* filename buffer */
};
/* CONSTANTS */
#define __IDIR_MAGIC MAGIC('I', 'D', 'I', 'R')
/* PROTOTYPES */
/* MACROS */
#endif /* __PSX_DIRENT_H_INCLUDED__ */
/* EOF */

53
posix/include/psx/dlfcn.h Normal file
View File

@@ -0,0 +1,53 @@
/* $Id: dlfcn.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
*/
/*
* psx/dlfcn.h
*
* internal dlfcn.h
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __PSX_DLFCN_H_INCLUDED__
#define __PSX_DLFCN_H_INCLUDED__
/* INCLUDES */
#include <psx/errno.h>
/* OBJECTS */
/* TYPES */
/* internal representation for loaded DLLs */
/* TODO: get rid of this. The handle should be enough, with a proper PE loader */
struct __dlobj
{
int global; /* if non-zero, all the other fields have no meaning */
void *handle; /* pointer to the module mapping */
};
/* CONSTANTS */
/* PROTOTYPES */
void __dl_set_last_error(int);
/* MACROS */
#define __dl_get_reloc_flag(m) ((m) & (RTLD_LAZY | RTLD_NOW))
#define __dl_get_scope_flag(m) ((m) & (RTLD_GLOBAL | RTLD_LOCAL))
#endif /* __PSX_DLFCN_H_INCLUDED__ */
/* EOF */

45
posix/include/psx/errno.h Normal file
View File

@@ -0,0 +1,45 @@
/* $Id: errno.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
*/
/*
* psx/errno.h
*
* internal errno.h
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __PSX_ERRNO_H_INCLUDED__
#define __PSX_ERRNO_H_INCLUDED__
/* INCLUDES */
#include <errno.h>
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#define __status_to_errno(s) (s)
#define __set_errno_from_status(s) (errno = __status_to_errno((s)))
#endif /* __PSX_ERRNO_H_INCLUDED__ */
/* EOF */

View File

@@ -0,0 +1,73 @@
/* $Id: fdtable.h,v 1.3 2002/03/11 20:50:49 hyperion Exp $
*/
/*
* psx/fdtable.h
*
* POSIX+ subsystem file descriptor table data structure
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __PSX_FDTABLE_H_INCLUDED__
#define __PSX_FDTABLE_H_INCLUDED__
/* INCLUDES */
#include <limits.h>
#include <inttypes.h>
#include <stddef.h>
#include <psx/safeobj.h>
/* OBJECTS */
/* TYPES */
typedef struct __tagfildes_t
{
void *FileHandle;
int OpenFlags;
int FdFlags;
size_t ExtraDataSize;
void *ExtraData;
} __fildes_t;
typedef struct __tagfdtable_t
{
__magic_t Signature;
int32_t LowestUnusedFileNo;
int32_t UsedDescriptors;
int32_t AllocatedDescriptors;
uint32_t DescriptorsBitmap[OPEN_MAX / 32];
__fildes_t *Descriptors;
} __fdtable_t;
/* CONSTANTS */
/* PROTOTYPES */
int __fdtable_init(__fdtable_t *);
int __fdtable_free(__fdtable_t *);
int __fdtable_entry_isavail(__fdtable_t *, int);
int __fdtable_entry_nextavail(__fdtable_t *, int);
int __fdtable_entry_add(__fdtable_t *, int, __fildes_t *, __fildes_t **);
int __fdtable_entry_remove(__fdtable_t *, int);
__fildes_t *__fdtable_entry_get(__fdtable_t *, int);
/* MACROS */
#define __FDTABLE_MAGIC MAGIC('F', 'D', 'T', 'B')
#endif /* __PSX_FDTABLE_H_INCLUDED__ */
/* EOF */

View File

@@ -0,0 +1,45 @@
/* $Id: interlock.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
*/
/*
* psx/interlock.h
*
* inter-locked increment/decrement
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __PSX_INTERLOCK_H_INCLUDED__
#define __PSX_INTERLOCK_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
int __interlock_inc(int *);
int __interlock_dec(int *);
int __interlock_add(int *, int);
/* MACROS */
#endif /* __PSX_INTERLOCK_H_INCLUDED__ */
/* EOF */

View File

@@ -0,0 +1,88 @@
/* $Id: lpcproto.h,v 1.3 2002/04/10 21:30:20 ea Exp $
*
* ReactOS POSIX+ Environment Subsystem
* LPC protocol spoken by PSXSS.EXE, PSXDLL.DLL, CSRTERM.EXE.
*/
#ifndef _PSX_LPCPROTO_H
#define _PSX_LPCPROTO_H
#include <napi/lpc.h>
#ifndef PRIVATE
#define PRIVATE static
#endif
/* Protocol version */
#define PSX_LPC_PROTOCOL_VERSION 1
/* POSIX+ system name space */
#define PSX_NS_SUBSYSTEM_DIRECTORY_NAME L"POSIX+"
#define PSX_NS_SESSION_DIRECTORY_NAME L"Sessions"
#define PSX_NS_SYSTEM_DIRECTORY_NAME L"System"
#define PSX_NS_API_PORT_NAME L"ApiPort"
#define PSX_NS_SBAPI_PORT_NAME L"SbApiPort"
#define PSX_NS_SESSIONAPI_PORT_NAME L"SessionPort"
#define PSX_NS_API_PORT_TEMPLATE L"\\%s\\%s"
#define PSX_NS_SESSION_PORT_TEMPLATE L"\\%s\\%s\\P%d"
#define PSX_NS_SESSION_DATA_TEMPLATE L"\\%s\\%s\\D%d"
/* ConnectData protocol */
typedef enum {
PSX_CONNECTION_TYPE_PROCESS,
PSX_CONNECTION_TYPE_TERMINAL,
PSX_CONNECTION_TYPE_SERVER
} PSX_CONNECTION_TYPE;
typedef struct _PSX_CONNECT_PORT_DATA
{
PSX_CONNECTION_TYPE ConnectionType; /* IN OUT */
ULONG Version; /* IN OUT */
ULONG PortIdentifier; /* OUT */
} PSX_CONNECT_PORT_DATA, * PPSX_CONNECT_PORT_DATA;
/* LPC message subsystem-specific header */
typedef struct _PSX_MESSAGE_HEADER
{
WORD Context;
WORD Procedure;
NTSTATUS Status;
} PSX_MESSAGE_HEADER, * PPSX_MESSAGE_HEADER;
typedef PSX_MESSAGE_HEADER PSX_MESSAGE, * PPSX_MESSAGE;
#define PSX_MAX_LPC_DATA_SIZE 128 /* compute it*/
typedef struct _PSX_MAX_MESSAGE
{
LPC_MESSAGE_HEADER Header;
PSX_MESSAGE_HEADER PsxHeader;
BYTE Data [PSX_MAX_LPC_DATA_SIZE];
} PSX_MAX_MESSAGE, * PPSX_MAX_MESSAGE;
/* Terminal I/O */
/* \POSIX+\SessionPort API */
#define PSX_TERMINAL_SECTION_SIZE 65536L
#define PSX_TERMINAL_SECTION_OFFSET 8192L
typedef enum {
PSX_TERMINAL_INTERRUPT,
PSX_TERMINAL_SESSION_STATUS_REQUEST
} PSX_TERMINAL_API;
typedef struct _PSX_TERMINAL_IO
{
LPC_MESSAGE_HEADER Header;
PSX_MESSAGE_HEADER PsxHeader;
ULONG Size;
ULONG Offset;
} PSX_TERMINAL_READ, * PPSX_TERMINAL_READ;
/* System I/O (system calls) */
#include <psx/syscall.h>
#endif /* ndef _PSX_LPCPROTO_H */

112
posix/include/psx/path.h Normal file
View File

@@ -0,0 +1,112 @@
/* $Id: path.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
*/
/*
* psx/path.h
*
* POSIX+ subsystem path functions
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __PSX_PATH_H_INCLUDED__
#define __PSX_PATH_H_INCLUDED__
/* INCLUDES */
#include <ddk/ntddk.h>
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
BOOLEAN
__PdxPosixPathGetNextComponent_U
(
IN UNICODE_STRING PathName,
IN OUT PUNICODE_STRING PathComponent,
OUT PBOOLEAN TrailingDelimiter OPTIONAL
);
BOOLEAN
__PdxPosixPathResolve_U
(
IN UNICODE_STRING PathName,
OUT PUNICODE_STRING ResolvedPathName,
IN WCHAR PathDelimiter OPTIONAL
);
BOOLEAN
__PdxPosixPathGetNextComponent_A
(
IN ANSI_STRING PathName,
IN OUT PANSI_STRING PathComponent,
OUT PBOOLEAN TrailingDelimiter OPTIONAL
);
BOOLEAN
__PdxPosixPathResolve_A
(
IN ANSI_STRING PathName,
OUT PANSI_STRING ResolvedPathName,
IN CHAR PathDelimiter OPTIONAL
);
BOOLEAN
__PdxPosixPathNameToNtPathName
(
IN PWCHAR PosixPath,
OUT PUNICODE_STRING NativePath,
IN PUNICODE_STRING CurDir OPTIONAL,
IN PUNICODE_STRING RootDir OPTIONAL
);
/* MACROS */
/* returns non-zero if the argument is a path delimiter */
#define IS_CHAR_DELIMITER_U(WCH) (((WCH) == L'/') || ((WCH) == L'\\'))
#define IS_CHAR_DELIMITER_A(CH) (((CH) == '/') || ((CH) == '\\'))
/* returns non-zero if the argument is an empty path component */
#define IS_COMPONENT_EMPTY_U(WCOMPONENT) (WCOMPONENT.Length == 0)
#define IS_COMPONENT_EMPTY_A(COMPONENT) (COMPONENT.Length == 0)
/* returns non-zero if the argument is "." */
#define IS_COMPONENT_DOT_U(WCOMPONENT) \
((WCOMPONENT.Length == sizeof(WCHAR)) && (WCOMPONENT.Buffer[0] == L'.'))
#define IS_COMPONENT_DOT_A(COMPONENT) \
((COMPONENT.Length == 1) && (COMPONENT.Buffer[0] == '.'))
/* returns non-zero if the argument is ".." */
#define IS_COMPONENT_DOTDOT_U(WCOMPONENT) \
( \
(WCOMPONENT.Length == (sizeof(WCHAR) * 2)) && \
(WCOMPONENT.Buffer[0] == L'.') && \
(WCOMPONENT.Buffer[1] == L'.') \
)
#define IS_COMPONENT_DOTDOT_A(COMPONENT) \
( \
(COMPONENT.Length == 2) && \
(COMPONENT.Buffer[0] == '.') && \
(COMPONENT.Buffer[1] == '.') \
)
#endif /* __PSX_PATH_H_INCLUDED__ */
/* EOF */

115
posix/include/psx/pdata.h Normal file
View File

@@ -0,0 +1,115 @@
/* $Id: pdata.h,v 1.5 2002/03/11 20:51:16 hyperion Exp $
*/
/*
* psx/pdata.h
*
* POSIX+ subsystem process environment data structure
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __PSX_PDATA_H_INCLUDED__
#define __PSX_PDATA_H_INCLUDED__
/* INCLUDES */
#include <ddk/ntddk.h>
#include <ntdll/rtl.h>
#include <limits.h>
#include <psx/fdtable.h>
/* OBJECTS */
/* TYPES */
typedef struct __tagPDX_PDATA
{
BOOL Spawned; /* TRUE if process has been created through __PdxSpawnPosixProcess() */
int ArgCount; /* count of arguments passed to exec() */
char **ArgVect; /* array of arguments passed to exec() */
char ***Environment; /* pointer to user-provided environ variable */
UNICODE_STRING NativePathBuffer; /* static buffer used by low-level calls for pathname conversions */
UNICODE_STRING CurDir; /* current working directory */
UNICODE_STRING RootPath; /* NT path to the process's root directory */
HANDLE RootHandle; /* handle to the process's root directory */
__fdtable_t FdTable; /* file descriptors table */
} __PDX_PDATA, * __PPDX_PDATA;
/* serialized process data block, used by __PdxSpawnPosixProcess() and __PdxExecThunk().
The layout of buffers inside the Buffer byte array is as following:
ArgVect[0] + null byte
ArgVect[1] + null byte
...
ArgVect[ArgCount - 1] + null byte
Environment[0] + null byte
Environment[1] + null byte
...
Environment[n - 1] + null byte (NOTE: the value of n is stored in ProcessData.Environment)
CurDir.Buffer
RootPath.Buffer
FdTable.Descriptors[0]
FdTable.Descriptors[1]
...
FdTable.Descriptors[FdTable.AllocatedDescriptors - 1]
FdTable.Descriptors[x].ExtraData
FdTable.Descriptors[y].ExtraData
...
padding for page boundary alignment
*/
typedef struct __tagPDX_SERIALIZED_PDATA
{
__PDX_PDATA ProcessData;
ULONG AllocSize;
BYTE Buffer[1];
} __PDX_SERIALIZED_PDATA, *__PPDX_SERIALIZED_PDATA;
/* CONSTANTS */
/* PROTOTYPES */
NTSTATUS STDCALL __PdxSerializeProcessData(IN __PPDX_PDATA, OUT __PPDX_SERIALIZED_PDATA *);
NTSTATUS STDCALL __PdxUnserializeProcessData(IN OUT __PPDX_SERIALIZED_PDATA *, OUT __PPDX_PDATA * OPTIONAL);
NTSTATUS
STDCALL
__PdxProcessDataToProcessParameters
(
OUT PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
IN __PPDX_PDATA ProcessData,
IN PUNICODE_STRING ImageFile
);
/* MACROS */
#define __PdxAcquirePdataLock() (RtlAcquirePebLock())
#define __PdxReleasePdataLock() (RtlReleasePebLock())
#define __PdxSetProcessData(PPDATA) ((void)((NtCurrentPeb()->SubSystemData) = (PPDATA)))
#define __PdxGetProcessData() ((__PPDX_PDATA)(&(NtCurrentPeb()->SubSystemData)))
#define __PdxGetNativePathBuffer() ((PUNICODE_STRING)(&(__PdxGetProcessData()->NativePathBuffer)))
#define __PdxGetCurDir() ((PUNICODE_STRING)(&(__PdxGetProcessData()->CurDir)))
#define __PdxGetRootPath() ((PUNICODE_STRING)(&(__PdxGetProcessData()->RootPath)))
#define __PdxGetRootHandle() ((HANDLE)(__PdxGetProcessData()->RootHandle))
#define __PdxGetFdTable() ((__fdtable_t *)(__PdxGetProcessData()->FdTable))
#define __PdxSetNativePathBuffer(BUF) ((void)((__PdxGetProcessData()->NativePathBuffer) = (BUF)))
#define __PdxSetCurDir(CURDIR) ((void)((__PdxGetProcessData()->CurDir) = (CURDIR)))
#define __PdxSetRootPath(ROOTPATH) ((void)((__PdxGetProcessData()->RootPath) = (ROOTPATH)))
#define __PdxSetRootHandle(ROOTHANDLE) ((void)((__PdxGetProcessData()->RootHandle) = (ROOTHANDLE)))
#define __PdxSetFdTable(FDTABLE) ((void)((__PdxGetProcessData()->FdTable) = (FDTABLE)))
#endif /* __PSX_PDATA_H_INCLUDED__ */
/* EOF */

View File

@@ -0,0 +1,61 @@
/* $Id: pthread.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
*/
/*
* psx/pthread.h
*
* internal pthread.h
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __PSX_PTHREAD_H_INCLUDED__
#define __PSX_PTHREAD_H_INCLUDED__
/* INCLUDES */
#include <psx/safeobj.h>
/* OBJECTS */
/* TYPES */
struct __mutexattr
{
__magic_t signature;
int pshared;
int protocol;
int type;
};
struct __mutex
{
__magic_t signature;
void * handle;
int protocol;
int type;
};
/* CONSTANTS */
#define __PTHREAD_MUTEX_MAGIC (MAGIC('P', 'T', 'M', 'X'))
#define __PTHREAD_MUTEX_ATTR_MAGIC (MAGIC('P', 'T', 'M', 'A'))
/* PROTOTYPES */
/* MACROS */
#endif /* __PSX_PTHREAD_H_INCLUDED__ */
/* EOF */

View File

@@ -0,0 +1,59 @@
/* $Id: safeobj.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
*/
/*
* psx/safeobj.h
*
* types and definitions for safe checking of user-provided objects
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __PSX_SAFEOBJ_H_INCLUDED__
#define __PSX_SAFEOBJ_H_INCLUDED__
/* INCLUDES */
#include <inttypes.h>
/* OBJECTS */
/* TYPES */
typedef uint32_t __magic_t;
/* CONSTANTS */
/* PROTOTYPES */
int __safeobj_validate(void *, __magic_t);
/* MACROS */
/* builds a magic number from 4 characters */
#define MAGIC(a,b,c,d) ( \
(((uint32_t)(uint8_t)(a)) << 24) | \
(((uint32_t)(uint8_t)(b)) << 16) | \
(((uint32_t)(uint8_t)(c)) << 8) | \
(((uint32_t)(uint8_t)(d)) << 0) \
)
/* retrieves a comma-separated list of the 4 characters in a magic number */
#define MAGIC_DECOMPOSE(m) \
((uint8_t)(m >> 24)), \
((uint8_t)(m >> 16)), \
((uint8_t)(m >> 8)), \
((uint8_t)(m >> 0))
#endif /* __PSX_SAFEOBJ_H_INCLUDED__ */
/* EOF */

54
posix/include/psx/spawn.h Normal file
View File

@@ -0,0 +1,54 @@
/* $Id: spawn.h,v 1.1 2002/03/11 20:51:59 hyperion Exp $
*/
/*
* psx/spawn.h
*
* spawn POSIX+ processes
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __PSX_SPAWN_H_INCLUDED__
#define __PSX_SPAWN_H_INCLUDED__
/* INCLUDES */
#include <ddk/ntddk.h>
#include <psx/pdata.h>
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
NTSTATUS STDCALL __PdxSpawnPosixProcess
(
OUT PHANDLE ProcessHandle,
OUT PHANDLE ThreadHandle,
IN POBJECT_ATTRIBUTES FileObjectAttributes,
IN POBJECT_ATTRIBUTES ProcessObjectAttributes,
IN HANDLE InheritFromProcessHandle,
IN __PPDX_PDATA ProcessData
);
/* MACROS */
#endif /* __PSX_SPAWN_H_INCLUDED__ */
/* EOF */

View File

@@ -0,0 +1,51 @@
/* $Id: stdlib.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
*/
/*
* psx/stdlib.h
*
* internal stdlib.h
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __PSX_STDLIB_H_INCLUDED__
#define __PSX_STDLIB_H_INCLUDED__
/* INCLUDES */
#include <ddk/ntddk.h>
#include <ntos/heap.h>
#include <stdlib.h>
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
/* FIXME? Windows NT's ntdll doesn't export RtlGetProcessHeap() */
#define RtlGetProcessHeap() ((HANDLE)NtCurrentPeb()->ProcessHeap)
#define __malloc(SIZE) (RtlAllocateHeap(RtlGetProcessHeap(), 0, (SIZE)))
#define __realloc(PTR,SIZE) (RtlReAllocateHeap(RtlGetProcessHeap(), 0, (PTR), (SIZE)))
#define __free(PTR) (RtlFreeHeap(RtlGetProcessHeap(), 0, (PTR)))
#endif /* __PSX_STDLIB_H_INCLUDED__ */
/* EOF */

View File

@@ -0,0 +1,83 @@
/* $Id: template.h,v 1.4 2002/03/10 18:06:08 hyperion Exp $
How to create a new header file from this template:
- copy the template in the new file (never edit this file directly, unless
that's what you want)
- search for the string "EDITME" in the file, and follow the instructions
- remove this comment block, all blocks containing REMOVEME, and all EDITME
instructions
- save your file, and Have Fun! (TM)
*/
/* $*Id*$ (EDITME: remove asterisks from "$*Id*$")
*/
/*
* psx/template.h (EDITME: replace with the real name of the header)
*
* template for POSIX headers (EDITME: replace this line with the real file
* description)
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by John Doe <john.doe@mail.com> (EDITME: your name and e-mail go
* here)
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
/*
Tags are used to prevent double inclusion of C header files. This
technique should be documented in all good C manuals
How to generate an unique tag for your header:
- uppercase the name of the header, where "name" is the filename and
the optional relative path (e.g. "stdio.h", "sys/types.h")
- replace all non-alphanumeric characters in the obtained name with an
underscore character ("_")
- prepend a double underscore ("__"), and append the string "_INCLUDED__"
- replace all occurrences of "__PSX_TEMPLATE_H_INCLUDED__" in this file
with your tag
Example tags:
sys/types.h -> SYS/TYPES.H -> SYS_TYPES_H -> __SYS_TYPES_H_INCLUDED__
iso646.h -> ISO646.H -> ISO646_H -> __ISO646_H_INCLUDED__
(REMOVEME)
*/
#ifndef __PSX_TEMPLATE_H_INCLUDED__ /* EDITME: replace macro with unique tag */
#define __PSX_TEMPLATE_H_INCLUDED__ /* EDITME: replace macro with unique tag */
/*
Explanation of the sections:
INCLUDES #include directives should be grouped here
OBJECTS declare global variables here
TYPES types, structures and unions here
CONSTANTS symbolic constants (simple #define's), enums, constants
PROTOTYPES ANSI C function prototypes
MACROS parametrized macros
(REMOVEME)
*/
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __PSX_TEMPLATE_H_INCLUDED__ */ /* EDITME: replace macro with unique tag */
/* EOF */

141
posix/include/pthread.h Normal file
View File

@@ -0,0 +1,141 @@
/* $Id: pthread.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* pthread.h
*
* threads. Conforming to the Single UNIX(r) Specification Version 2,
* System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __PTHREAD_H_INCLUDED__
#define __PTHREAD_H_INCLUDED__
/* INCLUDES */
#include <sched.h>
#include <time.h>
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
#define PTHREAD_MUTEX_NORMAL (1)
#define PTHREAD_MUTEX_ERRORCHECK (2)
#define PTHREAD_MUTEX_RECURSIVE (3)
#define PTHREAD_MUTEX_DEFAULT (PTHREAD_MUTEX_NORMAL)
#define PTHREAD_PROCESS_PRIVATE (1)
#define PTHREAD_PROCESS_SHARED (2)
#define PTHREAD_PRIO_NONE (1)
/* PROTOTYPES */
int pthread_attr_destroy(pthread_attr_t *);
int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
int pthread_attr_getguardsize(const pthread_attr_t *, size_t *);
int pthread_attr_getinheritsched(const pthread_attr_t *, int *);
int pthread_attr_getschedparam(const pthread_attr_t *,
struct sched_param *);
int pthread_attr_getschedpolicy(const pthread_attr_t *, int *);
int pthread_attr_getscope(const pthread_attr_t *, int *);
int pthread_attr_getstackaddr(const pthread_attr_t *, void **);
int pthread_attr_getstacksize(const pthread_attr_t *, size_t *);
int pthread_attr_init(pthread_attr_t *);
int pthread_attr_setdetachstate(pthread_attr_t *, int);
int pthread_attr_setguardsize(pthread_attr_t *, size_t);
int pthread_attr_setinheritsched(pthread_attr_t *, int);
int pthread_attr_setschedparam(pthread_attr_t *,
const struct sched_param *);
int pthread_attr_setschedpolicy(pthread_attr_t *, int);
int pthread_attr_setscope(pthread_attr_t *, int);
int pthread_attr_setstackaddr(pthread_attr_t *, void *);
int pthread_attr_setstacksize(pthread_attr_t *, size_t);
int pthread_cancel(pthread_t);
void pthread_cleanup_push(void (*)(void *), void *);
void pthread_cleanup_pop(int);
int pthread_cond_broadcast(pthread_cond_t *);
int pthread_cond_destroy(pthread_cond_t *);
int pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *);
int pthread_cond_signal(pthread_cond_t *);
int pthread_cond_timedwait(pthread_cond_t *,
pthread_mutex_t *, const struct timespec *);
int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *);
int pthread_condattr_destroy(pthread_condattr_t *);
int pthread_condattr_getpshared(const pthread_condattr_t *, int *);
int pthread_condattr_init(pthread_condattr_t *);
int pthread_condattr_setpshared(pthread_condattr_t *, int);
int pthread_create(pthread_t *, const pthread_attr_t *,
void *(*)(void *), void *);
int pthread_detach(pthread_t);
int pthread_equal(pthread_t, pthread_t);
void pthread_exit(void *);
int pthread_getconcurrency(void);
int pthread_getschedparam(pthread_t, int *, struct sched_param *);
void *pthread_getspecific(pthread_key_t);
int pthread_join(pthread_t, void **);
int pthread_key_create(pthread_key_t *, void (*)(void *));
int pthread_key_delete(pthread_key_t);
int pthread_mutex_destroy(pthread_mutex_t *);
int pthread_mutex_getprioceiling(const pthread_mutex_t *, int *);
int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *);
int pthread_mutex_lock(pthread_mutex_t *);
int pthread_mutex_setprioceiling(pthread_mutex_t *, int, int *);
int pthread_mutex_trylock(pthread_mutex_t *);
int pthread_mutex_unlock(pthread_mutex_t *);
int pthread_mutexattr_destroy(pthread_mutexattr_t *);
int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *,
int *);
int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *, int *);
int pthread_mutexattr_getpshared(const pthread_mutexattr_t *, int *);
int pthread_mutexattr_gettype(const pthread_mutexattr_t *, int *);
int pthread_mutexattr_init(pthread_mutexattr_t *);
int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
int pthread_once(pthread_once_t *, void (*)(void));
int pthread_rwlock_destroy(pthread_rwlock_t *);
int pthread_rwlock_init(pthread_rwlock_t *,
const pthread_rwlockattr_t *);
int pthread_rwlock_rdlock(pthread_rwlock_t *);
int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
int pthread_rwlock_trywrlock(pthread_rwlock_t *);
int pthread_rwlock_unlock(pthread_rwlock_t *);
int pthread_rwlock_wrlock(pthread_rwlock_t *);
int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *,
int *);
int pthread_rwlockattr_init(pthread_rwlockattr_t *);
int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
pthread_t
pthread_self(void);
int pthread_setcancelstate(int, int *);
int pthread_setcanceltype(int, int *);
int pthread_setconcurrency(int);
int pthread_setschedparam(pthread_t, int ,
const struct sched_param *);
int pthread_setspecific(pthread_key_t, const void *);
void pthread_testcancel(void);
/* MACROS */
#endif /* __PTHREAD_H_INCLUDED__ */
/* EOF */

60
posix/include/pwd.h Normal file
View File

@@ -0,0 +1,60 @@
/* $Id: pwd.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* pwd.h
*
* password structure. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __PWD_H_INCLUDED__
#define __PWD_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
struct passwd
{
char *pw_name; /* user's login name */
uid_t pw_uid; /* numerical user ID */
gid_t pw_gid; /* numerical group ID */
char *pw_dir; /* initial working directory */
char *pw_shell; /* program to use as shell */
};
/* CONSTANTS */
/* PROTOTYPES */
struct passwd *getpwnam(const char *);
struct passwd *getpwuid(uid_t);
int getpwnam_r(const char *, struct passwd *, char *,
size_t, struct passwd **);
int getpwuid_r(uid_t, struct passwd *, char *,
size_t, struct passwd **);
void endpwent(void);
struct passwd *getpwent(void);
void setpwent(void);
/* MACROS */
#endif /* __PWD_H_INCLUDED__ */
/* EOF */

62
posix/include/sched.h Normal file
View File

@@ -0,0 +1,62 @@
/* $Id: sched.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* sched.h
*
* execution scheduling (REALTIME). Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SCHED_H_INCLUDED__
#define __SCHED_H_INCLUDED__
/* INCLUDES */
#include <time.h>
/* OBJECTS */
/* TYPES */
struct sched_param
{
int sched_priority; /* process execution scheduling priority */
};
/* CONSTANTS */
/* First in-first out (FIFO) scheduling policy */
#define SCHED_FIFO (1)
/* Round robin scheduling policy */
#define SCHED_RR (2)
/* Another scheduling policy */
#define SCHED_OTHER (3)
/* PROTOTYPES */
int sched_get_priority_max(int);
int sched_get_priority_min(int);
int sched_getparam(pid_t, struct sched_param *);
int sched_getscheduler(pid_t);
int sched_rr_get_interval(pid_t, struct timespec *);
int sched_setparam(pid_t, const struct sched_param *);
int sched_setscheduler(pid_t, int, const struct sched_param *);
int sched_yield(void);
/* MACROS */
#endif /* __SCHED_H_INCLUDED__ */
/* EOF */

322
posix/include/signal.h Normal file
View File

@@ -0,0 +1,322 @@
/* $Id: signal.h,v 1.3 2002/03/22 01:26:28 hyperion Exp $
*/
/*
* signal.h
*
* signals. Conforming to the Single UNIX(r) Specification Version 2,
* System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SIGNAL_H_INCLUDED__
#define __SIGNAL_H_INCLUDED__
/* INCLUDES */
#include <time.h>
#include <sys/types.h>
/* OBJECTS */
/* TYPES */
/* pre-declaration of time.h types to suppress warnings caused by circular
dependencies */
struct timespec;
typedef int sig_atomic_t; /* Integral type of an object that can be
accessed as an atomic entity, even in the
presence of asynchronous interrupts */
typedef unsigned long int sigset_t; /* Integral or structure type of an object
used to represent sets of signals. */
union sigval
{
int sival_int; /* integer signal value */
void* sival_ptr; /* pointer signal value */
};
struct sigevent
{
int sigev_notify; /* notification type */
int sigev_signo; /* signal number */
union sigval sigev_value; /* signal value */
void (* sigev_notify_function)(union sigval); /* notification function */
pthread_attr_t * sigev_notify_attributes; /* notification attributes */
};
typedef struct __tagsiginfo_t
{
int si_signo; /* signal number */
int si_errno; /* if non-zero, an errno value associated with
this signal, as defined in <errno.h> */
int si_code; /* signal code */
pid_t si_pid; /* sending process ID */
uid_t si_uid; /* real user ID of sending process */
void *si_addr; /* address of faulting instruction */
int si_status; /* exit value or signal */
long si_band; /* band event for SIGPOLL */
union sigval si_value; /* signal value */
} siginfo_t;
struct sigaction
{
void (* sa_handler)(int); /* what to do on receipt of signal */
sigset_t sa_mask; /* set of signals to be blocked during
execution of the signal handling function */
int sa_flags; /* special flags */
void (* sa_sigaction)(int, siginfo_t *, void *);
/* pointer to signal handler function
or one of the macros SIG_IGN or SIG_DFL */
};
typedef struct __tagstack_t
{
void *ss_sp; /* stack base or pointer */
size_t ss_size; /* stack size */
int ss_flags; /* flags */
} stack_t;
struct sigstack
{
int ss_onstack; /* non-zero when signal stack is in use */
void *ss_sp; /* signal stack pointer */
};
/* CONSTANTS */
#define SIG_DFL ((void (*)(int))(0xFFFFFFFF)) /* Request for default signal handling. */
#define SIG_ERR ((void (*)(int))(0x00000000)) /* Return value from signal() in case of error. */
#define SIG_IGN ((void (*)(int))(0x00000001)) /* Request that signal be ignored. */
#define SIG_HOLD ((void (*)(int))(0x00000002)) /* Request that signal be held. */
#define SIGEV_NONE (0) /* No asynchronous notification will be delivered \
when the event of interest occurs. */
#define SIGEV_SIGNAL (1) /* A queued signal, with an application-defined \
value, will be generated when the event of \
interest occurs. */
#define SIGEV_THREAD (2) /* A notification function will be called to perform \
notification. */
/* TODO: realtime features not supported yet */
#define SIGRTMIN (-1)
#define SIGRTMAX (-1)
#define SIGABRT ( 1) /* Process abort signal. */
#define SIGALRM ( 2) /* Alarm clock. */
#define SIGFPE ( 3) /* Erroneous arithmetic operation. */
#define SIGHUP ( 4) /* Hangup. */
#define SIGILL ( 5) /* Illegal instruction. */
#define SIGINT ( 6) /* Terminal interrupt signal. */
#define SIGKILL ( 7) /* Kill (cannot be caught or ignored). */
#define SIGPIPE ( 8) /* Write on a pipe with no one to read it. */
#define SIGQUIT ( 9) /* Terminal quit signal. */
#define SIGSEGV (10) /* Invalid memory reference. */
#define SIGTERM (11) /* Termination signal. */
#define SIGUSR1 (12) /* User-defined signal 1. */
#define SIGUSR2 (13) /* User-defined signal 2. */
#define SIGCHLD (14) /* Child process terminated or stopped. */
#define SIGCONT (15) /* Continue executing, if stopped. */
#define SIGSTOP (16) /* Stop executing (cannot be caught or ignored). */
#define SIGTSTP (17) /* Terminal stop signal. */
#define SIGTTIN (18) /* Background process attempting read. */
#define SIGTTOU (19) /* Background process attempting write. */
#define SIGBUS (20) /* Access to an undefined portion of a memory object. */
#define SIGPOLL (21) /* Pollable event. */
#define SIGPROF (22) /* Profiling timer expired. */
#define SIGSYS (23) /* Bad system call. */
#define SIGTRAP (24) /* Trace/breakpoint trap. */
#define SIGURG (25) /* High bandwidth data is available at a socket. */
#define SIGVTALRM (26) /* Virtual timer expired. */
#define SIGXCPU (27) /* CPU time limit exceeded. */
#define SIGXFSZ (28) /* File size limit exceeded. */
/* FIXME: the following constants need to be reviewed */
/* Do not generate SIGCHLD when children stop. */
#define SA_NOCLDSTOP (0x00000001)
/* The resulting set is the union of the current set and the signal set
pointed to by the argument set. */
#define SA_ONSTACK (0x00000002)
/* Causes signal dispositions to be set to SIG_DFL on entry to signal
handlers. */
#define SA_RESETHAND (0x00000004)
/* Causes certain functions to become restartable. */
#define SA_RESTART (0x00000008)
/* Causes extra information to be passed to signal handlers at the time
of receipt of a signal. */
#define SA_SIGINFO (0x00000010)
/* Causes implementations not to create zombie processes on child death. */
#define SA_NOCLDWAIT (0x00000020)
/* Causes signal not to be automatically blocked on entry to signal
handler. */
#define SA_NODEFER (0x00000040)
/* FIXME: the following constants need to be reviewed */
/* The resulting set is the intersection of the current set and the
complement of the signal set pointed to by the argument set. */
#define SIG_BLOCK (1)
/* The resulting set is the signal set pointed to by the argument
set. */
#define SIG_UNBLOCK (2)
/* Causes signal delivery to occur on an alternate stack. */
#define SIG_SETMASK (3)
/* FIXME: the following constants need to be reviewed */
/* Process is executing on an alternate signal stack. */
#define SS_ONSTACK (1)
/* Alternate signal stack is disabled. */
#define SS_DISABLE (2)
/* Minimum stack size for a signal handler. */ /* FIXME */
#define MINSIGSTKSZ (0)
/* Default size in bytes for the alternate signal stack. */ /* FIXME */
#define SIGSTKSZ (0)
/*
signal-specific reasons why the signal was generated
*/
/* SIGILL */
/* illegal opcode */
#define ILL_ILLOPC (1)
/* illegal operand */
#define ILL_ILLOPN (2)
/* illegal addressing mode */
#define ILL_ILLADR (3)
/* illegal trap */
#define ILL_ILLTRP (4)
/* privileged opcode */
#define ILL_PRVOPC (5)
/* privileged register */
#define ILL_PRVREG (6)
/* coprocessor error */
#define ILL_COPROC (7)
/* internal stack error */
#define ILL_BADSTK (8)
/* SIGFPE */
/* integer divide by zero */
#define FPE_INTDIV
/* integer overflow */
#define FPE_INTOVF
/* floating point divide by zero */
#define FPE_FLTDIV
/* floating point overflow */
#define FPE_FLTOVF
/* floating point underflow */
#define FPE_FLTUND
/* floating point inexact result */
#define FPE_FLTRES
/* invalid floating point operation */
#define FPE_FLTINV
/* subscript out of range */
#define FPE_FLTSUB
/* SIGSEGV */
/* address not mapped to object */
#define SEGV_MAPERR
/* invalid permissions for mapped object */
#define SEGV_ACCERR
/* SIGBUS */
/* invalid address alignment */
#define BUS_ADRALN
/* non-existent physical address */
#define BUS_ADRERR
/* object specific hardware error */
#define BUS_OBJERR
/* SIGTRAP */
/* process breakpoint */
#define TRAP_BRKPT
/* process trace trap */
#define TRAP_TRACE
/* SIGCHLD */
/* child has exited */
#define CLD_EXITED
/* child has terminated abnormally and did not create a core file */
#define CLD_KILLED
/* child has terminated abnormally and created a core file */
#define CLD_DUMPED
/* traced child has trapped */
#define CLD_TRAPPED
/* child has stopped */
#define CLD_STOPPED
/* stopped child has continued */
#define CLD_CONTINUED
/* SIGPOLL */
/* data input available */
#define POLL_IN
/* output buffers available */
#define POLL_OUT
/* input message available */
#define POLL_MSG
/* I/O error */
#define POLL_ERR
/* high priority input available */
#define POLL_PRI
/* device disconnected */
#define POLL_HUP
/* signal sent by kill() */
#define SI_USER
/* signal sent by the sigqueue() */
#define SI_QUEUE
/* signal generated by expiration of a timer set by timer_settime() */
#define SI_TIMER
/* signal generated by completion of an asynchronous I/O request */
#define SI_ASYNCIO
/* signal generated by arrival of a message on an empty message queue */
#define SI_MESGQ
/* PROTOTYPES */
void (*bsd_signal(int, void (*)(int)))(int);
int kill(pid_t, int);
int killpg(pid_t, int);
int pthread_kill(pthread_t, int);
int pthread_sigmask(int, const sigset_t *, sigset_t *);
int raise(int);
int sigaction(int, const struct sigaction *, struct sigaction *);
int sigaddset(sigset_t *, int);
int sigaltstack(const stack_t *, stack_t *);
int sigdelset(sigset_t *, int);
int sigemptyset(sigset_t *);
int sigfillset(sigset_t *);
int sighold(int);
int sigignore(int);
int siginterrupt(int, int);
int sigismember(const sigset_t *, int);
void (*signal(int, void (*)(int)))(int);
int sigpause(int);
int sigpending(sigset_t *);
int sigprocmask(int, const sigset_t *, sigset_t *);
int sigqueue(pid_t, int, const union sigval);
int sigrelse(int);
void (*sigset(int, void (*)(int)))(int);
int sigstack(struct sigstack *ss,
struct sigstack *oss); /* LEGACY */
int sigsuspend(const sigset_t *);
int sigtimedwait(const sigset_t *, siginfo_t *,
const struct timespec *);
int sigwait(const sigset_t *set, int *sig);
int sigwaitinfo(const sigset_t *, siginfo_t *);
/* MACROS */
#endif /* __SIGNAL_H_INCLUDED__ */
/* EOF */

57
posix/include/stdarg.h Normal file
View File

@@ -0,0 +1,57 @@
/* $Id: stdarg.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* stdarg.h
*
* handle variable argument list. Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __STDARG_H_INCLUDED__
#define __STDARG_H_INCLUDED__
/* OBJECTS */
/* TYPES */
typedef char* va_list;
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
/* taken from mingw's stdarg.h */
/* Amount of space required in an argument list (ie. the stack) for an
argument of type t. */
#define __va_argsiz(t) \
(((sizeof(t) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
#define va_start(ap, pN) \
((ap) = ((va_list) (&pN) + __va_argsiz(pN)))
#define va_end(ap) ((void)0)
#define va_arg(ap, t) \
(((ap) = (ap) + __va_argsiz(t)), \
*((t*) (void*) ((ap) - __va_argsiz(t))))
#endif /* __STDARG_H_INCLUDED__ */
/* EOF */

50
posix/include/stddef.h Normal file
View File

@@ -0,0 +1,50 @@
/* $Id: stddef.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* stddef.h
*
* standard type definitions. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __STDDEF_H_INCLUDED__
#define __STDDEF_H_INCLUDED__
/* INCLUDES */
#include <sys/types.h>
/* OBJECTS */
/* TYPES */
typedef signed long int ptrdiff_t;
typedef unsigned short int wchar_t;
/* CONSTANTS */
#ifndef NULL
#define NULL ((void *)(0)) /* Null pointer constant. */
#endif
/* PROTOTYPES */
/* MACROS */
#define offsetof(t,m) ((size_t) &((t *)0)->m)
#endif /* __STDDEF_H_INCLUDED__ */
/* EOF */

165
posix/include/stdio.h Normal file
View File

@@ -0,0 +1,165 @@
/* $Id: stdio.h,v 1.2 2002/02/20 09:17:54 hyperion Exp $
*/
/*
* stdio.h
*
* standard buffered input/output. Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __STDIO_H_INCLUDED__
#define __STDIO_H_INCLUDED__
/* INCLUDES */
#include <stddef.h>
#include <stdarg.h>
#include <unistd.h>
#include <sys/types.h>
/* OBJECTS */
extern char *optarg;
extern int opterr;
extern int optind; /* LEGACY */
extern int optopt;
/* TYPES */
typedef struct __tagFILE
{
int _dummy;
} FILE;
typedef struct __tagfpos_t
{
int _dummy;
} fpos_t;
/* CONSTANTS */
/* Size of <stdio.h> buffers. */
#define BUFSIZ (0x10000)
/* Maximum size in bytes of the longest filename string that the implementation
guarantees can be opened. */
#define FILENAME_MAX (255)
/* Number of streams which the implementation guarantees can be open
simultaneously. The value will be at least eight. */
#define FOPEN_MAX (8)
/* Input/output fully buffered. */
#define _IOFBF (1)
/* Input/output line buffered. */
#define _IOLBF (2)
/* Input/output unbuffered. */
#define _IONBF (3)
/* Maximum size of character array to hold ctermid() output. */
#define L_ctermid (255)
/* Maximum size of character array to hold cuserid() output. (LEGACY) */
#define L_cuserid (255)
/* Maximum size of character array to hold tmpnam() output. */
#define L_tmpnam (255)
/* Minimum number of unique filenames generated by tmpnam(). Maximum number
of times an application can call tmpnam() reliably. The value of TMP_MAX
will be at least 10,000. */
#define TMP_MAX (0xFFFF)
/* End-of-file return value. */
#define EOF (-1)
/* default directory prefix for tempnam() */
#define P_tmpdir "/tmp/"
/* Standard error output stream. */
#define stderr ((FILE *)STDERR_FILENO)
/* Standard input stream. */
#define stdin ((FILE *)STDIN_FILENO)
/* Standard output stream. */
#define stdout ((FILE *)STDOUT_FILENO)
/* PROTOTYPES */
void clearerr(FILE *);
char *ctermid(char *);
char *cuserid(char *); /* LEGACY */
int fclose(FILE *);
FILE *fdopen(int, const char *);
int feof(FILE *);
int ferror(FILE *);
int fflush(FILE *);
int fgetc(FILE *);
int fgetpos(FILE *, fpos_t *);
char *fgets(char *, int, FILE *);
int fileno(FILE *);
void flockfile(FILE *);
FILE *fopen(const char *, const char *);
int fprintf(FILE *, const char *, ...);
int fputc(int, FILE *);
int fputs(const char *, FILE *);
size_t fread(void *, size_t, size_t, FILE *);
FILE *freopen(const char *, const char *, FILE *);
int fscanf(FILE *, const char *, ...);
int fseek(FILE *, long int, int);
int fseeko(FILE *, off_t, int);
int fsetpos(FILE *, const fpos_t *);
long int ftell(FILE *);
off_t ftello(FILE *);
int ftrylockfile(FILE *);
void funlockfile(FILE *);
size_t fwrite(const void *, size_t, size_t, FILE *);
int getc(FILE *);
int getchar(void);
int getc_unlocked(FILE *);
int getchar_unlocked(void);
int getopt(int, char * const[], const char *); /* LEGACY */
char *gets(char *);
int getw(FILE *);
int pclose(FILE *);
void perror(const char *);
FILE *popen(const char *, const char *);
int printf(const char *, ...);
int putc(int, FILE *);
int putchar(int);
int putc_unlocked(int, FILE *);
int putchar_unlocked(int);
int puts(const char *);
int putw(int, FILE *);
int remove(const char *);
int rename(const char *, const char *);
void rewind(FILE *);
int scanf(const char *, ...);
void setbuf(FILE *, char *);
int setvbuf(FILE *, char *, int, size_t);
int snprintf(char *, size_t, const char *, ...);
int sprintf(char *, const char *, ...);
int sscanf(const char *, const char *, int, ...);
char *tempnam(const char *, const char *);
FILE *tmpfile(void);
char *tmpnam(char *);
int ungetc(int, FILE *);
int vfprintf(FILE *, const char *, va_list);
int vprintf(const char *, va_list);
int vsnprintf(char *, size_t, const char *, va_list);
int vsprintf(char *, const char *, va_list);
/* MACROS */
#endif /* __STDIO_H_INCLUDED__ */
/* EOF */

130
posix/include/stdlib.h Normal file
View File

@@ -0,0 +1,130 @@
/* $Id: stdlib.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
*/
/*
* stdlib.h
*
* standard library definitions. Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __STDLIB_H_INCLUDED__
#define __STDLIB_H_INCLUDED__
/* INCLUDES */
#include <stddef.h>
#include <limits.h>
#include <math.h>
#include <sys/wait.h>
/* OBJECTS */
/* TYPES */
typedef struct __tagdiv_t
{
int quot; /* quotient */
int rem; /* remainder */
} div_t;
typedef struct __tagldiv_t
{
long int quot; /* quotient */
long int rem; /* remainder */
} ldiv_t;
/* CONSTANTS */
#define EXIT_FAILURE (-1) /* Unsuccessful termination for exit(), evaluates \
to a non-zero value. */
#define EXIT_SUCCESS (0) /* Successful termination for exit(), evaluates to 0. */
/* FIXME */
#define RAND_MAX (32767) /* Maximum value returned by rand(), at least 32,767. */
/* FIXME */
#define MB_CUR_MAX (1) /* Integer expression whose value is the maximum number \
of bytes in a character specified by the current \
locale. */
/* PROTOTYPES */
long a64l(const char *);
void abort(void);
int abs(int);
int atexit(void (*)(void));
double atof(const char *);
int atoi(const char *);
long int atol(const char *);
void *bsearch(const void *, const void *, size_t, size_t,
int (*)(const void *, const void *));
void *calloc(size_t, size_t);
div_t div(int, int);
double drand48(void);
char *ecvt(double, int, int *, int *);
double erand48(unsigned short int[3]);
void exit(int);
char *fcvt (double, int, int *, int *);
void free(void *);
char *gcvt(double, int, char *);
char *getenv(const char *);
int getsubopt(char **, char *const *, char **);
int grantpt(int);
char *initstate(unsigned int, char *, size_t);
long int jrand48(unsigned short int[3]);
char *l64a(long);
long int labs(long int);
void lcong48(unsigned short int[7]);
ldiv_t ldiv(long int, long int);
long int lrand48(void);
void *malloc(size_t);
int mblen(const char *, size_t);
size_t mbstowcs(wchar_t *, const char *, size_t);
int mbtowc(wchar_t *, const char *, size_t);
char *mktemp(char *);
int mkstemp(char *);
long int mrand48(void);
long int nrand48(unsigned short int [3]);
char *ptsname(int);
int putenv(char *);
void qsort(void *, size_t, size_t, int (*)(const void *,
const void *));
int rand(void);
int rand_r(unsigned int *);
long random(void);
void *realloc(void *, size_t);
char *realpath(const char *, char *);
unsigned short int seed48(unsigned short int[3]);
void setkey(const char *);
char *setstate(const char *);
void srand(unsigned int);
void srand48(long int);
void srandom(unsigned);
double strtod(const char *, char **);
long int strtol(const char *, char **, int);
unsigned long int
strtoul(const char *, char **, int);
int system(const char *);
int ttyslot(void); /* LEGACY */
int unlockpt(int);
void *valloc(size_t); /* LEGACY */
size_t wcstombs(char *, const wchar_t *, size_t);
int wctomb(char *, wchar_t);
/* MACROS */
#endif /* __STDLIB_H_INCLUDED__ */
/* EOF */

69
posix/include/string.h Normal file
View File

@@ -0,0 +1,69 @@
/* $Id: string.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
*/
/*
* string.h
*
* string operations. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __STRING_H_INCLUDED__ /* replace with the appropriate tag */
#define __STRING_H_INCLUDED__ /* replace with the appropriate tag */
/* INCLUDES */
#include <stddef.h>
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
void *memccpy(void *, const void *, int, size_t);
void *memchr(const void *, int, size_t);
int memcmp(const void *, const void *, size_t);
void *memcpy(void *, const void *, size_t);
void *memmove(void *, const void *, size_t);
void *memset(void *, int, size_t);
char *strcat(char *, const char *);
char *strchr(const char *, int);
int strcmp(const char *, const char *);
int strcoll(const char *, const char *);
char *strcpy(char *, const char *);
size_t strcspn(const char *, const char *);
char *strdup(const char *);
char *strerror(int);
size_t strlen(const char *);
char *strncat(char *, const char *, size_t);
int strncmp(const char *, const char *, size_t);
char *strncpy(char *, const char *, size_t);
char *strpbrk(const char *, const char *);
char *strrchr(const char *, int);
size_t strspn(const char *, const char *);
char *strstr(const char *, const char *);
char *strtok(char *, const char *);
char *strtok_r(char *, const char *, char **);
size_t strxfrm(char *, const char *, size_t);
/* MACROS */
#endif /* __STRING_H_INCLUDED__ */ /* replace with the appropriate tag */
/* EOF */

44
posix/include/sys/errno.h Normal file
View File

@@ -0,0 +1,44 @@
/* $Id: errno.h,v 1.1 2002/03/22 01:24:49 hyperion Exp $
*/
/*
* sys/errno.h
*
* dummy include file for Microsoft POSIX and Interix compatibility
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_ERRNO_H_INCLUDED__
#define __SYS_ERRNO_H_INCLUDED__
/* INCLUDES */
#include <errno.h>
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __SYS_ERRNO_H_INCLUDED__ */
/* EOF */

43
posix/include/sys/ipc.h Normal file
View File

@@ -0,0 +1,43 @@
/* $Id: ipc.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
*/
/*
* sys/ipc.h
*
* interprocess communication access structure. Conforming to the Single
* UNIX(r) Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_IPC_H_INCLUDED__
#define __SYS_IPC_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __SYS_IPC_H_INCLUDED__ */
/* EOF */

43
posix/include/sys/mman.h Normal file
View File

@@ -0,0 +1,43 @@
/* $Id: mman.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
*/
/*
* sys/mman.h
*
* memory management declarations. Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_SOCKET_H_INCLUDED__
#define __SYS_SOCKET_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __SYS_SOCKET_H_INCLUDED__ */
/* EOF */

43
posix/include/sys/msg.h Normal file
View File

@@ -0,0 +1,43 @@
/* $Id: msg.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
*/
/*
* sys/msg.h
*
* message queue structures. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_SOCKET_H_INCLUDED__
#define __SYS_SOCKET_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __SYS_SOCKET_H_INCLUDED__ */
/* EOF */

View File

@@ -0,0 +1,43 @@
/* $Id: resource.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
*/
/*
* sys/resource.h
*
* definitions for XSI resource operations. Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_RESOURCE_H_INCLUDED__
#define __SYS_RESOURCE_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __SYS_RESOURCE_H_INCLUDED__ */
/* EOF */

43
posix/include/sys/sem.h Normal file
View File

@@ -0,0 +1,43 @@
/* $Id: sem.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
*/
/*
* sys/sem.h
*
* semaphore facility. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_SEM_H_INCLUDED__
#define __SYS_SEM_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __SYS_SEM_H_INCLUDED__ */
/* EOF */

43
posix/include/sys/shm.h Normal file
View File

@@ -0,0 +1,43 @@
/* $Id: shm.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
*/
/*
* sys/shm.h
*
* shared memory facility. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_SHM_H_INCLUDED__
#define __SYS_SHM_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __SYS_SHM_H_INCLUDED__ */
/* EOF */

View File

@@ -0,0 +1,43 @@
/* $Id: socket.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
*/
/*
* sys/socket.h
*
* Internet Protocol family. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_SOCKET_H_INCLUDED__
#define __SYS_SOCKET_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __SYS_SOCKET_H_INCLUDED__ */
/* EOF */

124
posix/include/sys/stat.h Normal file
View File

@@ -0,0 +1,124 @@
/* $Id: stat.h,v 1.3 2002/03/22 01:26:28 hyperion Exp $
*/
/*
* sys/stat.h
*
* data returned by the stat() function. Conforming to the Single
* UNIX(r) Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_STAT_H_INCLUDED__
#define __SYS_STAT_H_INCLUDED__
/* INCLUDES */
#include <sys/types.h>
/* OBJECTS */
/* TYPES */
struct stat
{
mode_t st_mode; /* mode of file (see below) */
ino_t st_ino; /* file serial number */
dev_t st_dev; /* ID of device containing file */
nlink_t st_nlink; /* number of links to the file */
uid_t st_uid; /* user ID of file */
gid_t st_gid; /* group ID of file */
off_t st_size; /* file size in bytes (if file is a regular file) */
time_t st_atime; /* time of last access */
time_t st_mtime; /* time of last data modification */
time_t st_ctime; /* time of last status change */
dev_t st_rdev; /* device ID (if file is character or block special) */
blksize_t st_blksize; /* a filesystem-specific preferred I/O block size for
this object. In some filesystem types, this may
vary from file to file */
blkcnt_t st_blocks; /* number of blocks allocated for this object */
};
/* CONSTANTS */
/*
file type
*/
#define S_IFIFO (000010000) /* FIFO special */
#define S_IFCHR (000020000) /* character special */
#define S_IFDIR (000040000) /* directory */
#define S_IFBLK (000060000) /* block special */
#define S_IFREG (000100000) /* regular */
#define S_IFLNK (000200000) /* symbolic link */
#define S_IFSOCK (000400000) /* socket */
/* type of file */
#define S_IFMT (000770000)
/*
file mode bits
*/
#define S_IRUSR (000000400) /* read permission, owner */
#define S_IWUSR (000000200) /* write permission, owner */
#define S_IXUSR (000000100) /* execute/search permission, owner */
#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) /* read, write, execute/search by owner */
#define S_IRGRP (000000040) /* read permission, group */
#define S_IWGRP (000000020) /* write permission, group */
#define S_IXGRP (000000010) /* execute/search permission, group */
#define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) /* read, write, execute/search by group */
#define S_IROTH (000000004) /* read permission, others */
#define S_IWOTH (000000002) /* write permission, others */
#define S_IXOTH (000000001) /* execute/search permission, others */
#define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) /* read, write, execute/search by others */
#define S_ISUID (000004000) /* set-user-ID on execution */
#define S_ISGID (000002000) /* set-group-ID on execution */
#define S_ISVTX (000010000) /* on directories, restricted deletion flag */
/*
the following macros will test whether a file is of the specified type
*/
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
/* shared memory, semaphores and message queues are unlikely to be ever
implemented as files */
#define S_TYPEISMQ(buf) (0) /* Test for a message queue */
#define S_TYPEISSEM(buf) (0) /* Test for a semaphore */
#define S_TYPEISSHM(buf) (0) /* Test for a shared memory object */
/* PROTOTYPES */
int chmod(const char *, mode_t);
int fchmod(int, mode_t);
int fstat(int, struct stat *);
int lstat(const char *, struct stat *);
int mkdir(const char *, mode_t);
int mkfifo(const char *, mode_t);
int mknod(const char *, mode_t, dev_t);
int stat(const char *, struct stat *);
mode_t umask(mode_t);
/* MACROS */
#endif /* __SYS_STAT_H_INCLUDED__ */
/* EOF */

View File

@@ -0,0 +1,43 @@
/* $Id: statvfs.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
*/
/*
* sys/statvfs.h
*
* VFS Filesystem information structure. Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_STATVFS_H_INCLUDED__
#define __SYS_STATVFS_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __SYS_STATVFS_H_INCLUDED__ */
/* EOF */

43
posix/include/sys/time.h Normal file
View File

@@ -0,0 +1,43 @@
/* $Id: time.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
*/
/*
* sys/time.h
*
* time types. Conforming to the Single UNIX(r) Specification Version 2,
* System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_TIME_H_INCLUDED__
#define __SYS_TIME_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __SYS_TIME_H_INCLUDED__ */
/* EOF */

43
posix/include/sys/timeb.h Normal file
View File

@@ -0,0 +1,43 @@
/* $Id: timeb.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
*/
/*
* sys/timeb.h
*
* additional definitions for date and time. Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_TIMEB_H_INCLUDED__
#define __SYS_TIMEB_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __SYS_TIMEB_H_INCLUDED__ */
/* EOF */

43
posix/include/sys/times.h Normal file
View File

@@ -0,0 +1,43 @@
/* $Id: times.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
*/
/*
* sys/times.h
*
* file access and modification times structure. Conforming to the Single
* UNIX(r) Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_TIMES_H_INCLUDED__
#define __SYS_TIMES_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __SYS_TIMES_H_INCLUDED__ */
/* EOF */

100
posix/include/sys/types.h Normal file
View File

@@ -0,0 +1,100 @@
/* $Id: types.h,v 1.4 2002/03/31 04:37:19 sedwards Exp $
*/
/*
* sys/types.h
*
* data types. Conforming to the Single UNIX(r) Specification Version 2,
* System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_TYPES_H_INCLUDED__
#define __SYS_TYPES_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* FIXME: all these types need to be checked */
typedef unsigned long int blkcnt_t; /* Used for file block counts */
typedef unsigned long int blksize_t; /* Used for block sizes */
typedef long long clock_t; /* Used for system times in clock ticks or CLOCKS_PER_SEC */
typedef int clockid_t; /* Used for clock ID type in the clock and timer functions. */
typedef unsigned long int dev_t; /* Used for device IDs. */
typedef unsigned long int fsblkcnt_t; /* Used for file system block counts */
typedef unsigned long int fsfilcnt_t; /* Used for file system file counts */
typedef unsigned long int gid_t; /* Used for group IDs. */
typedef int id_t; /* Used as a general identifier; can be used to contain at least a
pid_t, uid_t or a gid_t. */
typedef unsigned long int ino_t; /* Used for file serial numbers. */
typedef int key_t; /* Used for interprocess communication. */
typedef unsigned long int mode_t; /* Used for some file attributes. */
typedef unsigned long int nlink_t; /* Used for link counts. */
typedef long off_t; /* Used for file sizes. */
typedef long int pid_t; /* Used for process IDs and process group IDs. */
/* pthread types */
typedef void * pthread_cond_t; /* Used for condition variables. */
typedef void * pthread_condattr_t; /* Used to identify a condition attribute object. */
typedef void * pthread_key_t; /* Used for thread-specific data keys. */
typedef void * pthread_attr_t; /* Used to identify a thread attribute object. */
typedef void * pthread_mutex_t;
typedef void * pthread_mutexattr_t;
typedef void * pthread_once_t; /* Used for dynamic package initialisation. */
typedef void * pthread_rwlock_t; /* Used for read-write locks. */
typedef void * pthread_rwlockattr_t; /* Used for read-write lock attributes. */
typedef unsigned long int pthread_t; /* Used to identify a thread. */
typedef unsigned int size_t; /* Used for sizes of objects. */
typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */
typedef long long suseconds_t; /* Used for time in microseconds */
typedef long int time_t; /* Used for time in seconds. */
typedef void * timer_t; /* Used for timer ID returned by timer_create(). */
typedef int uid_t; /* Used for user IDs. */
typedef unsigned long long useconds_t; /* Used for time in microseconds. */
/*
additional types for sockets and streams - for compatibility with Microsoft POSIX
*/
typedef unsigned char u_char;
typedef unsigned short int u_short;
typedef unsigned short int ushort;
typedef unsigned int u_int;
typedef unsigned long int u_long;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned char unchar;
typedef char *caddr_t;
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
/* for compatibility with Microsoft POSIX */
#define _CRTAPI1 __cdecl
#define _CRTAPI2 __cdecl
#endif /* __SYS_TYPES_H_INCLUDED__ */
/* EOF */

43
posix/include/sys/uio.h Normal file
View File

@@ -0,0 +1,43 @@
/* $Id: uio.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
*/
/*
* sys/uio.h
*
* definitions for vector I/O operations. Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_UIO_H_INCLUDED__
#define __SYS_UIO_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __SYS_UIO_H_INCLUDED__ */
/* EOF */

43
posix/include/sys/un.h Normal file
View File

@@ -0,0 +1,43 @@
/* $Id: un.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
*/
/*
* sys/un.h
*
* declarations for definitions for UNIX-domain sockets. Conforming to the
* Single UNIX(r) Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_UN_H_INCLUDED__
#define __SYS_UN_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __SYS_UN_H_INCLUDED__ */
/* EOF */

View File

@@ -0,0 +1,54 @@
/* $Id: utsname.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
*/
/*
* sys/utsname.h
*
* system name structure. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_UTSNAME_H_INCLUDED__
#define __SYS_UTSNAME_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
struct utsname
{
char sysname[255]; /* name of this implementation of the operating system */
char nodename[255]; /* name of this node within an implementation-dependent
communications network */
char release[255]; /* current release level of this implementation */
char version[255]; /* current version level of this release */
char machine[255]; /* name of the hardware type on which the system is
running */
};
/* CONSTANTS */
/* PROTOTYPES */
int uname(struct utsname *);
/* MACROS */
#endif /* __SYS_UTSNAME_H_INCLUDED__ */
/* EOF */

43
posix/include/sys/wait.h Normal file
View File

@@ -0,0 +1,43 @@
/* $Id: wait.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $
*/
/*
* sys/wait.h
*
* declarations for waiting. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __SYS_WAIT_H_INCLUDED__
#define __SYS_WAIT_H_INCLUDED__
/* INCLUDES */
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __SYS_WAIT_H_INCLUDED__ */
/* EOF */

114
posix/include/time.h Normal file
View File

@@ -0,0 +1,114 @@
/* $Id: time.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
*/
/*
* time.h
*
* time types. Conforming to the Single UNIX(r) Specification Version 2,
* System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __TIME_H_INCLUDED__
#define __TIME_H_INCLUDED__
/* INCLUDES */
#include <signal.h>
#include <sys/types.h>
/* OBJECTS */
//extern static int getdate_err; /* FIXME */
extern int daylight;
extern long int timezone;
extern char *tzname[];
/* TYPES */
/* pre-declaration of signal.h types to suppress warnings caused by circular
dependencies */
struct sigevent;
struct tm
{
int tm_sec; /* seconds [0,61] */
int tm_min; /* minutes [0,59] */
int tm_hour; /* hour [0,23] */
int tm_mday; /* day of month [1,31] */
int tm_mon; /* month of year [0,11] */
int tm_year; /* years since 1900 */
int tm_wday; /* day of week [0,6] (Sunday = 0) */
int tm_yday; /* day of year [0,365] */
int tm_isdst; /* daylight savings flag */
};
struct timespec
{
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
};
struct itimerspec
{
struct timespec it_interval; /* timer period */
struct timespec it_value; /* timer expiration */
};
/* CONSTANTS */
/* FIXME: all the constants are wrong */
/* Number of clock ticks per second returned by the times() function (LEGACY). */
#define CLK_TCK (1)
/* A number used to convert the value returned by the clock() function into
seconds. */
#define CLOCKS_PER_SEC (1)
/* The identifier of the systemwide realtime clock. */
#define CLOCK_REALTIME (0)
/* Flag indicating time is absolute with respect to the clock associated with a
timer. */
#define TIMER_ABSTIME (1)
/* PROTOTYPES */
char *asctime(const struct tm *);
char *asctime_r(const struct tm *, char *);
clock_t clock(void);
int clock_getres(clockid_t, struct timespec *);
int clock_gettime(clockid_t, struct timespec *);
int clock_settime(clockid_t, const struct timespec *);
char *ctime(const time_t *);
char *ctime_r(const time_t *, char *);
double difftime(time_t, time_t);
struct tm *getdate(const char *);
struct tm *gmtime(const time_t *);
struct tm *gmtime_r(const time_t *, struct tm *);
struct tm *localtime(const time_t *);
struct tm *localtime_r(const time_t *, struct tm *);
time_t mktime(struct tm *);
int nanosleep(const struct timespec *, struct timespec *);
size_t strftime(char *, size_t, const char *, const struct tm *);
char *strptime(const char *, const char *, struct tm *);
time_t time(time_t *);
int timer_create(clockid_t, struct sigevent *, timer_t *);
int timer_delete(timer_t);
int timer_gettime(timer_t, struct itimerspec *);
int timer_getoverrun(timer_t);
int timer_settime(timer_t, int, const struct itimerspec *,
struct itimerspec *);
void tzset(void);
/* MACROS */
#endif /* __TIME_H_INCLUDED__ */ /* replace with the appropriate tag */
/* EOF */

44
posix/include/types.h Normal file
View File

@@ -0,0 +1,44 @@
/* $Id: types.h,v 1.1 2002/03/22 01:24:49 hyperion Exp $
*/
/*
* types.h
*
* dummy include file for Microsoft POSIX and Interix compatibility
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __TYPES_H_INCLUDED__
#define __TYPES_H_INCLUDED__
/* INCLUDES */
#include <sys/types.h>
/* OBJECTS */
/* TYPES */
/* CONSTANTS */
/* PROTOTYPES */
/* MACROS */
#endif /* __TYPES_H_INCLUDED__ */
/* EOF */

62
posix/include/ucontext.h Normal file
View File

@@ -0,0 +1,62 @@
/* $Id: ucontext.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
*/
/*
* ucontext.h
*
* user context. Conforming to the Single UNIX(r) Specification Version 2,
* System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __UCONTEXT_H_INCLUDED__
#define __UCONTEXT_H_INCLUDED__
/* INCLUDES */
#include <signal.h>
/* OBJECTS */
/* TYPES */
typedef void * mcontext_t;
typedef struct __tagucontext_t ucontext_t;
struct __tagucontext_t
{
ucontext_t *uc_link; /* pointer to the context that will be resumed
when this context returns */
sigset_t uc_sigmask; /* the set of signals that are blocked when this
context is active */
stack_t uc_stack; /* the stack used by this context */
mcontext_t uc_mcontext; /* a machine-specific representation of the saved
context */
};
/* CONSTANTS */
/* PROTOTYPES */
int getcontext(ucontext_t *);
int setcontext(const ucontext_t *);
void makecontext(ucontext_t *, (void *)(), int, ...);
int swapcontext(ucontext_t *, const ucontext_t *);
/* MACROS */
#endif /* __UCONTEXT_H_INCLUDED__ */
/* EOF */

508
posix/include/unistd.h Normal file
View File

@@ -0,0 +1,508 @@
/* $Id: unistd.h,v 1.3 2002/03/22 01:26:28 hyperion Exp $
*/
/*
* unistd.h
*
* standard symbolic constants and types. Conforming to the Single UNIX(r)
* Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __UNISTD_H_INCLUDED__
#define __UNISTD_H_INCLUDED__
/* INCLUDES */
#include <sys/types.h>
#include <stdio.h>
#include <inttypes.h>
/* OBJECTS */
extern char *optarg;
extern int optind, opterr, optopt;
/* TYPES */
/* CONSTANTS */
/* FIXME: set these constants appropriately */
/* Integer value indicating version of the ISO<53>POSIX-1 standard (C
language binding). */
#define _POSIX_VERSION (0)
/* Integer value indicating version of the ISO POSIX-2 standard
(Commands). */
#define _POSIX2_VERSION (0)
/* Integer value indicating version of the ISO POSIX-2 standard (C
language binding). */
#define _POSIX2_C_VERSION (0)
/* Integer value indicating version of the X/Open Portability Guide to
which the implementation conforms. */
#define _XOPEN_VERSION (500)
/* The version of the XCU specification to which the implementation
conforms */
/* TODO: set to an appropriate value when commands and utilities will
be available */
#define _XOPEN_XCU_VERSION (-1)
#if _XOPEN_XCU_VERSION != -1
#error TODO: define these constants
#define _POSIX2_C_BIND
#define _POSIX2_C_VERSION
#define _POSIX2_CHAR_TERM
#define _POSIX2_LOCALEDEF
#define _POSIX2_UPE
#define _POSIX2_VERSION
#endif
#if 0
/* TODO: check for conformance to the following specs */
#define _XOPEN_XPG2
#define _XOPEN_XPG3
#define _XOPEN_XPG4
#define _XOPEN_UNIX
#endif
#if 0
/* TODO: don't forget these features */
/* The use of chown() is restricted to a process with appropriate
privileges, and to changing the group ID of a file only to the
effective group ID of the process or to one of its supplementary
group IDs. */
#define _POSIX_CHOWN_RESTRICTED
/* Terminal special characters defined in <termios.h> can be disabled
using this character value. */
#define _POSIX_VDISABLE
/* Each process has a saved set-user-ID and a saved set-group-ID. */
#define _POSIX_SAVED_IDS
/* Implementation supports job control. */
#define _POSIX_JOB_CONTROL
#endif
/* Pathname components longer than {NAME_MAX} generate an error. */
#define _POSIX_NO_TRUNC (1)
/* The implementation supports the threads option. */
#define _POSIX_THREADS (1)
/* FIXME: none of the following is strictly true yet */
/* The implementation supports the thread stack address attribute
option. */ /* FIXME: not currently implemented. Should be trivial */
#define _POSIX_THREAD_ATTR_STACKADDR (1)
/* The implementation supports the thread stack size attribute
option. */ /* FIXME: not currently implemented. Should be trivial */
#define _POSIX_THREAD_ATTR_STACKSIZE (1)
/* The implementation supports the process-shared synchronisation
option. */ /* FIXME? not sure */
#define _POSIX_THREAD_PROCESS_SHARED (1)
/* The implementation supports the thread-safe functions option. */
/* FIXME: fix errno (currently not thread-safe) */
#define _POSIX_THREAD_SAFE_FUNCTIONS (1)
/*
<20>Constants for Options and Feature Groups
*/
/* Implementation supports the C Language Binding option. This will
always have a value other than -1. */
#define _POSIX2_C_BIND (1)
/* Implementation supports the C Language Development Utilities
option. */ /* FIXME: please change this when C compiler and
utilities are ported */
#define _POSIX2_C_DEV (-1)
/* Implementation supports at least one terminal type. */ /* FIXME:
please change this when terminal emulation is complete */
#define _POSIX2_CHAR_TERM (-1)
/* Implementation supports the FORTRAN Development Utilities option. */
/* FIXME: please change this when Fortran compiler and utilities are
ported */
#define _POSIX2_FORT_DEV (-1)
/* Implementation supports the FORTRAN Run-time Utilities option. */
/* FIXME: please change this when Fortran runtimes are ported */
#define _POSIX2_FORT_RUN (-1)
/* Implementation supports the creation of locales by the localedef
utility. */ /* FIXME: please change this when locales are ready */
#define _POSIX2_LOCALEDEF (-1)
/* Implementation supports the Software Development Utilities option. */
/* FIXME? */
#define _POSIX2_SW_DEV (-1)
/* The implementation supports the User Portability Utilities option. */
/* FIXME? */
#define _POSIX2_UPE (-1)
/* The implementation supports the X/Open Encryption Feature Group. */
/* FIXME: please change this when encryption is ready */
#define _XOPEN_CRYPT (-1)
/* The implementation supports the Issue 4, Version 2 Enhanced
Internationalisation Feature Group. This is always set to a value
other than -1. */ /* TODO: high priority. Support for this feature is
needed for a conforming implementation */
#define _XOPEN_ENH_I18N (-1)
/* The implementation supports the Legacy Feature Group. */
#define _XOPEN_LEGACY (1)
/* The implementation supports the X/Open Realtime Feature Group. */
/* FIXME? unlikely to be ever supported */
#define _XOPEN_REALTIME (-1)
/* The implementation supports the X/Open Realtime Threads Feature
Group. */ /* FIXME? really unlikely to be ever supported */
#define _XOPEN_REALTIME_THREADS (-1)
/* The implementation supports the Issue 4, Version 2 Shared Memory
Feature Group. This is always set to a value other than -1. */ /* TODO:
high priority. Support for this feature is needed for a conforming
implementation */
#define _XOPEN_SHM (-1)
/* Implementation provides a C-language compilation environment with
32-bit int, long, pointer and off_t types. */
#define _XBS5_ILP32_OFF32 (1)
/* Implementation provides a C-language compilation environment with
32-bit int, long and pointer types and an off_t type using at
least 64 bits. */ /* FIXME? check the off_t type */
#define _XBS5_ILP32_OFFBIG (1)
/* Implementation provides a C-language compilation environment with
32-bit int and 64-bit long, pointer and off_t types. */ /* FIXME: on
some architectures this may be true */
#define _XBS5_LP64_OFF64 (-1)
/* Implementation provides a C-language compilation environment with
an int type using at least 32 bits and long, pointer and off_t
types using at least 64 bits. */ /* FIXME: on some architectures
this may be true */
#define _XBS5_LPBIG_OFFBIG (-1)
/* Implementation supports the File Synchronisation option. */
/* TODO: high priority. Implement this */
#define _POSIX_FSYNC
/* Implementation supports the Memory Mapped Files option. */
/* TODO: high priority. Implement this */
#define _POSIX_MAPPED_FILES
/* Implementation supports the Memory Protection option. */
/* TODO: high priority. Implement this */
#define _POSIX_MEMORY_PROTECTION
#if 0
/* Implementation supports the Prioritized Input and Output option. */
/* FIXME? unlikely to be ever supported */
#define _POSIX_PRIORITIZED_IO
#endif
/* FIXME: these should be implemented */
/* Asynchronous input or output operations may be performed for the
associated file. */
#define _POSIX_ASYNC_IO (-1)
/* Prioritized input or output operations may be performed for the
associated file. */
#define _POSIX_PRIO_IO (-1)
/* Synchronised input or output operations may be performed for the
associated file. */
#define _POSIX_SYNC_IO (-1)
/*
null pointer
*/
#ifndef NULL
/* NULL seems to be defined pretty much everywhere - we prevent
redefinition */
#define NULL ((void *)(0))
#endif
/*
constants for the access() function
*/
#define R_OK (0x00000004) /* Test for read permission. */
#define W_OK (0x00000002) /* Test for write permission. */
#define X_OK (0x00000001) /* Test for execute (search) permission. */
#define F_OK (0) /* Test for existence of file. */
/*
constants for the confstr() function
*/
#define _CS_PATH (1)
#define _CS_XBS5_ILP32_OFF32_CFLAGS (2)
#define _CS_XBS5_ILP32_OFF32_LDFLAGS (3)
#define _CS_XBS5_ILP32_OFF32_LIBS (4)
#define _CS_XBS5_ILP32_OFF32_LINTFLAGS (5)
#define _CS_XBS5_ILP32_OFFBIG_CFLAGS (6)
#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS (7)
#define _CS_XBS5_ILP32_OFFBIG_LIBS (8)
#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS (9)
#define _CS_XBS5_LP64_OFF64_CFLAGS (10)
#define _CS_XBS5_LP64_OFF64_LDFLAGS (11)
#define _CS_XBS5_LP64_OFF64_LIBS (12)
#define _CS_XBS5_LP64_OFF64_LINTFLAGS (13)
#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS (14)
#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS (15)
#define _CS_XBS5_LPBIG_OFFBIG_LIBS (16)
#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS (17)
/*
constants for the lseek() and fcntl() functions
*/
#define SEEK_SET (0) /* Set file offset to offset. */
#define SEEK_CUR (1) /* Set file offset to current plus offset. */
#define SEEK_END (2) /* Set file offset to EOF plus offset. */
/*
constants for pathconf()
*/
/* constants 1 to 9 are the same as in Microsoft POSIX */
#define _PC_LINK_MAX ( 1)
#define _PC_MAX_CANON ( 2)
#define _PC_MAX_INPUT ( 3)
#define _PC_NAME_MAX ( 4)
#define _PC_PATH_MAX ( 5)
#define _PC_PIPE_BUF ( 6)
#define _PC_CHOWN_RESTRICTED ( 7)
#define _PC_NO_TRUNC ( 8)
#define _PC_VDISABLE ( 9)
/* from this point, constants are in no particular order */
#define _PC_ALLOC_SIZE_MIN ( 10)
#define _PC_ASYNC_IO ( 11)
#define _PC_FILESIZEBITS ( 12)
#define _PC_PRIO_IO ( 13)
#define _PC_REC_INCR_XFER_SIZE ( 14)
#define _PC_REC_MAX_XFER_SIZE ( 15)
#define _PC_REC_MIN_XFER_SIZE ( 16)
#define _PC_REC_XFER_ALIGN ( 17)
#define _PC_SYNC_IO ( 18)
/*
constants for sysconf()
*/
/* constants 1 to 10 are the same as in Microsoft POSIX */
#define _SC_ARG_MAX ( 1)
#define _SC_CHILD_MAX ( 2)
#define _SC_CLK_TCK ( 3)
#define _SC_NGROUPS_MAX ( 4)
#define _SC_OPEN_MAX ( 5)
#define _SC_JOB_CONTROL ( 6)
#define _SC_SAVED_IDS ( 7)
#define _SC_STREAM_MAX ( 8)
#define _SC_TZNAME_MAX ( 9)
#define _SC_VERSION ( 10)
/* from this point, constants are in no particular order */
#define _SC_2_C_BIND ( 11)
#define _SC_2_C_DEV ( 12)
#define _SC_2_C_VERSION ( 13)
#define _SC_2_FORT_DEV ( 14)
#define _SC_2_FORT_RUN ( 15)
#define _SC_2_LOCALEDEF ( 16)
#define _SC_2_SW_DEV ( 17)
#define _SC_2_UPE ( 18)
#define _SC_2_VERSION ( 19)
#define _SC_AIO_LISTIO_MAX ( 20)
#define _SC_AIO_MAX ( 21)
#define _SC_AIO_PRIO_DELTA_MAX ( 22)
#define _SC_ASYNCHRONOUS_IO ( 23)
#define _SC_ATEXIT_MAX ( 24)
#define _SC_BC_BASE_MAX ( 25)
#define _SC_BC_DIM_MAX ( 26)
#define _SC_BC_SCALE_MAX ( 27)
#define _SC_BC_STRING_MAX ( 28)
#define _SC_COLL_WEIGHTS_MAX ( 29)
#define _SC_DELAYTIMER_MAX ( 30)
#define _SC_EXPR_NEST_MAX ( 31)
#define _SC_FSYNC ( 32)
#define _SC_GETGR_R_SIZE_MAX ( 33)
#define _SC_GETPW_R_SIZE_MAX ( 34)
#define _SC_IOV_MAX ( 35)
#define _SC_LINE_MAX ( 36)
#define _SC_LOGIN_NAME_MAX ( 37)
#define _SC_MAPPED_FILES ( 38)
#define _SC_MEMLOCK ( 39)
#define _SC_MEMLOCK_RANGE ( 40)
#define _SC_MEMORY_PROTECTION ( 41)
#define _SC_MESSAGE_PASSING ( 42)
#define _SC_MQ_OPEN_MAX ( 43)
#define _SC_MQ_PRIO_MAX ( 44)
#define _SC_PAGE_SIZE ( 45)
#define _SC_PASS_MAX ( 46) /* LEGACY */
#define _SC_PRIORITIZED_IO ( 47)
#define _SC_PRIORITY_SCHEDULING ( 48)
#define _SC_RE_DUP_MAX ( 49)
#define _SC_REALTIME_SIGNALS ( 50)
#define _SC_RTSIG_MAX ( 51)
#define _SC_SEMAPHORES ( 52)
#define _SC_SEM_NSEMS_MAX ( 53)
#define _SC_SEM_VALUE_MAX ( 54)
#define _SC_SHARED_MEMORY_OBJECTS ( 55)
#define _SC_SIGQUEUE_MAX ( 56)
#define _SC_SYNCHRONIZED_IO ( 57)
#define _SC_THREADS ( 58)
#define _SC_THREAD_ATTR_STACKADDR ( 59)
#define _SC_THREAD_ATTR_STACKSIZE ( 60)
#define _SC_THREAD_DESTRUCTOR_ITERATIONS ( 61)
#define _SC_THREAD_KEYS_MAX ( 62)
#define _SC_THREAD_PRIORITY_SCHEDULING ( 63)
#define _SC_THREAD_PRIO_INHERIT ( 64)
#define _SC_THREAD_PRIO_PROTECT ( 65)
#define _SC_THREAD_PROCESS_SHARED ( 66)
#define _SC_THREAD_SAFE_FUNCTIONS ( 67)
#define _SC_THREAD_STACK_MIN ( 68)
#define _SC_THREAD_THREADS_MAX ( 69)
#define _SC_TIMERS ( 70)
#define _SC_TIMER_MAX ( 71)
#define _SC_TTY_NAME_MAX ( 72)
#define _SC_XOPEN_VERSION ( 73)
#define _SC_XOPEN_CRYPT ( 74)
#define _SC_XOPEN_ENH_I18N ( 75)
#define _SC_XOPEN_SHM ( 76)
#define _SC_XOPEN_UNIX ( 77)
#define _SC_XOPEN_XCU_VERSION ( 78)
#define _SC_XOPEN_LEGACY ( 79)
#define _SC_XOPEN_REALTIME ( 80)
#define _SC_XOPEN_REALTIME_THREADS ( 81)
#define _SC_XBS5_ILP32_OFF32 ( 82)
#define _SC_XBS5_ILP32_OFFBIG ( 83)
#define _SC_XBS5_LP64_OFF64 ( 84)
#define _SC_XBS5_LPBIG_OFFBIG ( 85)
#define _SC_PAGESIZE _SC_PAGE_SIZE
/* possible values for the function argument to the lockf() function */
#define F_LOCK (1) /* Lock a section for exclusive use. */
#define F_ULOCK (2) /* Unlock locked sections. */
#define F_TEST (3) /* Test section for locks by other processes. */
#define F_TLOCK (4) /* Test and lock a section for exclusive use. */
#define STDIN_FILENO (0) /* File number of stdin. */
#define STDOUT_FILENO (1) /* File number of stdout. */
#define STDERR_FILENO (2) /* File number of stderr. */
/* PROTOTYPES */
int access(const char *, int);
unsigned int alarm(unsigned int);
int brk(void *);
int chdir(const char *);
int chroot(const char *); /* LEGACY */
int chown(const char *, uid_t, gid_t);
int close(int);
size_t confstr(int, char *, size_t);
char *crypt(const char *, const char *);
char *ctermid(char *);
char *cuserid(char *s); /* LEGACY */
int dup(int);
int dup2(int, int);
void encrypt(char[64], int);
int execl(const char *, const char *, ...);
int execle(const char *, const char *, ...);
int execlp(const char *, const char *, ...);
int execv(const char *, char *const []);
int execve(const char *, char *const [], char *const []);
int execvp(const char *, char *const []);
void _exit(int);
int fchown(int, uid_t, gid_t);
int fchdir(int);
int fdatasync(int);
pid_t fork(void);
long int fpathconf(int, int);
int fsync(int);
int ftruncate(int, off_t);
char *getcwd(char *, size_t);
int getdtablesize(void); /* LEGACY */
gid_t getegid(void);
uid_t geteuid(void);
gid_t getgid(void);
int getgroups(int, gid_t []);
long gethostid(void);
char *getlogin(void);
int getlogin_r(char *, size_t);
int getopt(int, char * const [], const char *);
int getpagesize(void); /* LEGACY */
char *getpass(const char *); /* LEGACY */
pid_t getpgid(pid_t);
pid_t getpgrp(void);
pid_t getpid(void);
pid_t getppid(void);
pid_t getsid(pid_t);
uid_t getuid(void);
char *getwd(char *);
int isatty(int);
int lchown(const char *, uid_t, gid_t);
int link(const char *, const char *);
int lockf(int, int, off_t);
off_t lseek(int, off_t, int);
int nice(int);
long int pathconf(const char *, int);
int pause(void);
int pipe(int [2]);
ssize_t pread(int, void *, size_t, off_t);
int pthread_atfork(void (*)(void), void (*)(void),
void(*)(void));
ssize_t pwrite(int, const void *, size_t, off_t);
ssize_t read(int, void *, size_t);
int readlink(const char *, char *, size_t);
int rmdir(const char *);
void *sbrk(intptr_t);
int setgid(gid_t);
int setpgid(pid_t, pid_t);
pid_t setpgrp(void);
int setregid(gid_t, gid_t);
int setreuid(uid_t, uid_t);
pid_t setsid(void);
int setuid(uid_t);
unsigned int sleep(unsigned int);
void swab(const void *, void *, ssize_t);
int symlink(const char *, const char *);
void sync(void);
long int sysconf(int);
pid_t tcgetpgrp(int);
int tcsetpgrp(int, pid_t);
int truncate(const char *, off_t);
char *ttyname(int);
int ttyname_r(int, char *, size_t);
useconds_t ualarm(useconds_t, useconds_t);
int unlink(const char *);
int usleep(useconds_t);
pid_t vfork(void);
ssize_t write(int, const void *, size_t);
/* MACROS */
#endif /* __UNISTD_H_INCLUDED__ */
/* EOF */

50
posix/include/utime.h Normal file
View File

@@ -0,0 +1,50 @@
/* $Id: utime.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
*/
/*
* utime.h
*
* access and modification times structure. Conforming to the Single
* UNIX(r) Specification Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __UTIME_H_INCLUDED__
#define __UTIME_H_INCLUDED__
/* INCLUDES */
#include <sys/types.h>
/* OBJECTS */
/* TYPES */
struct utimbuf
{
time_t actime; /* access time */
time_t modtime; /* modification time */
};
/* CONSTANTS */
/* PROTOTYPES */
int utime(const char *, const struct utimbuf *);
/* MACROS */
#endif /* __UTIME_H_INCLUDED__ */
/* EOF */

139
posix/include/wchar.h Normal file
View File

@@ -0,0 +1,139 @@
/* $Id: wchar.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
*/
/*
* wchar.h
*
* wide-character types. Conforming to the Single UNIX(r) Specification
* Version 2, System Interface & Headers Issue 5
*
* This file is part of the ReactOS Operating System.
*
* Contributors:
* Created by KJK::Hyperion <noog@libero.it>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef __WCHAR_H_INCLUDED__
#define __WCHAR_H_INCLUDED__
/* INCLUDES */
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include <time.h>
/* OBJECTS */
/* TYPES */
typedef wchar_t wint_t; /* An integral type capable of storing any valid
value of wchar_t, or WEOF */
typedef long int wctype_t; /* A scalar type of a data object that can hold
values which represent locale-specific
character classification. */
typedef void * mbstate_t; /* An object type other than an array type that
can hold the conversion state information
necessary to convert between sequences of
(possibly multibyte) characters and
wide-characters */
/* CONSTANTS */
/* PROTOTYPES */
wint_t btowc(int);
int fwprintf(FILE *, const wchar_t *, ...);
int fwscanf(FILE *, const wchar_t *, ...);
int iswalnum(wint_t);
int iswalpha(wint_t);
int iswcntrl(wint_t);
int iswdigit(wint_t);
int iswgraph(wint_t);
int iswlower(wint_t);
int iswprint(wint_t);
int iswpunct(wint_t);
int iswspace(wint_t);
int iswupper(wint_t);
int iswxdigit(wint_t);
int iswctype(wint_t, wctype_t);
wint_t fgetwc(FILE *);
wchar_t *fgetws(wchar_t *, int, FILE *);
wint_t fputwc(wchar_t, FILE *);
int fputws(const wchar_t *, FILE *);
int fwide(FILE *, int);
wint_t getwc(FILE *);
wint_t getwchar(void);
int mbsinit(const mbstate_t *);
size_t mbrlen(const char *, size_t, mbstate_t *);
size_t mbrtowc(wchar_t *, const char *, size_t,
mbstate_t *);
size_t mbsrtowcs(wchar_t *, const char **, size_t,
mbstate_t *);
wint_t putwc(wchar_t, FILE *);
wint_t putwchar(wchar_t);
int swprintf(wchar_t *, size_t, const wchar_t *, ...);
int swscanf(const wchar_t *, const wchar_t *, ...);
wint_t towlower(wint_t);
wint_t towupper(wint_t);
wint_t ungetwc(wint_t, FILE *);
int vfwprintf(FILE *, const wchar_t *, va_list);
int vwprintf(const wchar_t *, va_list);
int vswprintf(wchar_t *, size_t, const wchar_t *,
va_list);
size_t wcrtomb(char *, wchar_t, mbstate_t *);
wchar_t *wcscat(wchar_t *, const wchar_t *);
wchar_t *wcschr(const wchar_t *, wchar_t);
int wcscmp(const wchar_t *, const wchar_t *);
int wcscoll(const wchar_t *, const wchar_t *);
wchar_t *wcscpy(wchar_t *, const wchar_t *);
size_t wcscspn(const wchar_t *, const wchar_t *);
size_t wcsftime(wchar_t *, size_t, const wchar_t *,
const struct tm *);
size_t wcslen(const wchar_t *);
wchar_t *wcsncat(wchar_t *, const wchar_t *, size_t);
int wcsncmp(const wchar_t *, const wchar_t *, size_t);
wchar_t *wcsncpy(wchar_t *, const wchar_t *, size_t);
wchar_t *wcspbrk(const wchar_t *, const wchar_t *);
wchar_t *wcsrchr(const wchar_t *, wchar_t);
size_t wcsrtombs(char *, const wchar_t **, size_t,
mbstate_t *);
size_t wcsspn(const wchar_t *, const wchar_t *);
wchar_t *wcsstr(const wchar_t *, const wchar_t *);
double wcstod(const wchar_t *, wchar_t **);
wchar_t *wcstok(wchar_t *, const wchar_t *, wchar_t **);
long int wcstol(const wchar_t *, wchar_t **, int);
unsigned long int wcstoul(const wchar_t *, wchar_t **, int);
wchar_t *wcswcs(const wchar_t *, const wchar_t *);
int wcswidth(const wchar_t *, size_t);
size_t wcsxfrm(wchar_t *, const wchar_t *, size_t);
int wctob(wint_t);
wctype_t wctype(const char *);
int wcwidth(wchar_t);
wchar_t *wmemchr(const wchar_t *, wchar_t, size_t);
int wmemcmp(const wchar_t *, const wchar_t *, size_t);
wchar_t *wmemcpy(wchar_t *, const wchar_t *, size_t);
wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
wchar_t *wmemset(wchar_t *, wchar_t, size_t);
int wprintf(const wchar_t *, ...);
int wscanf(const wchar_t *, ...);
/* MACROS */
#define WCHAR_MAX (0xFFFF)
#define WCHAR_MIN (0x0000)
/* FIXME? */
#define WEOF (0xFFFF)
#endif /* __WCHAR_H_INCLUDED__ */
/* EOF */

46
posix/lib/crt0w32.c Normal file
View File

@@ -0,0 +1,46 @@
/* $Id: crt0w32.c,v 1.2 2002/04/10 21:30:21 ea Exp $
*
* PROJECT : ReactOS / POSIX+ personality
* FILE : subsys/psx/lib/crt0w32.c
* DESCRIPTION: startup code for POSIX+ applications.
* DATE : 2002-01-18
* AUTHOR : Emanuele Aliberti <eal@users.sf.net>
*/
extern void __stdcall __PdxInitializeData(int*,char***);
extern int main (int,char**,char**);
extern void exit(int);
/* ANSI ENVIRONMENT */
char **_environ = (char**) 0;
int errno = 0;
#ifdef __SUBSYSTEM_WINDOWS__
void WinMainCRTStartup (void)
#else
void mainCRTStartup (void)
#endif
{
char * argv[2] = {"none", 0};
/* TODO: parse the command line */
exit(main(1,argv,0));
}
void __main ()
{
/*
* Store in PSXDLL.DLL two well known global symbols
* references.
*/
__PdxInitializeData (& errno, & _environ); /* PSXDLL.__PdxInitializeData */
/* CRT initialization. */
#ifdef __SUBSYSTEM_WINDOWS__
WinMainCRTStartup ();
#else
mainCRTStartup ();
#endif
}
/* EOF */

140
posix/lib/psxdll/Makefile Normal file
View File

@@ -0,0 +1,140 @@
# $Id: Makefile,v 1.7 2002/03/23 18:13:33 hyperion Exp $
PATH_TO_TOP = ../../../..
TARGET_TYPE = dynlink
TARGET_NAME = psxdll
TARGET_LIBPATH = $(PATH_TO_TOP)/dk/psx/lib
TARGET_LFLAGS = -nostartfiles
TARGET_SDKLIBS = ntdll.a
TARGET_BASE = 0x68EB0000
TARGET_ENTRY = _DllMain@12
TARGET_CFLAGS =\
-Wall \
-nostdinc \
-nostdlib \
-fno-builtin \
-I$(PATH_TO_TOP)/subsys/psx/include \
-I$(PATH_TO_TOP)/include \
-D__PSXDLL__ \
-D__PSX_DEBUG_WANT_ALL__
TARGET_OBJECTS = $(TARGET_NAME).o
TARGET_CLEAN = $(OBJECTS) csrapi.a
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
OBJECTS_MISC = \
misc/main.o \
misc/init.o \
misc/heap.o \
misc/interlock.o \
misc/safeobj.o \
misc/spawn.o \
misc/path.o \
misc/pdata.o \
misc/fdtable.o
OBJECTS_DIRENT = \
dirent/opendir.o \
dirent/readdir.o \
dirent/closedir.o
OBJECTS_DLFCN = \
dlfcn/dlopen.o \
dlfcn/dlclose.o \
dlfcn/dlsym.o \
dlfcn/dlerror.o
OBJECTS_ERRNO = \
errno/errno.o
OBJECTS_FCNTL = \
fcntl/open.o \
fcntl/fcntl.o
OBJECTS_LIBGEN = \
libgen/basename.o
OBJECTS_SCHED = \
sched/yield.o
OBJECTS_SIGNAL = \
pthread/kill.o \
signal/raise.o
OBJECTS_STDLIB = \
stdlib/abort.o \
stdlib/malloc.o \
stdlib/exit.o
OBJECTS_STRING = \
string/strdup.o \
string/strerror.o
OBJECTS_PTHREAD = \
pthread/create.o \
pthread/exit.o \
pthread/join.o \
pthread/mutex.o \
pthread/self.o
OBJECTS_SYS_UTSNAME = \
sys/utsname/uname.o
OBJECTS_UNISTD = \
unistd/close.o \
unistd/dup.o \
unistd/getcwd.o \
unistd/getpid.o \
unistd/getppid.o \
unistd/read.o \
unistd/write.o
OBJECTS = \
$(OBJECTS_MISC) \
$(OBJECTS_DIRENT) \
$(OBJECTS_DLFCN) \
$(OBJECTS_ERRNO) \
$(OBJECTS_FCNTL) \
$(OBJECTS_LIBGEN) \
$(OBJECTS_SCHED) \
$(OBJECTS_SIGNAL) \
$(OBJECTS_STDLIB) \
$(OBJECTS_STRING) \
$(OBJECTS_PTHREAD) \
$(OBJECTS_SYS_UTSNAME) \
$(OBJECTS_UNISTD)
DEP_OBJECTS = $(OBJECTS)
include $(TOOLS_PATH)/depend.mk
DTFLAGS = -k -l $@
$(TARGET_NAME).a: $(TARGET_NAME).def
$(DLLTOOL) \
$(DTFLAGS) \
-D $(TARGET_NAME).dll \
-d $(TARGET_NAME).def
csrapi.a: csrapi.def
$(DLLTOOL) \
$(DTFLAGS) \
-D ntdll.dll \
-d csrapi.def
$(TARGET_NAME).o: csrapi.a $(OBJECTS)
$(LD) -r $(OBJECTS) -o $(TARGET_NAME).o
# EOF

Some files were not shown because too many files have changed in this diff Show More