Skip to content

Commit 6280e51

Browse files
committed
Alias all LFS64 symbols to their non-LFS64 counterparts on musl
1 parent d99c37d commit 6280e51

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed

src/unix/linux_like/linux/mod.rs

+10
Original file line numberDiff line numberDiff line change
@@ -3764,20 +3764,29 @@ extern "C" {
37643764
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
37653765
pub fn __errno_location() -> *mut ::c_int;
37663766

3767+
#[cfg(not(target_env = "musl"))]
37673768
pub fn fopen64(filename: *const c_char, mode: *const c_char) -> *mut ::FILE;
3769+
#[cfg(not(target_env = "musl"))]
37683770
pub fn freopen64(
37693771
filename: *const c_char,
37703772
mode: *const c_char,
37713773
file: *mut ::FILE,
37723774
) -> *mut ::FILE;
3775+
#[cfg(not(target_env = "musl"))]
37733776
pub fn tmpfile64() -> *mut ::FILE;
3777+
#[cfg(not(target_env = "musl"))]
37743778
pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int;
3779+
#[cfg(not(target_env = "musl"))]
37753780
pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int;
3781+
#[cfg(not(target_env = "musl"))]
37763782
pub fn fseeko64(stream: *mut ::FILE, offset: ::off64_t, whence: ::c_int) -> ::c_int;
3783+
#[cfg(not(target_env = "musl"))]
37773784
pub fn ftello64(stream: *mut ::FILE) -> ::off64_t;
37783785
pub fn fallocate(fd: ::c_int, mode: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int;
3786+
#[cfg(not(target_env = "musl"))]
37793787
pub fn fallocate64(fd: ::c_int, mode: ::c_int, offset: ::off64_t, len: ::off64_t) -> ::c_int;
37803788
pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int;
3789+
#[cfg(not(target_env = "musl"))]
37813790
pub fn posix_fallocate64(fd: ::c_int, offset: ::off64_t, len: ::off64_t) -> ::c_int;
37823791
pub fn readahead(fd: ::c_int, offset: ::off64_t, count: ::size_t) -> ::ssize_t;
37833792
pub fn getxattr(
@@ -4095,6 +4104,7 @@ extern "C" {
40954104
offset: *mut off_t,
40964105
count: ::size_t,
40974106
) -> ::ssize_t;
4107+
#[cfg(not(target_env = "musl"))]
40984108
pub fn sendfile64(
40994109
out_fd: ::c_int,
41004110
in_fd: ::c_int,

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

+30-1
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

@@ -756,6 +756,35 @@ extern "C" {
756756
pub fn malloc_usable_size(ptr: *mut ::c_void) -> ::size_t;
757757
}
758758

759+
pub use tmpfile as tmpfile64;
760+
pub use fallocate as fallocate64;
761+
pub use fgetpos as fgetpos64;
762+
pub use fopen as fopen64;
763+
pub use freopen as freopen64;
764+
pub use fseeko as fseeko64;
765+
pub use fsetpos as fsetpos64;
766+
pub use ftello as ftello64;
767+
pub use posix_fallocate as posix_fallocate64;
768+
pub use sendfile as sendfile64;
769+
pub use statfs as statfs64;
770+
pub use fstatfs as fstatfs64;
771+
pub use statvfs as statvfs64;
772+
pub use fstatvfs as fstatvfs64;
773+
pub use creat as creat64;
774+
pub use fstat as fstat64;
775+
pub use fstatat as fstatat64;
776+
pub use ftruncate as ftruncate64;
777+
pub use lseek as lseek64;
778+
pub use lstat as lstat64;
779+
pub use open as open64;
780+
pub use openat as openat64;
781+
pub use pread as pread64;
782+
pub use pwrite as pwrite64;
783+
pub use readdir as readdir64;
784+
pub use readdir_r as readdir64_r;
785+
pub use stat as stat64;
786+
pub use truncate as truncate64;
787+
759788
cfg_if! {
760789
if #[cfg(any(target_arch = "x86_64",
761790
target_arch = "aarch64",

src/unix/linux_like/mod.rs

+18
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)