~mil/mepo-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] Use OS-independent sigaction after fc6156a833bb

Details
Message ID
<zg9q-rkfv-wny@FreeBSD.org>
DKIM signature
pass
Download raw message
Patch: +7 -6
ENOSYS terminates the process on FreeBSD. However, Linux sigaction()
has the same syscall number as obsolete vread(), so does nothing.

$ mepo &
$ pkill -USR1 mepo
[...]
User defined signal 1
---
 src/api/bind_signal.zig | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/api/bind_signal.zig b/src/api/bind_signal.zig
index 61af232..504d55a 100644
--- a/src/api/bind_signal.zig
+++ b/src/api/bind_signal.zig
@@ -39,13 +39,14 @@ fn bind_signal(mepo: *Mepo, signo_str: [:0]const u8, expression: []const u8) !vo
    }

    // Register generic signal handler
    if (0 != std.os.linux.sigaction(signal_name, &.{
    const signal_action = std.os.Sigaction{
        .handler = .{ .handler = utilsdl.sdl_push_event_signal },
        .mask = [_]u32{0} ** 32,
        .flags = @as(c_uint, 0),
    }, null)) {
        return error.FailedToSetupSighandler;
    }
        .mask = std.os.empty_sigset,
        .flags = 0,
    };

    std.os.sigaction(signal_name, &signal_action, null)
        catch return error.FailedToSetupSighandler;

    if (mepo.table_signals.get(signal_name)) |heap_str| {
        mepo.allocator.free(heap_str);
Details
Message ID
<3a139da3-eaae-40ac-bfbe-652b0d5f284e@app.fastmail.com>
In-Reply-To
<zg9q-rkfv-wny@FreeBSD.org> (view parent)
DKIM signature
pass
Download raw message
On Mon, Feb 6, 2023, at 8:29 AM, Jan Beich wrote:
> ENOSYS terminates the process on FreeBSD. However, Linux sigaction()
> has the same syscall number as obsolete vread(), so does nothing.
>
> $ mepo &
> $ pkill -USR1 mepo
> [...]
> User defined signal 1
> ---
>  src/api/bind_signal.zig | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/src/api/bind_signal.zig b/src/api/bind_signal.zig
> index 61af232..504d55a 100644
> --- a/src/api/bind_signal.zig
> +++ b/src/api/bind_signal.zig
> @@ -39,13 +39,14 @@ fn bind_signal(mepo: *Mepo, signo_str: [:0]const 
> u8, expression: []const u8) !vo
>      }
> 
>      // Register generic signal handler
> -    if (0 != std.os.linux.sigaction(signal_name, &.{
> +    const signal_action = std.os.Sigaction{
>          .handler = .{ .handler = utilsdl.sdl_push_event_signal },
> -        .mask = [_]u32{0} ** 32,
> -        .flags = @as(c_uint, 0),
> -    }, null)) {
> -        return error.FailedToSetupSighandler;
> -    }
> +        .mask = std.os.empty_sigset,
> +        .flags = 0,
> +    };
> +
> +    std.os.sigaction(signal_name, &signal_action, null)
> +        catch return error.FailedToSetupSighandler;
> 
>      if (mepo.table_signals.get(signal_name)) |heap_str| {
>          mepo.allocator.free(heap_str);

Thanks for catching this, applied!
Reply to thread Export thread (mbox)