Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use use to alias open/openat in lfs64.rs #3265

Merged
merged 1 commit into from
Jun 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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