Skip to content

Commit 394d27d

Browse files
committed
Alias all LFS64 symbols to their non-LFS64 counterparts on musl
1 parent bbf929d commit 394d27d

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed

src/unix/linux_like/linux/mod.rs

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

3855+
#[cfg(not(target_env = "musl"))]
38553856
pub fn fopen64(filename: *const c_char, mode: *const c_char) -> *mut ::FILE;
3857+
#[cfg(not(target_env = "musl"))]
38563858
pub fn freopen64(
38573859
filename: *const c_char,
38583860
mode: *const c_char,
38593861
file: *mut ::FILE,
38603862
) -> *mut ::FILE;
3863+
#[cfg(not(target_env = "musl"))]
38613864
pub fn tmpfile64() -> *mut ::FILE;
3865+
#[cfg(not(target_env = "musl"))]
38623866
pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int;
3867+
#[cfg(not(target_env = "musl"))]
38633868
pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int;
3869+
#[cfg(not(target_env = "musl"))]
38643870
pub fn fseeko64(stream: *mut ::FILE, offset: ::off64_t, whence: ::c_int) -> ::c_int;
3871+
#[cfg(not(target_env = "musl"))]
38653872
pub fn ftello64(stream: *mut ::FILE) -> ::off64_t;
38663873
pub fn fallocate(fd: ::c_int, mode: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int;
3874+
#[cfg(not(target_env = "musl"))]
38673875
pub fn fallocate64(fd: ::c_int, mode: ::c_int, offset: ::off64_t, len: ::off64_t) -> ::c_int;
38683876
pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int;
3877+
#[cfg(not(target_env = "musl"))]
38693878
pub fn posix_fallocate64(fd: ::c_int, offset: ::off64_t, len: ::off64_t) -> ::c_int;
38703879
pub fn readahead(fd: ::c_int, offset: ::off64_t, count: ::size_t) -> ::ssize_t;
38713880
pub fn getxattr(
@@ -4183,6 +4192,7 @@ extern "C" {
41834192
offset: *mut off_t,
41844193
count: ::size_t,
41854194
) -> ::ssize_t;
4195+
#[cfg(not(target_env = "musl"))]
41864196
pub fn sendfile64(
41874197
out_fd: ::c_int,
41884198
in_fd: ::c_int,

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

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ s_no_extra_traits! {
301301
pub ut_exit: __exit_status,
302302

303303
//#[cfg(target_endian = "little")]
304-
pub ut_session: ::c_long,
304+
pub ut_session: ::c_int,
305305
//#[cfg(target_endian = "little")]
306306
//__ut_pad2: ::c_long,
307307

@@ -772,6 +772,35 @@ extern "C" {
772772
pub fn basename(path: *mut ::c_char) -> *mut ::c_char;
773773
}
774774

775+
pub use tmpfile as tmpfile64;
776+
pub use fallocate as fallocate64;
777+
pub use fgetpos as fgetpos64;
778+
pub use fopen as fopen64;
779+
pub use freopen as freopen64;
780+
pub use fseeko as fseeko64;
781+
pub use fsetpos as fsetpos64;
782+
pub use ftello as ftello64;
783+
pub use posix_fallocate as posix_fallocate64;
784+
pub use sendfile as sendfile64;
785+
pub use statfs as statfs64;
786+
pub use fstatfs as fstatfs64;
787+
pub use statvfs as statvfs64;
788+
pub use fstatvfs as fstatvfs64;
789+
pub use creat as creat64;
790+
pub use fstat as fstat64;
791+
pub use fstatat as fstatat64;
792+
pub use ftruncate as ftruncate64;
793+
pub use lseek as lseek64;
794+
pub use lstat as lstat64;
795+
pub use open as open64;
796+
pub use openat as openat64;
797+
pub use pread as pread64;
798+
pub use pwrite as pwrite64;
799+
pub use readdir as readdir64;
800+
pub use readdir_r as readdir64_r;
801+
pub use stat as stat64;
802+
pub use truncate as truncate64;
803+
775804
cfg_if! {
776805
if #[cfg(any(target_arch = "x86_64",
777806
target_arch = "aarch64",

src/unix/linux_like/mod.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,10 +1645,14 @@ extern "C" {
16451645
pub fn setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int;
16461646
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
16471647
pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
1648+
#[cfg(not(target_env = "musl"))]
16481649
pub fn statfs64(path: *const ::c_char, buf: *mut statfs64) -> ::c_int;
16491650
pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
1651+
#[cfg(not(target_env = "musl"))]
16501652
pub fn fstatfs64(fd: ::c_int, buf: *mut statfs64) -> ::c_int;
1653+
#[cfg(not(target_env = "musl"))]
16511654
pub fn statvfs64(path: *const ::c_char, buf: *mut statvfs64) -> ::c_int;
1655+
#[cfg(not(target_env = "musl"))]
16521656
pub fn fstatvfs64(fd: ::c_int, buf: *mut statvfs64) -> ::c_int;
16531657
pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
16541658

@@ -1670,16 +1674,22 @@ extern "C" {
16701674
pub fn freelocale(loc: ::locale_t);
16711675
pub fn newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t;
16721676
pub fn uselocale(loc: ::locale_t) -> ::locale_t;
1677+
#[cfg(not(target_env = "musl"))]
16731678
pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int;
1679+
#[cfg(not(target_env = "musl"))]
16741680
pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int;
1681+
#[cfg(not(target_env = "musl"))]
16751682
pub fn fstatat64(
16761683
dirfd: ::c_int,
16771684
pathname: *const c_char,
16781685
buf: *mut stat64,
16791686
flags: ::c_int,
16801687
) -> ::c_int;
1688+
#[cfg(not(target_env = "musl"))]
16811689
pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int;
1690+
#[cfg(not(target_env = "musl"))]
16821691
pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t;
1692+
#[cfg(not(target_env = "musl"))]
16831693
pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
16841694
pub fn mmap64(
16851695
addr: *mut ::c_void,
@@ -1689,22 +1699,30 @@ extern "C" {
16891699
fd: ::c_int,
16901700
offset: off64_t,
16911701
) -> *mut ::c_void;
1702+
#[cfg(not(target_env = "musl"))]
16921703
pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
1704+
#[cfg(not(target_env = "musl"))]
16931705
pub fn openat64(fd: ::c_int, path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
1706+
#[cfg(not(target_env = "musl"))]
16941707
pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off64_t) -> ::ssize_t;
1708+
#[cfg(not(target_env = "musl"))]
16951709
pub fn pwrite64(
16961710
fd: ::c_int,
16971711
buf: *const ::c_void,
16981712
count: ::size_t,
16991713
offset: off64_t,
17001714
) -> ::ssize_t;
1715+
#[cfg(not(target_env = "musl"))]
17011716
pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64;
1717+
#[cfg(not(target_env = "musl"))]
17021718
pub fn readdir64_r(
17031719
dirp: *mut ::DIR,
17041720
entry: *mut ::dirent64,
17051721
result: *mut *mut ::dirent64,
17061722
) -> ::c_int;
1723+
#[cfg(not(target_env = "musl"))]
17071724
pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
1725+
#[cfg(not(target_env = "musl"))]
17081726
pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int;
17091727

17101728
pub fn mknodat(

0 commit comments

Comments
 (0)