add ntfs.sys standalone driver target, change default usb vhd layout formatting to ntfs, implement Fat32CreateDir for directory creation support in the fat32 file system driver, add a dedicated HAL serial output endpoint for COM1 writes in hal_serial.c and subscribe serial to HAL text streams, introduce waitable kernel timers with KeTimerCreate, KeTimerSet, and KeTimerCancel alongside spinlock-protected global timer list initialization and scheduler tick tracking, implement SyscallWriteFileAsync system call for asynchronous non-blocking file writes, refactor NetSocketConnect and NetSocketSendTo to use generic SYS_SOCKET_ADDRESS_K structures instead of being hardcoded to IPv4, update gethostbyname and DNS name resolution to support IPv6 parsing via ResolveNameFamily, update tcpserve.exe with -4 and -6 command-line flags to accept and display IPv6 addresses, append size and version headers to all kernel telemetry and statistics structures including SYS_PMM_STATS, SYS_CPU_STATS, and SYS_SCHEDULER_STATS, update winmm timeGetTime to look up high-resolution hardware frequencies via SysGetTickFrequency, integrate 14 native smoke test applications.
This commit is contained in:
1 parent
2c4a68a75f
commit
ed3d065abd
156 files changed
+10509
-2643
No files matched your search
@@ -14,7 +14,11 @@ __declspec(dllexport) void clearscreen(void) {
|
||||
|
||||
// Implements the clearkeyboard operation.
|
||||
__declspec(dllexport) void clearkeyboard(void) {
|
||||
while (SysPollKeyboard()) (void)SysReadKeyboardChar();
|
||||
INPUT_KEY key;
|
||||
while (SysPollKeyboard(&key) == STATUS_SUCCESS) {
|
||||
char ignored;
|
||||
(void)SysReadKeyboardChar(&ignored);
|
||||
}
|
||||
}
|
||||
|
||||
// Opens the requested operation.
|
||||
@@ -37,17 +41,33 @@ __declspec(dllexport) int open(const char* path, int flags, ...) {
|
||||
}
|
||||
|
||||
uint32_t kh = 0;
|
||||
SYS_PATH_HANDLE_REQUEST req = { SysSvFromCstr(p), &kh };
|
||||
uint32_t s;
|
||||
if (flags & O_WRONLY) {
|
||||
s = SysCreateFile(&req);
|
||||
} else {
|
||||
s = SysOpenFile(&req);
|
||||
}
|
||||
if (s != 0) { errno = PosixStatusToErrno(s); return -1; }
|
||||
uint32_t access = SYS_FILE_ACCESS_QUERY;
|
||||
uint32_t disposition = SYS_FILE_OPEN_EXISTING;
|
||||
|
||||
if ((flags & O_TRUNC) && (flags & O_WRONLY))
|
||||
SysTruncateFile(kh, 0);
|
||||
if ((flags & O_RDWR) == O_RDWR)
|
||||
access |= SYS_FILE_ACCESS_READ | SYS_FILE_ACCESS_WRITE;
|
||||
else if (flags & O_WRONLY)
|
||||
access |= SYS_FILE_ACCESS_WRITE;
|
||||
else
|
||||
access |= SYS_FILE_ACCESS_READ;
|
||||
|
||||
if (flags & O_APPEND)
|
||||
access |= SYS_FILE_ACCESS_APPEND;
|
||||
|
||||
if ((flags & O_CREAT) && (flags & O_TRUNC))
|
||||
disposition = SYS_FILE_CREATE_ALWAYS;
|
||||
else if (flags & O_CREAT)
|
||||
disposition = SYS_FILE_OPEN_ALWAYS;
|
||||
else if (flags & O_TRUNC)
|
||||
disposition = SYS_FILE_TRUNCATE_EXISTING;
|
||||
|
||||
SYS_OPEN_FILE_REQUEST req = SysMakeOpenFileRequest(SysSvFromCstr(p),
|
||||
access,
|
||||
disposition,
|
||||
SYS_FILE_FLAG_NONE,
|
||||
&kh);
|
||||
uint32_t s = SysOpenFile(&req);
|
||||
if (s != 0) { errno = PosixStatusToErrno(s); return -1; }
|
||||
|
||||
int fd = FdAlloc(pid, type, kh);
|
||||
if (fd < 0) {
|
||||
@@ -69,7 +89,8 @@ __declspec(dllexport) ssize_t read(int fd, void* buf, size_t count) {
|
||||
// Read up to count chars from keyboard, blocking per char.
|
||||
char* dst = (char*)buf;
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
dst[i] = SysReadKeyboardChar();
|
||||
uint32_t s = SysReadKeyboardChar(&dst[i]);
|
||||
if (s != STATUS_SUCCESS) { errno = PosixStatusToErrno(s); return -1; }
|
||||
if (dst[i] == '\n' || dst[i] == '\r') return (ssize_t)(i + 1);
|
||||
}
|
||||
return (ssize_t)count;
|
||||
@@ -174,13 +195,17 @@ __declspec(dllexport) off_t lseek(int fd, off_t offset, int whence) {
|
||||
target = (int64_t)offset;
|
||||
break;
|
||||
case SEEK_CUR: {
|
||||
uint64_t cur = SysGetFilePos(e->KHandle);
|
||||
uint64_t cur = 0;
|
||||
uint32_t s = SysGetFilePos(e->KHandle, &cur);
|
||||
if (s != 0) { errno = PosixStatusToErrno(s); return -1; }
|
||||
if (cur > 0x7FFFFFFFULL) { errno = EINVAL; return -1; }
|
||||
target = (int64_t)cur + (int64_t)offset;
|
||||
break;
|
||||
}
|
||||
case SEEK_END: {
|
||||
uint64_t size = SysGetFileSize(e->KHandle);
|
||||
uint64_t size = 0;
|
||||
uint32_t s = SysGetFileSize(e->KHandle, &size);
|
||||
if (s != 0) { errno = PosixStatusToErrno(s); return -1; }
|
||||
if (size > 0x7FFFFFFFULL) { errno = EINVAL; return -1; }
|
||||
target = (int64_t)size + (int64_t)offset;
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user