diff --git a/build.zig b/build.zig index d26f1ca..5457506 100644 --- a/build.zig +++ b/build.zig @@ -13,6 +13,7 @@ const cppflags = [_][]const u8{ "-Wno-deprecated-declarations", "-Wno-unqualified-std-cast-call", "-Wno-bitwise-instead-of-logical", //for notcurses + "-Wno-unused-command-line-argument", //zig passes -fno-rtlib-defaultlib when cross-compiling to windows "-fno-sanitize=undefined", "-gen-cdb-fragment-path", ".cache/cdb", diff --git a/build.zig.zon b/build.zig.zon index 4dfe18e..1958d5c 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,13 +1,13 @@ .{ .name = .thespian, .version = "0.0.1", - .minimum_zig_version = "0.16.0-dev.3133+5ec8e45f3", + .minimum_zig_version = "0.16.0", .fingerprint = 0xe9ff00fd8e4e01a3, .dependencies = .{ .cbor = .{ - .url = "git+https://github.com/neurocyte/cbor?ref=master#1b7cd3192552f5fd0b1679d535e5cd978794d13a", - .hash = "cbor-1.1.0-RcQE_DBMAQBrUYInw5H2ZYfBQT1Po-Y4LEwzUQYbtSJ5", + .url = "git+https://github.com/neurocyte/cbor?ref=master#8f37f71439f62b513b9d52a76d6af012395ee47c", + .hash = "cbor-1.2.0-RcQE_NtLAQCkBF-LFNB_XsGIycs6pjhCYicxEq0QzYfe", }, .asio = .{ .url = "git+https://github.com/neurocyte/asio#824070c9385bf98d9de087af6c7992d7039e2836", diff --git a/include/thespian/backtrace.h b/include/thespian/backtrace.h index c93a082..f3f8013 100644 --- a/include/thespian/backtrace.h +++ b/include/thespian/backtrace.h @@ -12,9 +12,11 @@ void install_remote_debugger(); void install_backtrace(); void install_jitdebugger(); +#if !defined(_WIN32) void sighdl_debugger(int no, siginfo_t * /*sigi*/, void * /*uco*/); void sighdl_remote_debugger(int no, siginfo_t * /*sigi*/, void * /*uco*/); void sighdl_backtrace(int no, siginfo_t * /*sigi*/, void * /*uco*/); +#endif #ifdef __cplusplus } diff --git a/include/thespian/c/tcp.h b/include/thespian/c/tcp.h index 8f73f38..ffe18af 100644 --- a/include/thespian/c/tcp.h +++ b/include/thespian/c/tcp.h @@ -6,7 +6,11 @@ extern "C" { #endif #include +#if defined(_WIN32) +#include +#else #include +#endif #include struct thespian_tcp_acceptor_handle; diff --git a/src/thespian.zig b/src/thespian.zig index 740cba7..b64a41e 100644 --- a/src/thespian.zig +++ b/src/thespian.zig @@ -254,7 +254,7 @@ fn store_stack_trace(stack_trace: std.builtin.StackTrace, writer: *std.Io.Writer writer.print("Unable to store stack trace: debug info stripped\n", .{}) catch return; return; } - std.debug.writeStackTrace(&stack_trace, .{ .writer = writer, .mode = .no_color }) catch |err| { + std.debug.writeErrorReturnTrace(&stack_trace, .{ .writer = writer, .mode = .no_color }) catch |err| { writer.print("Unable to dump stack trace: {s}\n", .{@errorName(err)}) catch return; return; }; @@ -651,7 +651,7 @@ fn to_result(ret: result) c.thespian_result { if (!(cbor.match(msg, .{ "exit", "normal" }) catch false)) { if (env.get().is("dump-stack-trace")) { const trace_ = @errorReturnTrace(); - if (trace_) |t| std.debug.dumpStackTrace(t); + if (trace_) |t| std.debug.dumpErrorReturnTrace(t); } } return &error_buffer_tl; diff --git a/test/endpoint_unx.cpp b/test/endpoint_unx.cpp index 0a01cdd..fbf3cf2 100644 --- a/test/endpoint_unx.cpp +++ b/test/endpoint_unx.cpp @@ -40,6 +40,14 @@ using namespace std::chrono_literals; #if !defined(_WIN32) namespace { +// Linux supports abstract Unix sockets (null-byte prefix, no filesystem entry). +// FreeBSD and macOS only support file-based Unix sockets. +#if defined(__linux__) +constexpr auto unx_socket_mode = mode::abstract; +#else +constexpr auto unx_socket_mode = mode::file; +#endif + struct controller { handle ep_listen; handle ep_connect; @@ -59,7 +67,7 @@ struct controller { return ok(); } if (m("path", extract(path))) { - ep_connect = connect(path).value(); + ep_connect = connect(path, unx_socket_mode).value(); return ok(); } if (m("connected")) { @@ -85,12 +93,12 @@ struct controller { auto endpoint_unx(context &ctx, bool &result, env_t env_) -> ::result { stringstream ss; - ss << "/net/vdbonline/thespian/endpoint_t_" << getpid(); + ss << "/tmp/thespian_endpoint_t_" << getpid(); const string path = ss.str(); return to_result(ctx.spawn_link( [path]() { link(env().proc("log")); - handle ep_listen = listen(path).value(); + handle ep_listen = listen(path, unx_socket_mode).value(); receive([p{make_shared(ep_listen)}](const auto &from, const auto &m) { return p->receive(from, m); diff --git a/test/ip_tcp_client_server_c.cpp b/test/ip_tcp_client_server_c.cpp index 5507216..1885039 100644 --- a/test/ip_tcp_client_server_c.cpp +++ b/test/ip_tcp_client_server_c.cpp @@ -7,7 +7,9 @@ #include #include +#ifndef _WIN32 #include +#endif #include // --------------------------------------------------------------------------- diff --git a/test/tests_cpp.zig b/test/tests_cpp.zig index b8ee481..b695d09 100644 --- a/test/tests_cpp.zig +++ b/test/tests_cpp.zig @@ -18,7 +18,7 @@ test "debug" { } test "endpoint_unx" { - if (builtin.os.tag == .linux) { + if (builtin.os.tag != .windows) { try testcase("endpoint_unx"); } }