Skip to content

Commit 543faf9

Browse files
davidv1992folkertdev
authored andcommitted
Added all definitions from linux/ptp-clock.h
1 parent 501a37e commit 543faf9

File tree

3 files changed

+153
-2
lines changed

3 files changed

+153
-2
lines changed

Diff for: libc-test/build.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -3457,6 +3457,8 @@ fn test_linux(target: &str) {
34573457
"linux/netlink.h",
34583458
// FIXME: requires Linux >= 5.6:
34593459
[!musl]: "linux/openat2.h",
3460+
"linux/ptp_clock.h",
3461+
// FIXME: requires Linux >= 5.6:
34603462
[!musl]: "linux/ptrace.h",
34613463
"linux/quota.h",
34623464
"linux/random.h",
@@ -4264,7 +4266,11 @@ fn test_linux(target: &str) {
42644266
// `__exit_status` type is a patch which is absent in musl
42654267
(struct_ == "utmpx" && field == "ut_exit" && musl) ||
42664268
// `can_addr` is an anonymous union
4267-
(struct_ == "sockaddr_can" && field == "can_addr")
4269+
(struct_ == "sockaddr_can" && field == "can_addr") ||
4270+
// `anonymous_1` is an anonymous union
4271+
(struct_ == "ptp_perout_request" && field == "anonymous_1") ||
4272+
// `anonymous_2` is an anonymous union
4273+
(struct_ == "ptp_perout_request" && field == "anonymous_2")
42684274
});
42694275

42704276
cfg.volatile_item(|i| {
@@ -4322,7 +4328,11 @@ fn test_linux(target: &str) {
43224328
// the `ifc_ifcu` field is an anonymous union
43234329
(struct_ == "ifconf" && field == "ifc_ifcu") ||
43244330
// glibc uses a single array `uregs` instead of individual fields.
4325-
(struct_ == "user_regs" && arm)
4331+
(struct_ == "user_regs" && arm) ||
4332+
// `anonymous_1` is an anonymous union
4333+
(struct_ == "ptp_perout_request" && field == "anonymous_1") ||
4334+
// `anonymous_2` is an anonymous union
4335+
(struct_ == "ptp_perout_request" && field == "anonymous_2")
43264336
});
43274337

43284338
cfg.skip_roundtrip(move |s| match s {

Diff for: libc-test/semver/linux.txt

+23
Original file line numberDiff line numberDiff line change
@@ -1990,6 +1990,29 @@ PTHREAD_INHERIT_SCHED
19901990
PTHREAD_EXPLICIT_SCHED
19911991
PTHREAD_STACK_MIN
19921992
PTHREAD_ONCE_INIT
1993+
PTP_CLOCK_GETCAPS
1994+
PTP_CLOCK_GETCAPS2
1995+
PTP_ENABLE_PPS
1996+
PTP_ENABLE_PPS2
1997+
PTP_EXTTS_REQUEST
1998+
PTP_EXTTS_REQUEST2
1999+
PTP_MAX_SAMPLES
2000+
PTP_PEROUT_REQUEST
2001+
PTP_PEROUT_REQUEST2
2002+
PTP_PF_EXTTS
2003+
PTP_PF_NONE
2004+
PTP_PF_PEROUT
2005+
PTP_PF_PHYSYNC
2006+
PTP_PIN_GETFUNC
2007+
PTP_PIN_GETFUNC2
2008+
PTP_PIN_SETFUNC
2009+
PTP_PIN_SETFUNC2
2010+
PTP_SYS_OFFSET
2011+
PTP_SYS_OFFSET2
2012+
PTP_SYS_OFFSET_EXTENDED
2013+
PTP_SYS_OFFSET_EXTENDED2
2014+
PTP_SYS_OFFSET_PRECISE
2015+
PTP_SYS_OFFSET_PRECISE2
19932016
PTRACE_ATTACH
19942017
PTRACE_CONT
19952018
PTRACE_DETACH

Diff for: src/unix/linux_like/linux/mod.rs

+118
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,67 @@ s! {
650650
pub val: ::c_int,
651651
}
652652

653+
// linux/ptp_clock.h
654+
pub struct ptp_clock_time {
655+
pub sec: ::__s64,
656+
pub nsec: ::__u32,
657+
pub reserved: ::__u32,
658+
}
659+
660+
pub struct ptp_clock_caps {
661+
pub max_adj: ::c_int,
662+
pub n_alarm: ::c_int,
663+
pub n_ext_ts: ::c_int,
664+
pub n_per_out: ::c_int,
665+
pub pps: ::c_int,
666+
pub n_pins: ::c_int,
667+
pub cross_timestamping: ::c_int,
668+
pub adjust_phase: ::c_int,
669+
pub max_phase_adj: ::c_int,
670+
pub rsv: [::c_int; 11],
671+
}
672+
673+
pub struct ptp_extts_request {
674+
pub index: ::c_uint,
675+
pub flags: ::c_uint,
676+
pub rsv: [::c_uint; 2],
677+
}
678+
679+
680+
pub struct ptp_sys_offset {
681+
pub n_samples: ::c_uint,
682+
pub rsv: [::c_uint; 3],
683+
pub ts: [ptp_clock_time; 51],
684+
}
685+
686+
pub struct ptp_sys_offset_extended {
687+
pub n_samples: ::c_uint,
688+
pub rsv: [::c_uint; 3],
689+
pub ts: [[ptp_clock_time; 3]; 25],
690+
}
691+
692+
pub struct ptp_sys_offset_precise {
693+
pub device: ptp_clock_time,
694+
pub sys_realtime: ptp_clock_time,
695+
pub sys_monoraw: ptp_clock_time,
696+
pub rsv: [::c_uint; 4],
697+
}
698+
699+
pub struct ptp_pin_desc {
700+
pub name: [::c_char; 64],
701+
pub index: ::c_uint,
702+
pub func: ::c_uint,
703+
pub chan: ::c_uint,
704+
pub rsv: [::c_uint; 5],
705+
}
706+
707+
pub struct ptp_extts_event {
708+
pub t: ptp_clock_time,
709+
index: ::c_uint,
710+
flags: ::c_uint,
711+
rsv: [::c_uint; 2],
712+
}
713+
653714
// linux/sctp.h
654715

655716
pub struct sctp_initmsg {
@@ -889,6 +950,7 @@ s_no_extra_traits! {
889950
pub sched_deadline: ::__u64,
890951
pub sched_period: ::__u64,
891952
}
953+
892954
}
893955

894956
s_no_extra_traits! {
@@ -920,6 +982,34 @@ cfg_if! {
920982
}
921983
}
922984

985+
cfg_if! {
986+
if #[cfg(libc_union)] {
987+
s_no_extra_traits! {
988+
// linux/ptp_clock.h
989+
#[allow(missing_debug_implementations)]
990+
pub union __c_anonymous_ptp_perout_request_1 {
991+
pub start: ptp_clock_time,
992+
pub phase: ptp_clock_time,
993+
}
994+
995+
#[allow(missing_debug_implementations)]
996+
pub union __c_anonymous_ptp_perout_request_2 {
997+
pub on: ptp_clock_time,
998+
pub rsv: [::c_uint; 4],
999+
}
1000+
1001+
#[allow(missing_debug_implementations)]
1002+
pub struct ptp_perout_request {
1003+
pub anonymous_1: __c_anonymous_ptp_perout_request_1,
1004+
pub period: ptp_clock_time,
1005+
pub index: ::c_uint,
1006+
pub flags: ::c_uint,
1007+
pub anonymous_2: __c_anonymous_ptp_perout_request_2,
1008+
}
1009+
}
1010+
}
1011+
}
1012+
9231013
cfg_if! {
9241014
if #[cfg(feature = "extra_traits")] {
9251015
impl PartialEq for sockaddr_nl {
@@ -3638,6 +3728,34 @@ pub const HWTSTAMP_FILTER_PTP_V2_SYNC: ::c_uint = 13;
36383728
pub const HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: ::c_uint = 14;
36393729
pub const HWTSTAMP_FILTER_NTP_ALL: ::c_uint = 15;
36403730

3731+
// linux/ptp_clock.h
3732+
pub const PTP_MAX_SAMPLES: ::c_uint = 25;
3733+
3734+
pub const PTP_CLOCK_GETCAPS: ::c_uint = 0x80503d01;
3735+
pub const PTP_EXTTS_REQUEST: ::c_uint = 0x40103d02;
3736+
pub const PTP_PEROUT_REQUEST: ::c_uint = 0x40383d03;
3737+
pub const PTP_ENABLE_PPS: ::c_uint = 0x40043d04;
3738+
pub const PTP_SYS_OFFSET: ::c_uint = 0x43403d05;
3739+
pub const PTP_PIN_GETFUNC: ::c_uint = 0xc0603d06;
3740+
pub const PTP_PIN_SETFUNC: ::c_uint = 0x40603d07;
3741+
pub const PTP_SYS_OFFSET_PRECISE: ::c_uint = 0xc0403d08;
3742+
pub const PTP_SYS_OFFSET_EXTENDED: ::c_uint = 0xc4c03d09;
3743+
3744+
pub const PTP_CLOCK_GETCAPS2: ::c_uint = 0x80503d0a;
3745+
pub const PTP_EXTTS_REQUEST2: ::c_uint = 0x40103d0b;
3746+
pub const PTP_PEROUT_REQUEST2: ::c_uint = 0x40383d0c;
3747+
pub const PTP_ENABLE_PPS2: ::c_uint = 0x40043d0d;
3748+
pub const PTP_SYS_OFFSET2: ::c_uint = 0x43403d0e;
3749+
pub const PTP_PIN_GETFUNC2: ::c_uint = 0xc0603d0f;
3750+
pub const PTP_PIN_SETFUNC2: ::c_uint = 0x40603d10;
3751+
pub const PTP_SYS_OFFSET_PRECISE2: ::c_uint = 0xc0403d11;
3752+
pub const PTP_SYS_OFFSET_EXTENDED2: ::c_uint = 0xc4c03d12;
3753+
3754+
pub const PTP_PF_NONE: ::c_uint = 0;
3755+
pub const PTP_PF_EXTTS: ::c_uint = 1;
3756+
pub const PTP_PF_PEROUT: ::c_uint = 2;
3757+
pub const PTP_PF_PHYSYNC: ::c_uint = 3;
3758+
36413759
// linux/tls.h
36423760
pub const TLS_TX: ::c_int = 1;
36433761
pub const TLS_RX: ::c_int = 2;

0 commit comments

Comments
 (0)