| ... | ... | @@ -1590,6 +1590,43 @@ pub fn timerfd_settime(fd: i32, flags: u32, new_value: *const itimerspec, old_va |
| 1590 | 1590 | return syscall4(.timerfd_settime, @bitCast(usize, @as(isize, fd)), flags, @ptrToInt(new_value), @ptrToInt(old_value)); |
| 1591 | 1591 | } |
| 1592 | 1592 | |
| 1593 | pub const sigevent = extern struct { |
| 1594 | value: sigval, |
| 1595 | signo: i32, |
| 1596 | inotify: i32, |
| 1597 | libc_priv_impl: opaque {}, |
| 1598 | }; |
| 1599 | |
| 1600 | // Flags for sigevent sigev_inotify's field |
| 1601 | pub const SIGEV = enum(i32) { |
| 1602 | NONE = 0, |
| 1603 | SIGNAL = 1, |
| 1604 | THREAD = 2, |
| 1605 | THREAD_ID = 4, |
| 1606 | }; |
| 1607 | |
| 1608 | pub const timer_t = ?*anyopaque; |
| 1609 | |
| 1610 | pub fn timer_create(clockid: i32, sevp: *sigevent, timerid: *timer_t) usize { |
| 1611 | var t: timer_t = undefined; |
| 1612 | const rc = syscall3(.timer_create, @bitCast(usize, @as(isize, clockid)), @ptrToInt(sevp), @ptrToInt(&t)); |
| 1613 | if (@bitCast(isize, rc) < 0) return rc; |
| 1614 | timerid.* = t; |
| 1615 | return rc; |
| 1616 | } |
| 1617 | |
| 1618 | pub fn timer_delete(timerid: timer_t) usize { |
| 1619 | return syscall1(.timer_delete, timerid); |
| 1620 | } |
| 1621 | |
| 1622 | pub fn timer_gettime(timerid: timer_t, curr_value: *itimerspec) usize { |
| 1623 | return syscall2(.timer_gettime, @ptrToInt(timerid), @ptrToInt(curr_value)); |
| 1624 | } |
| 1625 | |
| 1626 | pub fn timer_settime(timerid: timer_t, flags: i32, new_value: *const itimerspec, old_value: ?*itimerspec) usize { |
| 1627 | return syscall4(.timer_settime, @ptrToInt(timerid), @bitCast(usize, @as(isize, flags)), @ptrToInt(new_value), @ptrToInt(old_value)); |
| 1628 | } |
| 1629 | |
| 1593 | 1630 | // Flags for the 'setitimer' system call |
| 1594 | 1631 | pub const ITIMER = enum(i32) { |
| 1595 | 1632 | REAL = 0, |