From 950ae4f1c6d4b636868d07ebf214d925bcf02857 Mon Sep 17 00:00:00 2001 From: chenzeyan54-commits Date: Sat, 26 Sep 2026 12:03:37 +0800 Subject: [PATCH] fix(#795): Support pathname Unix-domain streams on Windows The Windows local-address provider always returns -95, and the Windows branches of `_unix_socket` and `unix_remove` do the same. Consequently, portabl... Signed-off-by: chenzeyan54-commits --- std/sys/windows/local_addr.wave | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/std/sys/windows/local_addr.wave b/std/sys/windows/local_addr.wave index d42b8d77..4991ac0f 100644 --- a/std/sys/windows/local_addr.wave +++ b/std/sys/windows/local_addr.wave @@ -1,12 +1,30 @@ -// Unix-domain sockets are intentionally unavailable through this Unix API. -// Windows named pipes and AF_UNIX require separate Windows-native contracts. +// Unix-domain sockets are supported on Windows via AF_UNIX for local IPC. +// This provider supports pathname sockets only. Abstract sockets are not +// available on Windows and remain unsupported. -pub const AF_LOCAL: i32 = 1; -pub const NATIVE_LOCAL_PATH_CAPACITY: i32 = 1; +pub const AF_LOCAL: i32 = 16; +pub const NATIVE_LOCAL_PATH_CAPACITY: i32 = 260; pub struct NativeLocalAddr { - unavailable: u8; + path: char; + path_len: u32; } -pub fun native_local_addr(path: str, output: ptr) -> i32 { return -95; } -pub fun native_local_abstract(name: str, output: ptr) -> i32 { return -95; } +pub fun native_local_addr(path: str, output: ptr) -> i32 { + if len(path) > NATIVE_LOCAL_PATH_CAPACITY { + return -95; + } + output.path = null_char; + output.path_len = 0; + for i in 0..len(path) { + output.path = path[i]; + output.path_len = i + 1; + } + output.path = path[path.len]; + output.path_len = len(path); + return 0; +} + +pub fun native_local_abstract(name: str, output: ptr) -> i32 { + return -95; +} \ No newline at end of file