Skip to content

Commit

Permalink
add PTP_CLOCK_CAPS_RSV_LEN
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev committed Nov 20, 2024
1 parent 93b49b1 commit e0b0c75
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 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_ENABLE_PPS
PTP_ENABLE_PPS2
PTP_EXTTS_REQUEST
Expand Down
13 changes: 13 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5625,6 +5625,9 @@ 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 = ptp_clock_caps_rsv_len();

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

Expand Down Expand Up @@ -5667,6 +5670,16 @@ const _IOC_TYPESHIFT: u32 = _IOC_NRSHIFT + _IOC_NRBITS;
const _IOC_SIZESHIFT: u32 = _IOC_TYPESHIFT + _IOC_TYPEBITS;
const _IOC_DIRSHIFT: u32 = _IOC_SIZESHIFT + _IOC_SIZEBITS;

const fn 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
}
}

// adapted from https://github.com/torvalds/linux/blob/8a696a29c6905594e4abf78eaafcb62165ac61f1/rust/kernel/ioctl.rs

/// Build an ioctl number, analogous to the C macro of the same name.
Expand Down

0 comments on commit e0b0c75

Please sign in to comment.