Skip to content

sigaction don't support SIGRTMIN only when linking with libc #21189

Closed
@patryk4815

Description

@patryk4815

Zig Version

0.13.0

Steps to Reproduce and Observed Behavior

SIGRTMIN Is needed for catching signal eg. from timer_create
Example C code using here:
https://man7.org/linux/man-pages/man2/timer_create.2.html#EXAMPLES

const std = @import("std");
const posix = std.posix;
const testing = std.testing;

test "bug sigaction" {
  const sig = 32;  // SIGRTMIN eg. for timer_create / POSIX.1-2008
  try std.posix.sigaction(sig, null, null);
}

Without LIBC:

# zig test ./bugs/bugs.zig 
All 1 tests passed.

With LIBC:

# zig test -lc ./bugs/bugs.zig 
1/1 bugs.test.bug sigaction...FAIL (OperationNotSupported)
/nix/store/ni7kxhi72zipa3m071rpgqbqjw9capdm-zig-0.13.0/lib/zig/std/posix.zig:5641:27: 0x1039855 in sigaction (test)
        .INVAL, .NOSYS => return error.OperationNotSupported,
                          ^
/work/bugs/bugs.zig:7:3: 0x103979f in test.bug sigaction (test)
  try std.posix.sigaction(sigBigerThen31, null, null);
  ^
0 passed; 0 skipped; 1 failed.

Expected Behavior

Crash on both. Or supported or both.

SIGRTMIN = 34/35 with libc
SIGRTMIN = 32 without libc

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSolving this issue will likely involve adding new logic or components to the codebase.standard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions