Compare commits
4 commits
d545b10ce8
...
a0fa97cdde
| Author | SHA1 | Date | |
|---|---|---|---|
| a0fa97cdde | |||
| 469e26c0d8 | |||
| 3a321ecfe0 | |||
| af6262e48e |
8 changed files with 26 additions and 9 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,11 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#if defined(_WIN32)
|
||||
#include <ws2tcpip.h>
|
||||
#else
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
|
||||
struct thespian_tcp_acceptor_handle;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<controller>(ep_listen)}](const auto &from,
|
||||
const auto &m) {
|
||||
return p->receive(from, m);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@
|
|||
#include <thespian/c/socket.h>
|
||||
#include <thespian/c/tcp.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ test "debug" {
|
|||
}
|
||||
|
||||
test "endpoint_unx" {
|
||||
if (builtin.os.tag == .linux) {
|
||||
if (builtin.os.tag != .windows) {
|
||||
try testcase("endpoint_unx");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue