Skip to content

Commit 1d29316

Browse files
committed
just ignore cases that would fail :)
1 parent a2478a1 commit 1d29316

File tree

3 files changed

+27
-81
lines changed

3 files changed

+27
-81
lines changed

libc-test/build.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -3915,7 +3915,8 @@ fn test_linux(target: &str) {
39153915
return true;
39163916
}
39173917
// FIXME: Requires >= 5.4 kernel headers
3918-
if name == "PTP_ENABLE_PPS2"
3918+
if name == "PTP_CLOCK_GETCAPS2"
3919+
|| name == "PTP_ENABLE_PPS2"
39193920
|| name == "PTP_EXTTS_REQUEST2"
39203921
|| name == "PTP_PEROUT_REQUEST2"
39213922
|| name == "PTP_PIN_GETFUNC2"
@@ -4473,7 +4474,11 @@ fn test_linux(target: &str) {
44734474
// `anonymous_1` is an anonymous union
44744475
(struct_ == "ptp_perout_request" && field == "anonymous_1") ||
44754476
// `anonymous_2` is an anonymous union
4476-
(struct_ == "ptp_perout_request" && field == "anonymous_2")
4477+
(struct_ == "ptp_perout_request" && field == "anonymous_2") ||
4478+
// FIXME: `adjust_phase` requires >= 5.7 kernel headers
4479+
// FIXME: `max_phase_adj` requires >= 5.19 kernel headers
4480+
// the rsv field shrunk when those fields got added, so is omitted too
4481+
(struct_ == "ptp_clock_caps" && (musl || loongarch64 || sparc64) && (["adjust_phase", "max_phase_adj", "rsv"].contains(&field)))
44774482
});
44784483

44794484
cfg.volatile_item(|i| {
@@ -4550,6 +4555,10 @@ fn test_linux(target: &str) {
45504555
(struct_ == "ptp_perout_request" && field == "anonymous_1") ||
45514556
// `anonymous_2` is an anonymous union
45524557
(struct_ == "ptp_perout_request" && field == "anonymous_2") ||
4558+
// FIXME: `adjust_phase` requires >= 5.7 kernel headers
4559+
// FIXME: `max_phase_adj` requires >= 5.19 kernel headers
4560+
// the rsv field shrunk when those fields got added, so is omitted too
4561+
(struct_ == "ptp_clock_caps" && (musl || loongarch64 || sparc64) && (["adjust_phase", "max_phase_adj", "rsv"].contains(&field))) ||
45534562
// invalid application of 'sizeof' to incomplete type 'long unsigned int[]'
45544563
(musl && struct_ == "mcontext_t" && field == "__extcontext" && loongarch64) ||
45554564
// FIXME(#4121): a new field was added from `f_spare`

libc-test/semver/linux.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2252,6 +2252,7 @@ PTHREAD_PRIO_PROTECT
22522252
PTHREAD_PROCESS_PRIVATE
22532253
PTHREAD_PROCESS_SHARED
22542254
PTHREAD_STACK_MIN
2255+
PTP_CLOCK_GETCAPS2
22552256
PTP_ENABLE_PPS
22562257
PTP_ENABLE_PPS2
22572258
PTP_EXTTS_REQUEST

src/unix/linux_like/linux/mod.rs

+15-79
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,19 @@ s! {
11951195
pub rsv: [::c_uint; 5],
11961196
}
11971197

1198+
pub struct ptp_clock_caps {
1199+
pub max_adj: ::c_int,
1200+
pub n_alarm: ::c_int,
1201+
pub n_ext_ts: ::c_int,
1202+
pub n_per_out: ::c_int,
1203+
pub pps: ::c_int,
1204+
pub n_pins: ::c_int,
1205+
pub cross_timestamping: ::c_int,
1206+
pub adjust_phase: ::c_int,
1207+
pub max_phase_adj: ::c_int,
1208+
pub rsv: [::c_int; 11],
1209+
}
1210+
11981211
// linux/if_xdp.h
11991212
pub struct xsk_tx_metadata_completion {
12001213
pub tx_timestamp: ::__u64,
@@ -1206,81 +1219,6 @@ s! {
12061219
}
12071220
}
12081221

1209-
cfg_if! {
1210-
if #[cfg(all(target_arch = "loongarch64", target_env = "musl"))] {
1211-
s! {
1212-
pub struct ptp_clock_caps {
1213-
pub max_adj: ::c_int,
1214-
pub n_alarm: ::c_int,
1215-
pub n_ext_ts: ::c_int,
1216-
pub n_per_out: ::c_int,
1217-
pub pps: ::c_int,
1218-
pub n_pins: ::c_int,
1219-
pub cross_timestamping: ::c_int,
1220-
pub adjust_phase: ::c_int,
1221-
pub rsv: [::c_int; 12],
1222-
}
1223-
}
1224-
} else if #[cfg(all(target_arch = "loongarch64", target_env = "gnu"))] {
1225-
s! {
1226-
pub struct ptp_clock_caps {
1227-
pub max_adj: ::c_int,
1228-
pub n_alarm: ::c_int,
1229-
pub n_ext_ts: ::c_int,
1230-
pub n_per_out: ::c_int,
1231-
pub pps: ::c_int,
1232-
pub n_pins: ::c_int,
1233-
pub cross_timestamping: ::c_int,
1234-
pub adjust_phase: ::c_int,
1235-
pub max_phase_adj: ::c_int,
1236-
pub rsv: [::c_int; 11],
1237-
}
1238-
}
1239-
} else if #[cfg(any(target_arch = "sparc", target_arch = "sparc64"))] {
1240-
s! {
1241-
pub struct ptp_clock_caps {
1242-
pub max_adj: ::c_int,
1243-
pub n_alarm: ::c_int,
1244-
pub n_ext_ts: ::c_int,
1245-
pub n_per_out: ::c_int,
1246-
pub pps: ::c_int,
1247-
pub n_pins: ::c_int,
1248-
pub cross_timestamping: ::c_int,
1249-
pub adjust_phase: ::c_int,
1250-
pub rsv: [::c_int; 12],
1251-
}
1252-
}
1253-
} else if #[cfg(any(target_env = "musl", target_env = "ohos"))] {
1254-
s! {
1255-
pub struct ptp_clock_caps {
1256-
pub max_adj: ::c_int,
1257-
pub n_alarm: ::c_int,
1258-
pub n_ext_ts: ::c_int,
1259-
pub n_per_out: ::c_int,
1260-
pub pps: ::c_int,
1261-
pub n_pins: ::c_int,
1262-
pub cross_timestamping: ::c_int,
1263-
pub rsv: [::c_int; 13],
1264-
}
1265-
}
1266-
} else {
1267-
s! {
1268-
pub struct ptp_clock_caps {
1269-
pub max_adj: ::c_int,
1270-
pub n_alarm: ::c_int,
1271-
pub n_ext_ts: ::c_int,
1272-
pub n_per_out: ::c_int,
1273-
pub pps: ::c_int,
1274-
pub n_pins: ::c_int,
1275-
pub cross_timestamping: ::c_int,
1276-
pub adjust_phase: ::c_int,
1277-
pub max_phase_adj: ::c_int,
1278-
pub rsv: [::c_int; 11],
1279-
}
1280-
}
1281-
}
1282-
}
1283-
12841222
cfg_if! {
12851223
if #[cfg(not(target_arch = "sparc64"))] {
12861224
s! {
@@ -4641,8 +4579,7 @@ pub const PTP_MAX_SAMPLES: ::c_uint = 25; // Maximum allowed offset measurement
46414579

46424580
const PTP_CLK_MAGIC: u32 = b'=' as u32;
46434581

4644-
// FIXME: needs the ptp_clock_caps struct
4645-
// pub const PTP_CLOCK_GETCAPS: ::c_uint = _IOR::<ptp_clock_caps>(PTP_CLK_MAGIC, 1);
4582+
pub const PTP_CLOCK_GETCAPS: ::c_uint = _IOR::<ptp_clock_caps>(PTP_CLK_MAGIC, 1);
46464583
pub const PTP_EXTTS_REQUEST: ::c_uint = _IOW::<ptp_extts_request>(PTP_CLK_MAGIC, 2);
46474584
pub const PTP_PEROUT_REQUEST: ::c_uint = _IOW::<ptp_perout_request>(PTP_CLK_MAGIC, 3);
46484585
pub const PTP_ENABLE_PPS: ::c_uint = _IOW::<::c_int>(PTP_CLK_MAGIC, 4);
@@ -4652,8 +4589,7 @@ pub const PTP_PIN_SETFUNC: ::c_uint = _IOW::<ptp_pin_desc>(PTP_CLK_MAGIC, 7);
46524589
pub const PTP_SYS_OFFSET_PRECISE: ::c_uint = _IOWR::<ptp_sys_offset_precise>(PTP_CLK_MAGIC, 8);
46534590
pub const PTP_SYS_OFFSET_EXTENDED: ::c_uint = _IOWR::<ptp_sys_offset_extended>(PTP_CLK_MAGIC, 9);
46544591

4655-
// FIXME: needs the ptp_clock_caps struct
4656-
// pub const PTP_CLOCK_GETCAPS2: ::c_uint = _IOR::<ptp_clock_caps>(PTP_CLK_MAGIC, 10);
4592+
pub const PTP_CLOCK_GETCAPS2: ::c_uint = _IOR::<ptp_clock_caps>(PTP_CLK_MAGIC, 10);
46574593
pub const PTP_EXTTS_REQUEST2: ::c_uint = _IOW::<ptp_extts_request>(PTP_CLK_MAGIC, 11);
46584594
pub const PTP_PEROUT_REQUEST2: ::c_uint = _IOW::<ptp_perout_request>(PTP_CLK_MAGIC, 12);
46594595
pub const PTP_ENABLE_PPS2: ::c_uint = _IOW::<::c_int>(PTP_CLK_MAGIC, 13);

0 commit comments

Comments
 (0)