From 1640c357f42e0fc18d88a02995c25094063fef5e Mon Sep 17 00:00:00 2001 From: xackus <14938807+xackus@users.noreply.github.com> Date: Tue, 5 Jan 2021 12:49:56 +0100 Subject: [PATCH] freebsd, netbsd, dragonfly: add struct timeval --- lib/std/os/bits/dragonfly.zig | 8 ++++++++ lib/std/os/bits/freebsd.zig | 8 ++++++++ lib/std/os/bits/netbsd.zig | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/lib/std/os/bits/dragonfly.zig b/lib/std/os/bits/dragonfly.zig index a42ff8ad2e12b7be3b6b571ff4807dad12d433ad..3df6eb43dee4b04724ea9f407fc7c6814c2a8cd0 100644 --- a/lib/std/os/bits/dragonfly.zig +++ b/lib/std/os/bits/dragonfly.zig @@ -20,6 +20,7 @@ pub const off_t = c_long; pub const mode_t = c_uint; pub const uid_t = u32; pub const gid_t = u32; +pub const suseconds_t = c_long; pub const ENOTSUP = EOPNOTSUPP; pub const EWOULDBLOCK = EAGAIN; @@ -190,6 +191,13 @@ pub const timespec = extern struct { tv_nsec: c_long, }; +pub const timeval = extern struct { + /// seconds + tv_sec: time_t, + /// microseconds + tv_usec: suseconds_t, +}; + pub const CTL_UNSPEC = 0; pub const CTL_KERN = 1; pub const CTL_VM = 2; diff --git a/lib/std/os/bits/freebsd.zig b/lib/std/os/bits/freebsd.zig index 4245048b22f24451d5e3f38a441c2e9cd2cbe945..57ec254e4ab9d36d60356ecc306c322a680d3722 100644 --- a/lib/std/os/bits/freebsd.zig +++ b/lib/std/os/bits/freebsd.zig @@ -26,6 +26,7 @@ pub const time_t = i64; pub const clock_t = isize; pub const socklen_t = u32; +pub const suseconds_t = c_long; /// Renamed from `kevent` to `Kevent` to avoid conflict with function name. pub const Kevent = extern struct { @@ -169,6 +170,13 @@ pub const timespec = extern struct { tv_nsec: isize, }; +pub const timeval = extern struct { + /// seconds + tv_sec: time_t, + /// microseconds + tv_usec: suseconds_t, +}; + pub const dirent = extern struct { d_fileno: usize, d_off: i64, diff --git a/lib/std/os/bits/netbsd.zig b/lib/std/os/bits/netbsd.zig index 7c7be5fa78d36ec5effb5d37157d348790975d2b..1780255aac4cb4c3a79113759be8a4f609a43221 100644 --- a/lib/std/os/bits/netbsd.zig +++ b/lib/std/os/bits/netbsd.zig @@ -22,6 +22,7 @@ pub const socklen_t = u32; pub const time_t = i64; pub const uid_t = u32; pub const lwpid_t = i32; +pub const suseconds_t = c_int; /// Renamed from `kevent` to `Kevent` to avoid conflict with function name. pub const Kevent = extern struct { @@ -190,6 +191,13 @@ pub const timespec = extern struct { tv_nsec: isize, }; +pub const timeval = extern struct { + /// seconds + tv_sec: time_t, + /// microseconds + tv_usec: suseconds_t, +}; + pub const MAXNAMLEN = 511; pub const dirent = extern struct { -- 2.54.0