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:
1 parent
3dacbd32c8
commit
73abd6f90d
441 files changed
+187073
-6549
No files matched your search
@@ -4,51 +4,21 @@
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <ntlite/syscall.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
#include <spawn.h>
|
||||
#include <sys/wait.h>
|
||||
#include <ntlite/posix_extensions.h>
|
||||
|
||||
#define MAX_CMD 256
|
||||
#define NAME_MAX 259
|
||||
|
||||
typedef struct dirent { char d_name[NAME_MAX + 1]; unsigned char d_type; } dirent;
|
||||
typedef struct DIR { uint32_t KHandle; dirent Current; bool Valid; } DIR;
|
||||
|
||||
extern int read(int fd, void* buf, size_t count);
|
||||
extern int write(int fd, const void* buf, size_t count);
|
||||
extern int open(const char* pathname, int flags, ...);
|
||||
extern int close(int fd);
|
||||
extern int chdir(const char* path);
|
||||
extern DIR* opendir(const char* path);
|
||||
extern dirent* readdir(DIR* d);
|
||||
extern int closedir(DIR* d);
|
||||
extern int unlink(const char* pathname);
|
||||
extern int posix_spawn(int* pid, const char* path, const void* act, const void* attr, char* const argv[], char* const envp[]);
|
||||
extern int waitpid(int pid, int* status, int options);
|
||||
extern void* malloc(size_t size);
|
||||
extern void* realloc(void* ptr, size_t size);
|
||||
extern void free(void* ptr);
|
||||
extern void exit(int status);
|
||||
extern void clearscreen(void);
|
||||
extern void clearkeyboard(void);
|
||||
|
||||
static int hIn = 0; static int hOut = 1;
|
||||
|
||||
// Prints the requested operation.
|
||||
static void print(const char* s) { write(hOut, s, strlen(s)); }
|
||||
|
||||
// Prints u Int.
|
||||
static void printUInt(uint32_t n) {
|
||||
char buf[12]; int i = 0;
|
||||
if (n == 0) { print("0"); return; }
|
||||
while (n > 0) { buf[i++] = (char)('0' + n % 10); n /= 10; }
|
||||
while (i > 0) { char c[2] = { buf[--i], '\0' }; print(c); }
|
||||
}
|
||||
|
||||
// Prints int.
|
||||
static void printInt(int32_t n) {
|
||||
if (n < 0) { print("-"); n = -n; }
|
||||
printUInt((uint32_t)n);
|
||||
}
|
||||
|
||||
// Returns line.
|
||||
static void readLine(char* buf, int len) {
|
||||
int pos = 0;
|
||||
@@ -202,7 +172,7 @@ static void cmd_dir(const char* path) {
|
||||
closedir(d);
|
||||
shellSortDirEntries(entries, count);
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
print(entries[i].Type == 1 ? "<DIR> " : " ");
|
||||
print(entries[i].Type == DT_DIR ? "<DIR> " : " ");
|
||||
print(entries[i].Name);
|
||||
print("\n");
|
||||
}
|
||||
@@ -213,7 +183,8 @@ static void cmd_dir(const char* path) {
|
||||
static void cmd_type(const char* filename) {
|
||||
int fd = open(filename, 0); // O_RDONLY
|
||||
if (fd < 0) { print("type: cannot open file\n"); return; }
|
||||
char buffer[512]; int n;
|
||||
char buffer[512];
|
||||
ssize_t n;
|
||||
while ((n = read(fd, buffer, 511)) > 0) { buffer[n] = '\0'; print(buffer); }
|
||||
close(fd); print("\n");
|
||||
}
|
||||
@@ -224,7 +195,7 @@ static int runCommand(const char* cmd) {
|
||||
if (strcmp(cmd, "exit") == 0) return 1;
|
||||
if (strcmp(cmd, "help") == 0) { cmd_help(); return 0; }
|
||||
if (strcmp(cmd, "clear") == 0) { clearscreen(); return 0; }
|
||||
if (strcmp(cmd, "crash") == 0) { *(int*)0 = 42; return 0; }
|
||||
if (strcmp(cmd, "crash") == 0) { *(volatile int*)0 = 42; return 0; }
|
||||
if (strcmp(cmd, "dir") == 0) { cmd_dir("."); return 0; }
|
||||
if (strncmp(cmd, "dir ", 4) == 0) { cmd_dir(cmd + 4); return 0; }
|
||||
if (strncmp(cmd, "cd ", 3) == 0) { if (chdir(cmd + 3) != 0) print("cd: failed\n"); return 0; }
|
||||
@@ -251,7 +222,7 @@ static int runCommand(const char* cmd) {
|
||||
// Runs the requested operation.
|
||||
int main(void) {
|
||||
|
||||
const char* cmdline = SysGetPeb()->CommandLine.Data;
|
||||
const char* cmdline = posix_get_command_line();
|
||||
char lineBuf[MAX_CMD];
|
||||
|
||||
print("shell: command line: ");
|
||||
|
||||
Reference in new issue
Block a user