isolate POSIX builds from the host UCRT, wire lwext4 and ntfs-3g as ext4.sys and ntfs.sys, split the FAT driver into directory/file/async/driver/mount units, add posixsrv and dwm plus input/console/desktop syscall clients and a pile of new smoke targets, rename serial.sys to cereal.sys, name HDA/USB/lwIP/AHCI workers, harden ATA probing/reset/removal around actual hardware deadlines, absent-channel detection, diagnostics and explicit worker lifetime, redo ACPI S5 shutdown around GAS/MMIO and HW-reduced firmware, scan SSDTs for _S5 and deal with Intel SMI sleep trapping, make serial and SMP timeouts use real monotonic deadlines, add thread names and fix terminal thread teardown, scheduler and APC prepare/commit races, make advisory file locks queryable and preserve split ranges and add mutable file append state, add shared-memory pipes with kernel-assisted wait/wake, introduce capability-scoped input and display managers, split surface map rights into read/write, add explicit unmap and replace present with commit/generation/damage tracking while keeping physical presentation under the display manager, decouple native exception classes from Win32 exception numbers and translate them in kernel32, add opaque process startup data, bump the resource protocol to v3 with namespace directories, symlinks and enumeration and service control to v2 with generic READY handle exports, add the new POSIX errno/status surface and rebuild fds around posixsrv-owned shared open descriptions, descriptor-local flags, exact inheritance snapshots, dup/fcntl/record locks and shared-ring pipes, add waitpid, POSIX credentials/groups/sessions/passwd/group lookups and move sockets onto stable open descriptions, port the shells and apps to the new console/input services and surface commit API, teach init to load services.ini and start/supervise RSSRV, DWM and generic services under restricted capabilities while publishing their endpoints through RSSRV, split RSSRV into namespace, volume, display, session, input, console and resource components and make /SystemRoot a real symlink to the independently published system volume, shift the syscall table again, expand lock/resource/surface/POSIX/service/thread smoke coverage, make docs scream ASK QUESTIONS and DISCUSS at LLMs, replace MIT No Attribution with WTFPL+.

This commit is contained in:
maksw committed 2026-09-16 10:33:20 +02:00
1 parent 3dacbd32c8
commit 73abd6f90d
441 files changed
+187073 -6549

No files matched your search

+219
View File
@@ -0,0 +1,219 @@
// Native POSIX personality-server discovery, process identity, and shared-attribute protocol.
#pragma once
#include <stdint.h>
#include <ntlite/status.h>
#include <ntlite/syscall.h>
#define NTL_POSIX_SERVICE_PATH "/Services/posix"
#define NTL_POSIX_PROTOCOL_VERSION 6u
#define NTL_POSIX_REQUEST_FLAG_NONE 0u
#define NTL_POSIX_OP_QUERY 1u
#define NTL_POSIX_OP_BEGIN_TRANSACTION 2u
#define NTL_POSIX_OP_CANCEL_TRANSACTION 3u
#define NTL_POSIX_OP_REGISTER_PROCESS 4u
#define NTL_POSIX_OP_GET_PROCESS_ATTRIBUTES 5u
#define NTL_POSIX_OP_SET_CURRENT_DIRECTORY 6u
#define NTL_POSIX_OP_SET_UID 7u
#define NTL_POSIX_OP_SET_GID 8u
#define NTL_POSIX_OP_SET_PROCESS_GROUP 9u
#define NTL_POSIX_OP_CREATE_SESSION 10u
#define NTL_POSIX_OP_LOOKUP_USER 11u
#define NTL_POSIX_OP_LOOKUP_GROUP 12u
#define NTL_POSIX_OP_CREATE_OPEN_DESCRIPTION 13u
#define NTL_POSIX_OP_RELEASE_OPEN_DESCRIPTION 14u
#define NTL_POSIX_OP_SET_OPEN_STATUS 15u
#define NTL_POSIX_OP_CREATE_PIPE 16u
#define NTL_POSIX_OP_CREATE_FD_INHERITANCE 17u
#define NTL_POSIX_OP_IMPORT_FD_INHERITANCE 18u
#define NTL_POSIX_OP_CANCEL_FD_INHERITANCE 19u
#define NTL_POSIX_OP_ARM_FD_INHERITANCE 20u
#define NTL_POSIX_TRANSACTION_NONE 0u
#define NTL_POSIX_TRANSACTION_SPAWN 1u
#define NTL_POSIX_TRANSACTION_EXEC 2u
#define NTL_POSIX_PROCESS_STATE_NONE 0u
#define NTL_POSIX_PROCESS_STATE_RUNNING 1u
#define NTL_POSIX_PROCESS_STATE_EXITED 2u
#define NTL_POSIX_LOOKUP_NONE 0u
#define NTL_POSIX_LOOKUP_BY_ID 1u
#define NTL_POSIX_LOOKUP_BY_NAME 2u
#define NTL_POSIX_TRANSACTION_CAPACITY 8u
#define NTL_POSIX_SUPPLEMENTARY_GROUP_MAX 16u
#define NTL_POSIX_IDENTITY_NAME_MAX 63u
#define NTL_POSIX_IDENTITY_HOME_MAX 255u
#define NTL_POSIX_IDENTITY_SHELL_MAX 255u
// POSIX open-description kinds shared between posix.dll and posixsrv.
#define NTL_POSIX_OPEN_TYPE_FILE 1u
#define NTL_POSIX_OPEN_TYPE_CONSOLE_READ 2u
#define NTL_POSIX_OPEN_TYPE_CONSOLE_WRITE 3u
#define NTL_POSIX_OPEN_TYPE_DEV_NULL 4u
#define NTL_POSIX_OPEN_TYPE_DEV_ZERO 5u
#define NTL_POSIX_OPEN_TYPE_SOCKET 6u
#define NTL_POSIX_OPEN_TYPE_PIPE_READ 7u
#define NTL_POSIX_OPEN_TYPE_PIPE_WRITE 8u
// Values intentionally match the public POSIX fcntl ABI; posixsrv owns policy but
// does not include personality headers.
#define NTL_POSIX_OPEN_STATUS_RDONLY 0x0000u
#define NTL_POSIX_OPEN_STATUS_WRONLY 0x0001u
#define NTL_POSIX_OPEN_STATUS_RDWR 0x0002u
#define NTL_POSIX_OPEN_STATUS_ACCMODE 0x0003u
#define NTL_POSIX_OPEN_STATUS_APPEND 0x0400u
#define NTL_POSIX_OPEN_STATUS_NONBLOCK 0x0800u
#define NTL_POSIX_OPEN_STATUS_VALID_MASK \
(NTL_POSIX_OPEN_STATUS_ACCMODE | NTL_POSIX_OPEN_STATUS_APPEND | NTL_POSIX_OPEN_STATUS_NONBLOCK)
#define NTL_POSIX_SHARED_OPEN_MAGIC 0x31444F50u
#define NTL_POSIX_SHARED_OPEN_VERSION 2u
#define NTL_POSIX_FD_INHERIT_MAX 64u
#define NTL_POSIX_FD_IMPORT_BATCH_MAX SYS_PORT_MAX_TRANSFER_HANDLES
#define NTL_POSIX_FD_INHERIT_FLAG_NONE 0u
#define NTL_POSIX_FD_DESCRIPTOR_CLOEXEC 0x00000001u
#define NTL_POSIX_FD_HANDLE_NONE UINT32_MAX
typedef struct NTL_POSIX_FD_MANIFEST_ENTRY {
int32_t Descriptor;
uint32_t DescriptorFlags;
uint64_t OpenDescriptionId;
} NTL_POSIX_FD_MANIFEST_ENTRY;
typedef struct NTL_POSIX_FD_DESCRIPTION_ENTRY {
uint64_t OpenDescriptionId;
uint64_t SharedOpenDescription;
uint32_t OpenDescriptionType;
uint32_t OpenStatusFlags;
uint32_t HandleIndex;
uint32_t Reserved;
} NTL_POSIX_FD_DESCRIPTION_ENTRY;
// Hot open-description state lives in posixsrv-owned userspace memory. In the
// single-address-space model clients use this pointer directly; lifetime remains
// authoritative in posixsrv rather than in writable shared fields.
typedef struct NTL_POSIX_SHARED_OPEN_DESCRIPTION {
uint32_t Magic;
uint32_t Version;
uint32_t Type;
uint32_t Reserved;
uint64_t DescriptionId;
volatile long StatusFlags;
uint32_t Reserved2;
// Optional server-owned userspace data-plane pointer. Pipe endpoint
// descriptions use this for SYS_PIPE_SHARED_STATE; other types leave it zero.
uint64_t SharedObjectData;
} NTL_POSIX_SHARED_OPEN_DESCRIPTION;
// Future server-owned spawn/exec builders place this opaque personality payload
// in the generic userspace process-loader startup data. Zero token/PID/generation
// means an ordinary process is self-registering for the first time.
#define NTL_POSIX_BOOTSTRAP_MAGIC 0x3258504Eu
#define NTL_POSIX_BOOTSTRAP_VERSION 2u
typedef struct NTL_POSIX_BOOTSTRAP_DATA {
uint32_t Magic;
uint32_t Version;
uint32_t Size;
uint32_t Reserved;
uint64_t Token;
uint32_t PosixPid;
uint32_t Generation;
uint64_t FdInheritanceToken;
} NTL_POSIX_BOOTSTRAP_DATA;
// Requests remain fixed-size through P4 open-description control. Later spawn/exec
// transactions may layer bounded multi-message payloads over this header.
typedef struct NTL_POSIX_REQUEST {
uint32_t Size;
uint32_t Version;
uint32_t Operation;
uint32_t Flags;
uint32_t TransactionId;
uint32_t TransactionKind;
uint64_t BootstrapToken;
uint32_t BootstrapPosixPid;
uint32_t BootstrapGeneration;
uint32_t TargetPosixPid;
uint32_t UserId;
uint32_t GroupId;
uint32_t ProcessGroupId;
uint32_t LookupKind;
uint32_t OpenDescriptionType;
uint32_t OpenStatusFlags;
uint64_t OpenDescriptionId;
uint32_t NameLength;
uint32_t PathLength;
uint64_t FdInheritanceToken;
uint32_t FdInheritanceIndex;
uint32_t FdInheritanceCount;
uint32_t FdInheritanceFlags;
uint32_t Reserved[2];
NTL_POSIX_FD_MANIFEST_ENTRY FdManifest[NTL_POSIX_FD_INHERIT_MAX];
char Name[NTL_POSIX_IDENTITY_NAME_MAX + 1u];
char Path[SYS_PATH_MAX + 1u];
} NTL_POSIX_REQUEST;
// Replies expose stable POSIX identity and the server-owned shared process
// attributes. Lookup operations reuse the identity strings and ID fields.
typedef struct NTL_POSIX_REPLY {
uint32_t Size;
uint32_t Version;
uint32_t Operation;
uint32_t Flags;
KSTATUS Status;
uint32_t TransactionId;
uint32_t ClientProcessId;
uint32_t ClientSecurityId;
uint32_t ActiveTransactions;
uint32_t TransactionCapacity;
uint32_t PosixPid;
uint32_t NativeGeneration;
uint32_t ProcessState;
uint32_t RegisteredProcesses;
uint32_t RegisteredOpenDescriptions;
uint32_t OpenDescriptionType;
uint32_t OpenStatusFlags;
uint64_t OpenDescriptionId;
uint64_t SharedOpenDescription;
uint32_t OpenDescriptionType2;
uint32_t OpenStatusFlags2;
uint64_t OpenDescriptionId2;
uint64_t SharedOpenDescription2;
uint64_t FdInheritanceToken;
uint32_t FdInheritanceIndex;
uint32_t FdInheritanceCount;
uint32_t FdDescriptionIndex;
uint32_t FdDescriptionCount;
uint32_t FdDescriptionTotal;
NTL_POSIX_FD_MANIFEST_ENTRY FdManifest[NTL_POSIX_FD_INHERIT_MAX];
NTL_POSIX_FD_DESCRIPTION_ENTRY FdDescriptions[NTL_POSIX_FD_IMPORT_BATCH_MAX];
uint32_t ParentPosixPid;
uint32_t UserId;
uint32_t EffectiveUserId;
uint32_t GroupId;
uint32_t EffectiveGroupId;
uint32_t ProcessGroupId;
uint32_t SessionId;
uint32_t SupplementaryGroupCount;
uint32_t SupplementaryGroups[NTL_POSIX_SUPPLEMENTARY_GROUP_MAX];
uint32_t NameLength;
uint32_t HomeLength;
uint32_t ShellLength;
uint32_t CurrentDirectoryLength;
char Name[NTL_POSIX_IDENTITY_NAME_MAX + 1u];
char Home[NTL_POSIX_IDENTITY_HOME_MAX + 1u];
char Shell[NTL_POSIX_IDENTITY_SHELL_MAX + 1u];
char CurrentDirectory[SYS_PATH_MAX + 1u];
} NTL_POSIX_REPLY;