Commit 23c4f55a61

David CARLIER <devnexen@gmail.com>
2023-04-22 10:06:06
std: adding sigevent to supported platforms.
1 parent 9ef6151
lib/std/c/dragonfly.zig
@@ -1143,3 +1143,20 @@ pub const POLL = struct {
     pub const HUP = 0x0010;
     pub const NVAL = 0x0020;
 };
+
+pub const SIGEV = struct {
+    pub const NONE = 0;
+    pub const SIGNAL = 1;
+    pub const THREAD = 2;
+};
+
+pub const sigevent = extern struct {
+    sigev_notify: c_int,
+    __sigev_u: extern union {
+        __sigev_signo: c_int,
+        __sigev_notify_kqueue: c_int,
+        __sigev_notify_attributes: ?*pthread_attr_t,
+    },
+    sigev_value: sigval,
+    sigev_notify_function: ?*const fn (sigval) callconv(.C) void,
+};
lib/std/c/freebsd.zig
@@ -2248,3 +2248,28 @@ pub const shm_largeconf = extern struct {
 pub extern "c" fn shm_create_largepage(path: [*:0]const u8, flags: c_int, psind: c_int, alloc_policy: c_int, mode: mode_t) c_int;
 
 pub extern "c" fn elf_aux_info(aux: c_int, buf: ?*anyopaque, buflen: c_int) c_int;
+
+pub const lwpid = i32;
+
+pub const SIGEV = struct {
+    pub const NONE = 0;
+    pub const SIGNAL = 1;
+    pub const THREAD = 2;
+    pub const KEVENT = 3;
+    pub const THREAD_ID = 4;
+};
+
+pub const sigevent = extern struct {
+    sigev_notify: c_int,
+    sigev_signo: c_int,
+    sigev_value: sigval,
+    _sigev_un: extern union {
+        _threadid: lwpid,
+        _sigev_thread: extern struct {
+            _function: ?*const fn (sigval) callconv(.C) void,
+            _attribute: ?**pthread_attr_t,
+        },
+        _kevent_flags: c_ushort,
+        __spare__: [8]c_long,
+    },
+};
lib/std/c/haiku.zig
@@ -1038,3 +1038,22 @@ pub const termios = extern struct {
 };
 
 pub const MSG_NOSIGNAL = 0x0800;
+
+pub const SIGEV = struct {
+    pub const NONE = 0;
+    pub const SIGNAL = 1;
+    pub const THREAD = 2;
+};
+
+pub const sigval = extern union {
+    int: c_int,
+    ptr: ?*anyopaque,
+};
+
+pub const sigevent = extern struct {
+    sigev_notify: c_int,
+    sigev_signo: c_int,
+    sigev_value: sigval,
+    sigev_notify_function: ?*const fn (sigval) callconv(.C) void,
+    sigev_notify_attributes: ?*pthread_attr_t,
+};
lib/std/c/netbsd.zig
@@ -1633,3 +1633,22 @@ pub const POLL = struct {
     pub const HUP = 0x0010;
     pub const NVAL = 0x0020;
 };
+
+pub const SIGEV = struct {
+    pub const NONE = 0;
+    pub const SIGNAL = 1;
+    pub const THREAD = 2;
+};
+
+pub const sigval = extern union {
+    int: c_int,
+    ptr: ?*anyopaque,
+};
+
+pub const sigevent = extern struct {
+    sigev_notify: c_int,
+    sigev_signo: c_int,
+    sigev_value: sigval,
+    sigev_notify_function: ?*const fn (sigval) callconv(.C) void,
+    sigev_notify_attributes: ?*pthread_attr_t,
+};
lib/std/c/solaris.zig
@@ -1927,3 +1927,22 @@ pub fn IOW(io_type: u8, nr: u8, comptime IOT: type) i32 {
 pub fn IOWR(io_type: u8, nr: u8, comptime IOT: type) i32 {
     return ioImpl(.read_write, io_type, nr, IOT);
 }
+
+pub const SIGEV = struct {
+    pub const NONE = 0;
+    pub const SIGNAL = 1;
+    pub const THREAD = 2;
+};
+
+pub const sigval = extern union {
+    int: c_int,
+    ptr: ?*anyopaque,
+};
+
+pub const sigevent = extern struct {
+    sigev_notify: c_int,
+    sigev_signo: c_int,
+    sigev_value: sigval,
+    sigev_notify_function: ?*const fn (sigval) callconv(.C) void,
+    sigev_notify_attributes: ?*pthread_attr_t,
+};