clean up and standardize types across the codebase, unify atomic operations, improve UTF-8 handling throughout the system, remove obsolete input and named queue interfaces, redesign process preparation and creation, tighten IPC and service boundaries, improve error handling and reliability, minor documentation cleanup, fix doom surfaces, fix panic in ini parsing.

This commit is contained in:
maksw committed 2026-10-12 18:17:43 +02:00
1 parent 899225f551
commit c0ad63c27f
226 files changed
+6562 -4147

No files matched your search

@@ -1,6 +1,7 @@
// Advisory file-lock smoke test.
// Verifies process-owned byte-range conflicts, timeout behavior, and exit cleanup.
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <string.h>
@@ -45,7 +46,7 @@ static void exit_now(int32_t code) {
}
// Fails the test with one status value.
static void fail_status(const char* what, uint32_t status) {
static void fail_status(const char* what, KSTATUS status) {
print("file_lock_smoke: ");
print(what);
print(" status=");
@@ -68,9 +69,9 @@ static void delete_path(const char* path) {
}
// Opens one path with lock rights.
static uint32_t open_existing_lockable(const char* path, uint32_t* fileOut) {
static KSTATUS open_existing_lockable(const char* path, uint32_t* fileOut) {
uint32_t h = 0;
uint32_t s = NtlOpenFile(SysSvFromCstr(path),
KSTATUS s = NtlOpenFile(SysSvFromCstr(path),
SYS_FILE_ACCESS_QUERY | SYS_FILE_ACCESS_LOCK,
SYS_FILE_OPEN_EXISTING,
SYS_FILE_FLAG_NONE,
@@ -81,7 +82,7 @@ static uint32_t open_existing_lockable(const char* path, uint32_t* fileOut) {
}
// Creates a temporary file on the first writable path that works.
static uint32_t create_temp_file(uint32_t* fileOut, const char** pathOut) {
static KSTATUS create_temp_file(uint32_t* fileOut, const char** pathOut) {
static const char* paths[] = {
"file_lock_smoke.tmp",
};
@@ -89,7 +90,7 @@ static uint32_t create_temp_file(uint32_t* fileOut, const char** pathOut) {
for (size_t i = 0; i < sizeof(paths) / sizeof(paths[0]); i++) {
uint32_t h = 0;
delete_path(paths[i]);
uint32_t s = NtlOpenFile(SysSvFromCstr(paths[i]),
KSTATUS s = NtlOpenFile(SysSvFromCstr(paths[i]),
SYS_FILE_ACCESS_READ | SYS_FILE_ACCESS_WRITE | SYS_FILE_ACCESS_QUERY | SYS_FILE_ACCESS_LOCK,
SYS_FILE_CREATE_NEW,
SYS_FILE_FLAG_NONE,
@@ -145,30 +146,30 @@ static uint32_t query_range(uint32_t file, uint32_t mode, uint64_t offset, uint6
}
// Splits the child command line into mode and path.
static int parse_child_command(SYS_STRING_VIEW view, char* mode, size_t modeCap, char* path, size_t pathCap) {
static bool parse_child_command(SYS_STRING_VIEW view, char* mode, size_t modeCap, char* path, size_t pathCap) {
if (!view.Data || view.Length == 0)
return 0;
return false;
size_t sep = 0;
while (sep < view.Length && view.Data[sep] != ':')
sep++;
if (sep == view.Length || sep + 1 >= view.Length)
return 0;
return false;
if (sep + 1 > modeCap || view.Length - sep > pathCap)
return 0;
return false;
memcpy(mode, view.Data, sep);
mode[sep] = '\0';
memcpy(path, view.Data + sep + 1, view.Length - sep - 1);
path[view.Length - sep - 1] = '\0';
return 1;
return true;
}
// Returns whether two NUL-terminated strings are equal.
static int str_eq(const char* a, const char* b) {
static bool str_eq(const char* a, const char* b) {
return strcmp(a, b) == 0;
}
// Returns whether one mode name belongs to the child command protocol.
static int is_child_mode(const char* mode) {
static bool is_child_mode(const char* mode) {
return str_eq(mode, "excl-blocked") ||
str_eq(mode, "excl-timeout") ||
str_eq(mode, "excl-wait") ||
@@ -277,7 +278,7 @@ static void run_child_expect_success(const char* mode, const char* path) {
req.SecurityContext = SYS_SECURITY_CONTEXT_CURRENT;
req.ResolveModuleName = NtlResolveSystemModuleName;
req.ProcessHandleOut = &child;
uint32_t s = NtlCreateSystemProcess(&req);
KSTATUS s = NtlCreateSystemProcess(&req);
if (s != NTLSTATUS_SUCCESS) fail_status("create child", s);
s = SysWait(child, SYS_WAIT_FLAG_NONE);
@@ -308,7 +309,7 @@ static void test_validation(uint32_t file) {
LOCK_LENGTH,
0,
};
uint32_t s = SysLockFile(&lockReq);
KSTATUS s = SysLockFile(&lockReq);
if (s != NTLSTATUS_INVALID_PARAMETER) fail_status("bad lock size", s);
lockReq.Size = sizeof(lockReq);