commit f07083a1e5f6ad80b5c50ab0063761b3f1491c55
parent 6ecfa4adb97113e5264df6c93abc3a4ece4ebcda
Author: Mykyta Holubakha <hilobakho@gmail.com>
Date: Sat, 13 Mar 2021 18:32:57 +0200
rt: add signalfd syscall
Diffstat:
2 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/rt/+linux/syscalls.ha b/rt/+linux/syscalls.ha
@@ -328,3 +328,9 @@ export fn timerfd_gettime(fd: int, curr_value: *itimerspec) (int | errno) = {
return wrap_return(syscall2(SYS_timerfd_gettime,
fd: u64, curr_value: uintptr: u64))?: int;
};
+
+export fn signalfd(fd: int, mask: *const sigset, flags: int) (int | errno) = {
+ return wrap_return(syscall4(SYS_signalfd4,
+ fd: u64, mask: uintptr: u64, size(sigset): u64,
+ flags: u64))?: int;
+};
diff --git a/rt/+linux/types.ha b/rt/+linux/types.ha
@@ -330,3 +330,29 @@ export type pollfd = struct {
export def TFD_TIMER_ABSTIME: int = 1;
export def TFD_TIMER_CANCEL_ON_SET: int = 2;
+
+export type signalfd_siginfo = struct {
+ ssi_signo: u32,
+ ssi_errno: i32,
+ ssi_code: i32,
+ ssi_pid: u32,
+ ssi_uid: u32,
+ ssi_fd: i32 ,
+ ssi_tid: u32,
+ ssi_band: u32,
+ ssi_overrun: u32,
+ ssi_trapno: u32,
+ ssi_status: i32,
+ ssi_int: i32,
+ ssi_ptr: u64,
+ ssi_utime: u64,
+ ssi_stime: u64,
+ ssi_addr: u64,
+ ssi_addr_lsb: u16,
+ __pad2: u16,
+ ssi_syscall: i32,
+ ssi_call_addr: u64,
+ ssi_arch: u32,
+
+ __pad: [28]u8, // pad to 128 bytes
+};