NT POSIX subsystem

From DisNCord Community Wiki
Revision as of 16:08, 25 November 2022 by Dr. Shuppet (talk | contribs) (Fixed references)
Jump to navigation Jump to search

The NT POSIX subsystem, officially known as Microsoft POSIX subsystem, is a subsystem for Windows NT, shipped from Windows NT 3.1 to Windows 2000. It implements an early version of the POSIX standard called POSIX.1, codified as IEEE Std 1003.1-1988, ISO/IEC 9945-1:1990 and FIPS 151-2. This topic was explored in an NCommander stream, from which a video is in progress.

The standard includes process creation and control, signal handling, filesystem IO and the standard C library. The NT POSIX subsystem implements a bare minimum of what is needed for compliance. Windows NT 3.5, 3.51 and 4.0 are officially FIPS 151-2 compliant[1].

The NT POSIX subsystem was removed in Windows XP, being replaced with Windows Services for Unix, a product based on Interix, Unix compatibiliy software developed by Softway Systems and later bought by Microsoft. (Whether the original subsystem works on XP or later versions of Windows is not known.)

Runtime

The core of the POSIX subsystem is PSXSS.EXE, a Win32 binary that is one of the default NT subsystems alongside CSRSS.EXE and OS2SS.EXE. This can be seen under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Session Manager\SubSystems. NT applications won't run without the subsystem proper running.

There are two more binaries that handle communication of POSIX applications with the OS. PSXDLL.DLL is an NT POSIX dynamic library that handles calling into the POSIX subsystem, similarly to what KERNEL32.DLL, USER32.DLL etc. do for the Win32 subsystem. Finally, there is POSIX.EXE, providing integration with the standard Windows UI, that is displaying an interactive console window. This is very similar to the role of OS2.EXE in the OS/2 subsystem.

Functionality

The full list of features can be found in the POSIX.1 standard. As of features unusual on Windows NT, the subsystem includes an implementation of fork, case-sensitive files and Unix permissions.

Development

Windows SDK includes libcpsx.lib, psxdll.lib and psxrtl.lib, libraries used for linking binaries using the POSIX subsystem, as well as an incomplete copy of header files (e.g. stdio.h is missing). The rest of the header files are shipped with Microsoft Visual C++[2].

Open Watcom and Microsoft Visual C++ both support building POSIX binaries. Microsoft also ships a buggy cc wrapper, allowing to call Visual C++ from a POSIX environment, however it was shown on the NCommander stream that its practical usability is very limited.

Applications

Windows NT 4.0 Resource Kit ships with a few applications for the POSIX subsystem. These are cat, chmod, chown, cp, find, grep, ln, ls, mkdir, mv, rm, rmdir, sh, touch, vi, and wc.

References