Skip to content

Commit

Permalink
add ptp_clock_caps
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev committed Nov 20, 2024
1 parent 0a96edd commit 765595e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2252,6 +2252,7 @@ PTHREAD_PRIO_PROTECT
PTHREAD_PROCESS_PRIVATE
PTHREAD_PROCESS_SHARED
PTHREAD_STACK_MIN
PTP_CLOCK_CAPS_RSV_LEN
PTP_CLOCK_GETCAPS
PTP_CLOCK_GETCAPS2
PTP_ENABLE_PPS
Expand Down Expand Up @@ -3942,6 +3943,7 @@ pthread_spin_lock
pthread_spin_trylock
pthread_spin_unlock
pthread_spinlock_t
ptp_clock_caps
ptp_clock_time
ptp_extts_event
ptp_extts_request
Expand Down
38 changes: 38 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,33 @@ s! {
pub chan: ::c_uint,
pub rsv: [::c_uint; 5],
}

pub struct ptp_clock_caps {
pub max_adj: ::c_int,
pub n_alarm: ::c_int,
pub n_ext_ts: ::c_int,
pub n_per_out: ::c_int,
pub pps: ::c_int,
pub n_pins: ::c_int,
pub cross_timestamping: ::c_int,
#[cfg(any(target_arch = "sparc", target_arch = "sparc64"))]
pub adjust_phase: ::c_int,
#[cfg(not(any(
any(target_arch = "sparc", target_arch = "sparc64"),
any(target_env = "musl", target_env = "ohos"),
)))]
pub adjust_phase: ::c_int,
#[cfg(not(any(
any(target_arch = "sparc", target_arch = "sparc64"),
any(target_env = "musl", target_env = "ohos"),
)))]
pub max_phase_adj: ::c_int,
#[cfg(not(any(
any(target_arch = "sparc", target_arch = "sparc64"),
any(target_env = "musl", target_env = "ohos"),
)))]
pub rsv: [::c_int; PTP_CLOCK_CAPS_RSV_LEN],
}
}

cfg_if! {
Expand Down Expand Up @@ -5623,6 +5650,17 @@ pub const SCHED_FLAG_ALL: ::c_int = SCHED_FLAG_RESET_ON_FORK
pub const EPIOCSPARAMS: ::Ioctl = 0x40088a01;
pub const EPIOCGPARAMS: ::Ioctl = 0x80088a02;

// ptp_clock.h
pub const PTP_CLOCK_CAPS_RSV_LEN: usize = {
if cfg!(any(target_arch = "sparc", target_arch = "sparc64")) {
12
} else if cfg!(any(target_env = "musl", target_env = "ohos")) {
13
} else {
11
}
};

const _IOC_NRBITS: u32 = 8;
const _IOC_TYPEBITS: u32 = 8;

Expand Down

0 comments on commit 765595e

Please sign in to comment.