Skip to content

Commit 795e59a

Browse files
authored
Merge pull request #4150 from cramertj/array-size-revert
[0.2] Array size revert
2 parents 7b80739 + a1c30e3 commit 795e59a

File tree

11 files changed

+23
-19
lines changed

11 files changed

+23
-19
lines changed

libc-test/build.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@ fn test_apple(target: &str) {
400400
// FIXME: the array size has been changed since macOS 10.15 ([8] -> [7]).
401401
("statfs", "f_reserved") => true,
402402
("__darwin_arm_neon_state64", "__v") => true,
403-
403+
// MAXPATHLEN is too big for auto-derive traits on arrays.
404+
("vnode_info_path", "vip_path") => true,
404405
("ifreq", "ifr_ifru") => true,
405406
("in6_ifreq", "ifr_ifru") => true,
406407
("ifkpi", "ifk_data") => true,
@@ -2763,6 +2764,8 @@ fn test_freebsd(target: &str) {
27632764
("umutex", "m_owner") => true,
27642765
// c_has_waiters field is a volatile int32_t
27652766
("ucond", "c_has_waiters") => true,
2767+
// is PATH_MAX long but tests can't accept multi array as equivalent.
2768+
("kinfo_vmentry", "kve_path") => true,
27662769

27672770
// a_un field is a union
27682771
("Elf32_Auxinfo", "a_un") => true,
@@ -2791,6 +2794,10 @@ fn test_freebsd(target: &str) {
27912794
// Anonymous type.
27922795
("filestat", "next") => true,
27932796

2797+
// We ignore this field because we needed to use a hack in order to make rust 1.19
2798+
// happy...
2799+
("kinfo_proc", "ki_sparestrings") => true,
2800+
27942801
// `__sem_base` is a private struct field
27952802
("semid_ds", "__sem_base") => true,
27962803

src/unix/bsd/apple/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,9 @@ s! {
939939

940940
pub struct vnode_info_path {
941941
pub vip_vi: vnode_info,
942-
pub vip_path: [::c_char; ::MAXPATHLEN as usize],
942+
// Normally it's `vip_path: [::c_char; MAXPATHLEN]` but because libc supports an old rustc
943+
// version, we go around this limitation like this.
944+
pub vip_path: [[::c_char; 32]; 32],
943945
}
944946

945947
pub struct proc_vnodepathinfo {

src/unix/bsd/freebsdlike/dragonfly/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ s_no_extra_traits! {
517517
pub mc_ownedfp: ::c_uint,
518518
__reserved: ::c_uint,
519519
__unused: [::c_uint; 8],
520-
pub mc_fpregs: [::c_uint; 256],
520+
pub mc_fpregs: [[::c_uint; 8]; 32],
521521
}
522522

523523
pub struct ucontext_t {

src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ s! {
166166
/// More thread name.
167167
pub ki_moretdname: [::c_char; ::MAXCOMLEN - ::TDNAMLEN + 1],
168168
/// Spare string space.
169-
pub ki_sparestrings: [::c_char; 46],
169+
pub ki_sparestrings: [[::c_char; 23]; 2], // little hack to allow PartialEq
170170
/// Spare room for growth.
171171
pub ki_spareints: [::c_int; ::KI_NSPARE_INT],
172172
/// Which cpu we are on.

src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ s! {
173173
/// More thread name.
174174
pub ki_moretdname: [::c_char; ::MAXCOMLEN - ::TDNAMLEN + 1],
175175
/// Spare string space.
176-
pub ki_sparestrings: [::c_char; 46],
176+
pub ki_sparestrings: [[::c_char; 23]; 2], // little hack to allow PartialEq
177177
/// Spare room for growth.
178178
pub ki_spareints: [::c_int; ::KI_NSPARE_INT],
179179
/// Controlling tty dev.

src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ s! {
183183
/// More thread name.
184184
pub ki_moretdname: [::c_char; ::MAXCOMLEN - ::TDNAMLEN + 1],
185185
/// Spare string space.
186-
pub ki_sparestrings: [::c_char; 46],
186+
pub ki_sparestrings: [[::c_char; 23]; 2], // little hack to allow PartialEq
187187
/// Spare room for growth.
188188
pub ki_spareints: [::c_int; ::KI_NSPARE_INT],
189189
/// Controlling tty dev.

src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ s! {
183183
/// More thread name.
184184
pub ki_moretdname: [::c_char; ::MAXCOMLEN - ::TDNAMLEN + 1],
185185
/// Spare string space.
186-
pub ki_sparestrings: [::c_char; 46],
186+
pub ki_sparestrings: [[::c_char; 23]; 2], // little hack to allow PartialEq
187187
/// Spare room for growth.
188188
pub ki_spareints: [::c_int; ::KI_NSPARE_INT],
189189
/// Controlling tty dev.

src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ s! {
183183
/// More thread name.
184184
pub ki_moretdname: [::c_char; ::MAXCOMLEN - ::TDNAMLEN + 1],
185185
/// Spare string space.
186-
pub ki_sparestrings: [::c_char; 46],
186+
pub ki_sparestrings: [[::c_char; 23]; 2], // little hack to allow PartialEq
187187
/// Spare room for growth.
188188
pub ki_spareints: [::c_int; ::KI_NSPARE_INT],
189189
/// Controlling tty dev.

src/unix/bsd/freebsdlike/freebsd/mod.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ s! {
457457
_kve_is_spare: [::c_int; 8],
458458
#[cfg(freebsd11)]
459459
_kve_is_spare: [::c_int; 12],
460-
pub kve_path: [::c_char; ::PATH_MAX as usize],
460+
pub kve_path: [[::c_char; 32]; 32],
461461
}
462462

463463
pub struct __c_anonymous_filestat {
@@ -1144,7 +1144,7 @@ s! {
11441144
pub sinfo_assoc_id: ::sctp_assoc_t,
11451145
pub sinfo_keynumber: u16,
11461146
pub sinfo_keynumber_valid: u16,
1147-
pub __reserve_pad: [u8; SCTP_ALIGN_RESV_PAD],
1147+
pub __reserve_pad: [[u8; 23]; 4],
11481148
}
11491149

11501150
pub struct sctp_extrcvinfo {
@@ -1164,7 +1164,7 @@ s! {
11641164
pub serinfo_next_ppid: u32,
11651165
pub sinfo_keynumber: u16,
11661166
pub sinfo_keynumber_valid: u16,
1167-
pub __reserve_pad: [u8; SCTP_ALIGN_RESV_PAD_SHORT],
1167+
pub __reserve_pad: [[u8; 19]; 4],
11681168
}
11691169

11701170
pub struct sctp_sndinfo {
@@ -4865,11 +4865,6 @@ pub const SCTP_ASSOC_RESET_FAILED: ::c_int = 0x0008;
48654865
pub const SCTP_STREAM_CHANGE_DENIED: ::c_int = 0x0004;
48664866
pub const SCTP_STREAM_CHANGE_FAILED: ::c_int = 0x0008;
48674867

4868-
// sctp_uio.h
4869-
4870-
pub const SCTP_ALIGN_RESV_PAD: usize = 92;
4871-
pub const SCTP_ALIGN_RESV_PAD_SHORT: usize = 76;
4872-
48734868
pub const KENV_DUMP_LOADER: ::c_int = 4;
48744869
pub const KENV_DUMP_STATIC: ::c_int = 5;
48754870

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ s! {
284284

285285
pub struct accept_filter_arg {
286286
pub af_name: [::c_char; 16],
287-
af_arg: [::c_char; 240],
287+
af_arg: [::c_char; 256 - 16],
288288
}
289289

290290
pub struct ptrace_io_desc {

src/unix/bsd/netbsdlike/netbsd/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ s! {
520520

521521
pub struct accept_filter_arg {
522522
pub af_name: [::c_char; 16],
523-
pub af_arg: [::c_char; 256 - 16],
523+
af_arg: [::c_char; 256 - 16],
524524
}
525525

526526
pub struct ki_sigset_t {
@@ -671,7 +671,7 @@ s! {
671671
pub kve_vn_rdev: u64,
672672
pub kve_vn_type: u32,
673673
pub kve_vn_mode: u32,
674-
pub kve_path: [::c_char; ::PATH_MAX as usize],
674+
pub kve_path: [[::c_char; 32]; 32],
675675
}
676676

677677
pub struct __c_anonymous_posix_spawn_fae_open {

0 commit comments

Comments
 (0)