Skip to content

Commit 3d4a7e2

Browse files
committed
emscripten: deprecate file offset types
emscripten follows musl quite closely. The changes they make are not concerned with file offset types. The only exception to this is `blkcnt_t`. This type is defined as 32-bits wide no matter the target. All other file offset types are 64-bit wide no matter the target.
1 parent 413bb61 commit 3d4a7e2

3 files changed

Lines changed: 46 additions & 12 deletions

File tree

libc-test/semver/emscripten.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ getgrnam
66
getgrnam_r
77
getpwnam_r
88
getpwuid_r
9-
posix_fallocate64

src/unix/linux_like/emscripten/mod.rs

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,40 @@ pub type fsfilcnt_t = u32;
2828
pub type rlim_t = u64;
2929
pub type nlink_t = u32;
3030

31-
pub type ino64_t = crate::ino_t;
32-
pub type off64_t = off_t;
33-
pub type blkcnt64_t = crate::blkcnt_t;
34-
pub type rlim64_t = crate::rlim_t;
35-
36-
pub type rlimit64 = crate::rlimit;
37-
pub type flock64 = crate::flock;
38-
pub type stat64 = crate::stat;
39-
pub type statfs64 = crate::statfs;
40-
pub type statvfs64 = crate::statvfs;
41-
pub type dirent64 = crate::dirent;
31+
macro_rules! deprecate_lfs64 {
32+
($($it:item)+) => {
33+
$(
34+
#[deprecated(
35+
since = "0.2.187",
36+
note = "Use the unsuffixed variant instead. emscripten uses musl, and makes no \
37+
changes to these types. musl exposes 64-bit types no matter the target \
38+
triple.",
39+
)]
40+
$it
41+
)+
42+
};
43+
}
44+
45+
deprecate_lfs64! {
46+
pub type ino64_t = ino_t;
47+
pub type off64_t = off_t;
48+
pub type blkcnt64_t = crate::blkcnt_t;
49+
pub type rlim64_t = crate::rlim_t;
50+
51+
pub type rlimit64 = crate::rlimit;
52+
pub type flock64 = crate::flock;
53+
pub type stat64 = crate::stat;
54+
pub type statfs64 = crate::statfs;
55+
pub type statvfs64 = crate::statvfs;
56+
pub type dirent64 = crate::dirent;
57+
}
4258

4359
extern_ty! {
60+
#[deprecated(
61+
since = "0.2.187",
62+
note = "Use the unsuffixed variant instead. emscripten uses musl, and makes no changes to \
63+
these types. musl exposes 64-bit types no mater the target triple."
64+
)]
4465
pub enum fpos64_t {} // FIXME(emscripten): fill this out with a struct
4566
}
4667

@@ -1456,5 +1477,18 @@ extern "C" {
14561477
}
14571478

14581479
// Alias <foo> to <foo>64 to mimic glibc's LFS64 support
1480+
#[deprecated(
1481+
since = "0.2.187",
1482+
note = "Use the unsuffixed variant instead. emscripten uses musl, and makes no changes to \
1483+
these routines. musl exposes 64-bit types no matter the target triple."
1484+
)]
1485+
#[allow(deprecated)]
14591486
mod lfs64;
1487+
1488+
#[deprecated(
1489+
since = "0.2.187",
1490+
note = "Use the unsuffixed variant instead. emscripten uses musl, and makes no changes to \
1491+
these routines. musl exposes 64-bit types no matter the target triple."
1492+
)]
1493+
#[allow(deprecated)]
14601494
pub use self::lfs64::*;

src/unix/linux_like/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ cfg_if! {
533533
if #[cfg(target_os = "android")] {
534534
pub const RLIM64_INFINITY: c_ulonglong = !0;
535535
} else {
536+
#[cfg_attr(target_os = "emscripten", allow(deprecated))]
536537
pub const RLIM64_INFINITY: crate::rlim64_t = !0;
537538
}
538539
}

0 commit comments

Comments
 (0)