aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os/bits/linux.zig
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2020-12-12 16:44:10 +0100
committerLemonBoy <thatlemon@gmail.com>2020-12-12 16:44:10 +0100
commit629cc6cf285f60581f03b69ec8d012d2e370a029 (patch)
treec616cc3bdb5096753d4c6981a2be4a2257dd16bb /lib/std/os/bits/linux.zig
parent1d9b28403a1074cbbbd0605f07819136c9f96cdc (diff)
downloadzig-629cc6cf285f60581f03b69ec8d012d2e370a029.tar.gz
zig-629cc6cf285f60581f03b69ec8d012d2e370a029.zip
std: Further siginfo refinements
* Define siginfo and sigaction for Darwin * Define sigaction/handler union for maximum libc compatibility * Minor correction to some type definitions
Diffstat (limited to 'lib/std/os/bits/linux.zig')
-rw-r--r--lib/std/os/bits/linux.zig41
1 files changed, 26 insertions, 15 deletions
diff --git a/lib/std/os/bits/linux.zig b/lib/std/os/bits/linux.zig
index 72621b7fee..e86a08e861 100644
--- a/lib/std/os/bits/linux.zig
+++ b/lib/std/os/bits/linux.zig
@@ -864,27 +864,38 @@ pub const sigset_t = [1024 / 32]u32;
pub const all_mask: sigset_t = [_]u32{0xffffffff} ** sigset_t.len;
pub const app_mask: sigset_t = [2]u32{ 0xfffffffc, 0x7fffffff } ++ [_]u32{0xffffffff} ** 30;
-pub const k_sigaction = if (is_mips)
- extern struct {
- flags: usize,
- sigaction: ?fn (i32, *const siginfo_t, ?*const c_void) callconv(.C) void,
- mask: [4]u32,
+pub const k_sigaction = switch (builtin.arch) {
+ .mips, .mipsel => extern struct {
+ flags: c_uint,
+ handler: ?fn (c_int) callconv(.C) void,
+ mask: [4]c_ulong,
restorer: fn () callconv(.C) void,
- }
-else
- extern struct {
- sigaction: ?fn (i32, *const siginfo_t, ?*const c_void) callconv(.C) void,
- flags: usize,
+ },
+ .mips64, .mips64el => extern struct {
+ flags: c_uint,
+ handler: ?fn (c_int) callconv(.C) void,
+ mask: [2]c_ulong,
restorer: fn () callconv(.C) void,
- mask: [2]u32,
- };
+ },
+ else => extern struct {
+ handler: ?fn (c_int) callconv(.C) void,
+ flags: c_ulong,
+ restorer: fn () callconv(.C) void,
+ mask: [2]c_uint,
+ },
+};
/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
pub const Sigaction = extern struct {
- pub const sigaction_fn = fn (i32, *const siginfo_t, ?*const c_void) callconv(.C) void;
- sigaction: ?sigaction_fn,
+ pub const handler_fn = fn (c_int) callconv(.C) void;
+ pub const sigaction_fn = fn (c_int, *const siginfo_t, ?*const c_void) callconv(.C) void;
+
+ handler: extern union {
+ handler: ?handler_fn,
+ sigaction: ?sigaction_fn,
+ },
mask: sigset_t,
- flags: u32,
+ flags: c_uint,
restorer: ?fn () callconv(.C) void = null,
};