Skip to content

Commit

Permalink
Auto merge of #3265 - bossmc:issue-3264-variadic-open(at), r=Amanieu
Browse files Browse the repository at this point in the history
Use `use` to alias open/openat in lfs64.rs

Proposed workaround for #3264 (see that issue for details).
  • Loading branch information
bors committed Jun 6, 2023
2 parents e0dfb3f + 52badc6 commit a6c94f4
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions src/unix/linux_like/linux/musl/lfs64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,24 +108,14 @@ pub unsafe extern "C" fn mmap64(
::mmap(addr, length, prot, flags, fd, offset)
}

#[inline]
pub unsafe extern "C" fn open64(
pathname: *const ::c_char,
flags: ::c_int,
mode: ::mode_t,
) -> ::c_int {
::open(pathname, flags, mode)
}

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

#[inline]
pub unsafe extern "C" fn posix_fadvise64(
Expand Down

0 comments on commit a6c94f4

Please sign in to comment.