Skip to content

Commit 31c3cd4

Browse files
asomersAkhilTThomas
authored andcommitted
Fix "struct stat" on 32-bit FreeBSD 12+ (rust-lang#3939)
* Fix the definition of ino_t on 32-bit FreeBSD 12+ Commit 7437d0a erroneously defined it as "ulong" instead of u64. Nobody noticed the mistake, probably because it was only tested on 64-bit architectures, where those are equivalent. But it's a problem now, after rust-lang#3723 , which switched the standard library to a FreeBSD 12 ABI. Issue rust-lang/rust#130677 * Fix the definition of "struct stat" on 32-bit FreeBSD 12+ The original definitions were never correct. But nobody noticed because we don't do CI on 32-bit FreeBSD. The problem is apparent now due to rust-lang#3723 , which caused the nightly toolchain to switch to a FreeBSD 12 ABI. Fixes rust-lang/rust#130677 * fixup: fix build on powerpc, powerpc64, and arm
1 parent 2c19b86 commit 31c3cd4

File tree

4 files changed

+136
-0
lines changed

4 files changed

+136
-0
lines changed

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,40 @@ s! {
255255
pub st_gen: u64,
256256
pub st_spare: [u64; 10],
257257
}
258+
259+
pub struct stat {
260+
pub st_dev: ::dev_t,
261+
pub st_ino: ::ino_t,
262+
pub st_nlink: ::nlink_t,
263+
pub st_mode: ::mode_t,
264+
st_padding0: i16,
265+
pub st_uid: ::uid_t,
266+
pub st_gid: ::gid_t,
267+
st_padding1: i32,
268+
pub st_rdev: ::dev_t,
269+
#[cfg(target_arch = "x86")]
270+
st_atim_ext: i32,
271+
pub st_atime: ::time_t,
272+
pub st_atime_nsec: ::c_long,
273+
#[cfg(target_arch = "x86")]
274+
st_mtim_ext: i32,
275+
pub st_mtime: ::time_t,
276+
pub st_mtime_nsec: ::c_long,
277+
#[cfg(target_arch = "x86")]
278+
st_ctim_ext: i32,
279+
pub st_ctime: ::time_t,
280+
pub st_ctime_nsec: ::c_long,
281+
#[cfg(target_arch = "x86")]
282+
st_btim_ext: i32,
283+
pub st_birthtime: ::time_t,
284+
pub st_birthtime_nsec: ::c_long,
285+
pub st_size: ::off_t,
286+
pub st_blocks: ::blkcnt_t,
287+
pub st_blksize: ::blksize_t,
288+
pub st_flags: ::fflags_t,
289+
pub st_gen: u64,
290+
pub st_spare: [u64; 10],
291+
}
258292
}
259293

260294
s_no_extra_traits! {

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,40 @@ s! {
268268
pub st_gen: u64,
269269
pub st_spare: [u64; 10],
270270
}
271+
272+
pub struct stat {
273+
pub st_dev: ::dev_t,
274+
pub st_ino: ::ino_t,
275+
pub st_nlink: ::nlink_t,
276+
pub st_mode: ::mode_t,
277+
st_padding0: i16,
278+
pub st_uid: ::uid_t,
279+
pub st_gid: ::gid_t,
280+
st_padding1: i32,
281+
pub st_rdev: ::dev_t,
282+
#[cfg(target_arch = "x86")]
283+
st_atim_ext: i32,
284+
pub st_atime: ::time_t,
285+
pub st_atime_nsec: ::c_long,
286+
#[cfg(target_arch = "x86")]
287+
st_mtim_ext: i32,
288+
pub st_mtime: ::time_t,
289+
pub st_mtime_nsec: ::c_long,
290+
#[cfg(target_arch = "x86")]
291+
st_ctim_ext: i32,
292+
pub st_ctime: ::time_t,
293+
pub st_ctime_nsec: ::c_long,
294+
#[cfg(target_arch = "x86")]
295+
st_btim_ext: i32,
296+
pub st_birthtime: ::time_t,
297+
pub st_birthtime_nsec: ::c_long,
298+
pub st_size: ::off_t,
299+
pub st_blocks: ::blkcnt_t,
300+
pub st_blksize: ::blksize_t,
301+
pub st_flags: ::fflags_t,
302+
pub st_gen: u64,
303+
pub st_spare: [u64; 10],
304+
}
271305
}
272306

273307
s_no_extra_traits! {

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,40 @@ s! {
268268
pub st_gen: u64,
269269
pub st_spare: [u64; 10],
270270
}
271+
272+
pub struct stat {
273+
pub st_dev: ::dev_t,
274+
pub st_ino: ::ino_t,
275+
pub st_nlink: ::nlink_t,
276+
pub st_mode: ::mode_t,
277+
st_padding0: i16,
278+
pub st_uid: ::uid_t,
279+
pub st_gid: ::gid_t,
280+
st_padding1: i32,
281+
pub st_rdev: ::dev_t,
282+
#[cfg(target_arch = "x86")]
283+
st_atim_ext: i32,
284+
pub st_atime: ::time_t,
285+
pub st_atime_nsec: ::c_long,
286+
#[cfg(target_arch = "x86")]
287+
st_mtim_ext: i32,
288+
pub st_mtime: ::time_t,
289+
pub st_mtime_nsec: ::c_long,
290+
#[cfg(target_arch = "x86")]
291+
st_ctim_ext: i32,
292+
pub st_ctime: ::time_t,
293+
pub st_ctime_nsec: ::c_long,
294+
#[cfg(target_arch = "x86")]
295+
st_btim_ext: i32,
296+
pub st_birthtime: ::time_t,
297+
pub st_birthtime_nsec: ::c_long,
298+
pub st_size: ::off_t,
299+
pub st_blocks: ::blkcnt_t,
300+
pub st_blksize: ::blksize_t,
301+
pub st_flags: ::fflags_t,
302+
pub st_gen: u64,
303+
pub st_spare: [u64; 10],
304+
}
271305
}
272306

273307
s_no_extra_traits! {

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,40 @@ s! {
269269
pub st_filerev: u64,
270270
pub st_spare: [u64; 9],
271271
}
272+
273+
pub struct stat {
274+
pub st_dev: ::dev_t,
275+
pub st_ino: ::ino_t,
276+
pub st_nlink: ::nlink_t,
277+
pub st_mode: ::mode_t,
278+
st_padding0: i16,
279+
pub st_uid: ::uid_t,
280+
pub st_gid: ::gid_t,
281+
st_padding1: i32,
282+
pub st_rdev: ::dev_t,
283+
#[cfg(target_arch = "x86")]
284+
st_atim_ext: i32,
285+
pub st_atime: ::time_t,
286+
pub st_atime_nsec: ::c_long,
287+
#[cfg(target_arch = "x86")]
288+
st_mtim_ext: i32,
289+
pub st_mtime: ::time_t,
290+
pub st_mtime_nsec: ::c_long,
291+
#[cfg(target_arch = "x86")]
292+
st_ctim_ext: i32,
293+
pub st_ctime: ::time_t,
294+
pub st_ctime_nsec: ::c_long,
295+
#[cfg(target_arch = "x86")]
296+
st_btim_ext: i32,
297+
pub st_birthtime: ::time_t,
298+
pub st_birthtime_nsec: ::c_long,
299+
pub st_size: ::off_t,
300+
pub st_blocks: ::blkcnt_t,
301+
pub st_blksize: ::blksize_t,
302+
pub st_flags: ::fflags_t,
303+
pub st_gen: u64,
304+
pub st_spare: [u64; 10],
305+
}
272306
}
273307

274308
s_no_extra_traits! {

0 commit comments

Comments
 (0)