From 93d43a70b75ae7911aed1ccb24ddff8b13d38853 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Sun, 27 Aug 2023 00:53:55 +0100 Subject: [PATCH] introduces FreeBSD's SO_TS_CLOCK into net::sys::socket::sockopt. (#2093) * introduces FreeBSD's SO_TS_CLOCK into net::sys::socket::sockopt. close GH-2058. * CHANGELOG entry * changes from feedback --- CHANGELOG.md | 2 ++ src/sys/socket/sockopt.rs | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b99255ca82..43da4107a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). - Added `MSG_WAITFORONE` to `MsgFlags` on Android, Fuchsia, Linux, NetBSD, FreeBSD, OpenBSD, and Solaris. ([#2014](https://github.com/nix-rust/nix/pull/2014)) +- Added `SO_TS_CLOCK` for FreeBSD to `nix::sys::socket::sockopt`. + ([#2093](https://github.com/nix-rust/nix/pull/2093)) ### Changed diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index ba380a86b3..44f3ebbc1d 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -711,6 +711,16 @@ sockopt_impl!( libc::SO_TIMESTAMPNS, bool ); +#[cfg(target_os = "freebsd")] +sockopt_impl!( + /// Sets a specific timestamp format instead of the classic `SCM_TIMESTAMP`, + /// to follow up after `SO_TIMESTAMP` is set. + TsClock, + Both, + libc::SOL_SOCKET, + libc::SO_TS_CLOCK, + i32 +); #[cfg(any(target_os = "android", target_os = "linux"))] #[cfg(feature = "net")] sockopt_impl!(