Skip to content

Commit b2d1051

Browse files
committed
Alias all LFS64 symbols to their non-LFS64 counterparts on musl
1 parent 88740ef commit b2d1051

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

src/unix/linux_like/linux/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4269,20 +4269,29 @@ extern "C" {
42694269
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
42704270
pub fn __errno_location() -> *mut ::c_int;
42714271

4272+
#[cfg(not(target_env = "musl"))]
42724273
pub fn fopen64(filename: *const c_char, mode: *const c_char) -> *mut ::FILE;
4274+
#[cfg(not(target_env = "musl"))]
42734275
pub fn freopen64(
42744276
filename: *const c_char,
42754277
mode: *const c_char,
42764278
file: *mut ::FILE,
42774279
) -> *mut ::FILE;
4280+
#[cfg(not(target_env = "musl"))]
42784281
pub fn tmpfile64() -> *mut ::FILE;
4282+
#[cfg(not(target_env = "musl"))]
42794283
pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int;
4284+
#[cfg(not(target_env = "musl"))]
42804285
pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int;
4286+
#[cfg(not(target_env = "musl"))]
42814287
pub fn fseeko64(stream: *mut ::FILE, offset: ::off64_t, whence: ::c_int) -> ::c_int;
4288+
#[cfg(not(target_env = "musl"))]
42824289
pub fn ftello64(stream: *mut ::FILE) -> ::off64_t;
42834290
pub fn fallocate(fd: ::c_int, mode: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int;
4291+
#[cfg(not(target_env = "musl"))]
42844292
pub fn fallocate64(fd: ::c_int, mode: ::c_int, offset: ::off64_t, len: ::off64_t) -> ::c_int;
42854293
pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int;
4294+
#[cfg(not(target_env = "musl"))]
42864295
pub fn posix_fallocate64(fd: ::c_int, offset: ::off64_t, len: ::off64_t) -> ::c_int;
42874296
pub fn readahead(fd: ::c_int, offset: ::off64_t, count: ::size_t) -> ::ssize_t;
42884297
pub fn getxattr(
@@ -4584,6 +4593,7 @@ extern "C" {
45844593
offset: *mut off_t,
45854594
count: ::size_t,
45864595
) -> ::ssize_t;
4596+
#[cfg(not(target_env = "musl"))]
45874597
pub fn sendfile64(
45884598
out_fd: ::c_int,
45894599
in_fd: ::c_int,

src/unix/linux_like/linux/musl/mod.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,35 @@ extern "C" {
784784
pub fn basename(path: *mut ::c_char) -> *mut ::c_char;
785785
}
786786

787+
pub use tmpfile as tmpfile64;
788+
pub use fallocate as fallocate64;
789+
pub use fgetpos as fgetpos64;
790+
pub use fopen as fopen64;
791+
pub use freopen as freopen64;
792+
pub use fseeko as fseeko64;
793+
pub use fsetpos as fsetpos64;
794+
pub use ftello as ftello64;
795+
pub use posix_fallocate as posix_fallocate64;
796+
pub use sendfile as sendfile64;
797+
pub use statfs as statfs64;
798+
pub use fstatfs as fstatfs64;
799+
pub use statvfs as statvfs64;
800+
pub use fstatvfs as fstatvfs64;
801+
pub use creat as creat64;
802+
pub use fstat as fstat64;
803+
pub use fstatat as fstatat64;
804+
pub use ftruncate as ftruncate64;
805+
pub use lseek as lseek64;
806+
pub use lstat as lstat64;
807+
pub use open as open64;
808+
pub use openat as openat64;
809+
pub use pread as pread64;
810+
pub use pwrite as pwrite64;
811+
pub use readdir as readdir64;
812+
pub use readdir_r as readdir64_r;
813+
pub use stat as stat64;
814+
pub use truncate as truncate64;
815+
787816
cfg_if! {
788817
if #[cfg(any(target_arch = "x86_64",
789818
target_arch = "aarch64",

src/unix/linux_like/mod.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,10 +1673,14 @@ extern "C" {
16731673
pub fn setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int;
16741674
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
16751675
pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
1676+
#[cfg(not(target_env = "musl"))]
16761677
pub fn statfs64(path: *const ::c_char, buf: *mut statfs64) -> ::c_int;
16771678
pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
1679+
#[cfg(not(target_env = "musl"))]
16781680
pub fn fstatfs64(fd: ::c_int, buf: *mut statfs64) -> ::c_int;
1681+
#[cfg(not(target_env = "musl"))]
16791682
pub fn statvfs64(path: *const ::c_char, buf: *mut statvfs64) -> ::c_int;
1683+
#[cfg(not(target_env = "musl"))]
16801684
pub fn fstatvfs64(fd: ::c_int, buf: *mut statvfs64) -> ::c_int;
16811685
pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
16821686

@@ -1698,16 +1702,22 @@ extern "C" {
16981702
pub fn freelocale(loc: ::locale_t);
16991703
pub fn newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t;
17001704
pub fn uselocale(loc: ::locale_t) -> ::locale_t;
1705+
#[cfg(not(target_env = "musl"))]
17011706
pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int;
1707+
#[cfg(not(target_env = "musl"))]
17021708
pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int;
1709+
#[cfg(not(target_env = "musl"))]
17031710
pub fn fstatat64(
17041711
dirfd: ::c_int,
17051712
pathname: *const c_char,
17061713
buf: *mut stat64,
17071714
flags: ::c_int,
17081715
) -> ::c_int;
1716+
#[cfg(not(target_env = "musl"))]
17091717
pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int;
1718+
#[cfg(not(target_env = "musl"))]
17101719
pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t;
1720+
#[cfg(not(target_env = "musl"))]
17111721
pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
17121722
pub fn mmap64(
17131723
addr: *mut ::c_void,
@@ -1717,22 +1727,30 @@ extern "C" {
17171727
fd: ::c_int,
17181728
offset: off64_t,
17191729
) -> *mut ::c_void;
1730+
#[cfg(not(target_env = "musl"))]
17201731
pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
1732+
#[cfg(not(target_env = "musl"))]
17211733
pub fn openat64(fd: ::c_int, path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
1734+
#[cfg(not(target_env = "musl"))]
17221735
pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off64_t) -> ::ssize_t;
1736+
#[cfg(not(target_env = "musl"))]
17231737
pub fn pwrite64(
17241738
fd: ::c_int,
17251739
buf: *const ::c_void,
17261740
count: ::size_t,
17271741
offset: off64_t,
17281742
) -> ::ssize_t;
1743+
#[cfg(not(target_env = "musl"))]
17291744
pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64;
1745+
#[cfg(not(target_env = "musl"))]
17301746
pub fn readdir64_r(
17311747
dirp: *mut ::DIR,
17321748
entry: *mut ::dirent64,
17331749
result: *mut *mut ::dirent64,
17341750
) -> ::c_int;
1751+
#[cfg(not(target_env = "musl"))]
17351752
pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
1753+
#[cfg(not(target_env = "musl"))]
17361754
pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int;
17371755

17381756
pub fn mknodat(

0 commit comments

Comments
 (0)