Im writing an application that runs in the terminal and i need to run code when the program is interrupted with sigint (ctrl + c) to do this im using std.os.linux.sigaction() which requires a Sigaction struct as one of it's parameters im having issues setting the handler for Sigaction as im lacking an understanding on how to create the type required
#How to make a Sigaction struct
1 messages · Page 1 of 1 (latest)
Something like this should work:
std.os.linux.sigaction(std.os.linux.SIG.INT, &.{
.handler = .{ .handler = sigIntHandler },
.mask = std.os.linux.empty_sigset,
.flags = 0,
}, null);
where sigIntHandler is a function of this form:
fn sigIntHandler(_: c_int) callconv(.C) void {
}