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 a42ff8ad2e..3df6eb43de 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 4245048b22..57ec254e4a 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 7c7be5fa78..1780255aac 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 {