Skip to content

Commit ae6916f

Browse files
committed
Use use to alias open/openat in lfs64.rs
1 parent e0dfb3f commit ae6916f

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

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

+8-18
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,14 @@ pub unsafe extern "C" fn mmap64(
108108
::mmap(addr, length, prot, flags, fd, offset)
109109
}
110110

111-
#[inline]
112-
pub unsafe extern "C" fn open64(
113-
pathname: *const ::c_char,
114-
flags: ::c_int,
115-
mode: ::mode_t,
116-
) -> ::c_int {
117-
::open(pathname, flags, mode)
118-
}
119-
120-
#[inline]
121-
pub unsafe extern "C" fn openat64(
122-
dirfd: ::c_int,
123-
pathname: *const ::c_char,
124-
flags: ::c_int,
125-
mode: ::mode_t,
126-
) -> ::c_int {
127-
::openat(dirfd, pathname, flags, mode)
128-
}
111+
// These functions are variadic in the C ABI since the `mode` argument is "optional". Variadic
112+
// `extern "C"` functions are unstable in Rust so we cannot write a shim function for these
113+
// entrypoints. See https://github.com/rust-lang/rust/issues/44930.
114+
//
115+
// These aliases are mostly fine though, neither function takes a LFS64-namespaced type as an
116+
// argument, nor do their names clash with any declared types.
117+
pub use ::open as open64
118+
pub use ::openat as openat64
129119

130120
#[inline]
131121
pub unsafe extern "C" fn posix_fadvise64(

0 commit comments

Comments
 (0)