use std::os::unix::io::RawFd;
#[repr(C)]
pub struct PtpClockCaps {
pub max_adj: libc::c_int, pub n_alarm: libc::c_int, pub n_ext_ts: libc::c_int, pub n_per_out: libc::c_int, pub pps: libc::c_int, pub n_pins: libc::c_int, pub cross_timestamping: libc::c_int, pub adjust_phase: libc::c_int, pub max_phase_adj: libc::c_int, pub rsv: [libc::c_int; 11], }
#[expect(
clippy::cast_possible_truncation,
reason = "PtpClockCaps is always small enough that th esize can be expressed as an u32."
)]
const PTP_CLOCK_GETCAPS: u32 =
(2u32 << 30) | ((std::mem::size_of::<PtpClockCaps>() as u32) << 16) | ((b'=' as u32) << 8) | 1;
#[allow(
clippy::cast_possible_wrap,
reason = "This cast can wrap on some but not all platforms, but is always ok."
)]
#[allow(
clippy::cast_lossless,
reason = "This cast is not lossless on all platforms."
)]
pub unsafe fn ptp_clock_getcaps(fd: RawFd, caps: *mut PtpClockCaps) -> libc::c_int {
libc::ioctl(fd, PTP_CLOCK_GETCAPS as _, caps)
}