From 3d4a7e273b67974dc923bf45be075ac899615535 Mon Sep 17 00:00:00 2001 From: dybucc <149513579+dybucc@users.noreply.github.com> Date: Thu, 4 Jun 2026 10:35:02 +0200 Subject: [PATCH] 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. --- libc-test/semver/emscripten.txt | 1 - src/unix/linux_like/emscripten/mod.rs | 56 +++++++++++++++++++++------ src/unix/linux_like/mod.rs | 1 + 3 files changed, 46 insertions(+), 12 deletions(-) diff --git a/libc-test/semver/emscripten.txt b/libc-test/semver/emscripten.txt index dc9e6b4f3b52d..48559aa89bdc3 100644 --- a/libc-test/semver/emscripten.txt +++ b/libc-test/semver/emscripten.txt @@ -6,4 +6,3 @@ getgrnam getgrnam_r getpwnam_r getpwuid_r -posix_fallocate64 diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs index 128025d813789..076c2da2f6a61 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -28,19 +28,40 @@ pub type fsfilcnt_t = u32; pub type rlim_t = u64; pub type nlink_t = u32; -pub type ino64_t = crate::ino_t; -pub type off64_t = off_t; -pub type blkcnt64_t = crate::blkcnt_t; -pub type rlim64_t = crate::rlim_t; - -pub type rlimit64 = crate::rlimit; -pub type flock64 = crate::flock; -pub type stat64 = crate::stat; -pub type statfs64 = crate::statfs; -pub type statvfs64 = crate::statvfs; -pub type dirent64 = crate::dirent; +macro_rules! deprecate_lfs64 { + ($($it:item)+) => { + $( + #[deprecated( + since = "0.2.187", + note = "Use the unsuffixed variant instead. emscripten uses musl, and makes no \ + changes to these types. musl exposes 64-bit types no matter the target \ + triple.", + )] + $it + )+ + }; +} + +deprecate_lfs64! { + pub type ino64_t = ino_t; + pub type off64_t = off_t; + pub type blkcnt64_t = crate::blkcnt_t; + pub type rlim64_t = crate::rlim_t; + + pub type rlimit64 = crate::rlimit; + pub type flock64 = crate::flock; + pub type stat64 = crate::stat; + pub type statfs64 = crate::statfs; + pub type statvfs64 = crate::statvfs; + pub type dirent64 = crate::dirent; +} extern_ty! { + #[deprecated( + since = "0.2.187", + note = "Use the unsuffixed variant instead. emscripten uses musl, and makes no changes to \ + these types. musl exposes 64-bit types no mater the target triple." + )] pub enum fpos64_t {} // FIXME(emscripten): fill this out with a struct } @@ -1456,5 +1477,18 @@ extern "C" { } // Alias to 64 to mimic glibc's LFS64 support +#[deprecated( + since = "0.2.187", + note = "Use the unsuffixed variant instead. emscripten uses musl, and makes no changes to \ + these routines. musl exposes 64-bit types no matter the target triple." +)] +#[allow(deprecated)] mod lfs64; + +#[deprecated( + since = "0.2.187", + note = "Use the unsuffixed variant instead. emscripten uses musl, and makes no changes to \ + these routines. musl exposes 64-bit types no matter the target triple." +)] +#[allow(deprecated)] pub use self::lfs64::*; diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index e594abb9693b8..6b2f61af3417e 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -533,6 +533,7 @@ cfg_if! { if #[cfg(target_os = "android")] { pub const RLIM64_INFINITY: c_ulonglong = !0; } else { + #[cfg_attr(target_os = "emscripten", allow(deprecated))] pub const RLIM64_INFINITY: crate::rlim64_t = !0; } }