Skip to content

Commit

Permalink
Use the new impl AsFd for &T support in io-lifetimes.
Browse files Browse the repository at this point in the history
With rust-lang/rust#93888 now in nightly, and sunfishcode/io-lifetimes#18 now
in io-lifetimes 0.5.2, we can now simplify the `AsFd` pattern from
`fn foo<Fd: AsFd>(fd: &Fd)` to `fn foo<Fd: AsFd>(fd: Fd)`, without the `&`.

This also follows the emerging convention in std, as seen in the new
[`fchown`] function.

This means that users can now pass `BorrowedFd` values directly to
functions that expect `AsFd` arguments, without having to write an
extra `&` when passing them.

[`fchown`]: https://doc.rust-lang.org/nightly/std/os/unix/fs/fn.fchown.html
  • Loading branch information
sunfishcode committed Feb 16, 2022
1 parent f218812 commit 1ef0865
Show file tree
Hide file tree
Showing 24 changed files with 132 additions and 131 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ cc = { version = "1.0.68", optional = true }
[dependencies]
bitflags = "1.2.1"
itoa = { version = "1.0.1", default-features = false, optional = true }
io-lifetimes = { version = "0.5.1", default-features = false, optional = true }
io-lifetimes = { version = "0.5.2", default-features = false, optional = true }

# Special dependencies used in rustc-dep-of-std mode.
core = { version = "1.0.0", optional = true, package = "rustc-std-workspace-core" }
Expand Down
3 changes: 2 additions & 1 deletion examples/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ fn main() -> io::Result<()> {
}

#[cfg(not(windows))]
fn show<Fd: AsFd>(fd: &Fd) -> io::Result<()> {
fn show<Fd: AsFd>(fd: Fd) -> io::Result<()> {
let fd = fd.as_fd();
if isatty(fd) {
#[cfg(any(all(linux_raw, feature = "procfs"), libc))]
println!(" - ttyname: {}", ttyname(fd, Vec::new())?.to_string_lossy());
Expand Down
34 changes: 17 additions & 17 deletions src/fs/at.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use imp::fs::{Dev, FileType};
/// [Linux]: https://man7.org/linux/man-pages/man2/open.2.html
#[inline]
pub fn openat<P: path::Arg, Fd: AsFd>(
dirfd: &Fd,
dirfd: Fd,
path: P,
oflags: OFlags,
create_mode: Mode,
Expand All @@ -60,7 +60,7 @@ pub fn openat<P: path::Arg, Fd: AsFd>(
/// [Linux]: https://man7.org/linux/man-pages/man2/readlinkat.2.html
#[inline]
pub fn readlinkat<P: path::Arg, Fd: AsFd, B: Into<Vec<u8>>>(
dirfd: &Fd,
dirfd: Fd,
path: P,
reuse: B,
) -> io::Result<ZString> {
Expand Down Expand Up @@ -97,7 +97,7 @@ fn _readlinkat(dirfd: BorrowedFd<'_>, path: &ZStr, mut buffer: Vec<u8>) -> io::R
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdirat.html
/// [Linux]: https://man7.org/linux/man-pages/man2/mkdirat.2.html
#[inline]
pub fn mkdirat<P: path::Arg, Fd: AsFd>(dirfd: &Fd, path: P, mode: Mode) -> io::Result<()> {
pub fn mkdirat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, mode: Mode) -> io::Result<()> {
path.into_with_z_str(|path| imp::fs::syscalls::mkdirat(dirfd.as_fd(), path, mode))
}

Expand All @@ -112,9 +112,9 @@ pub fn mkdirat<P: path::Arg, Fd: AsFd>(dirfd: &Fd, path: P, mode: Mode) -> io::R
/// [Linux]: https://man7.org/linux/man-pages/man2/linkat.2.html
#[inline]
pub fn linkat<P: path::Arg, Q: path::Arg, PFd: AsFd, QFd: AsFd>(
old_dirfd: &PFd,
old_dirfd: PFd,
old_path: P,
new_dirfd: &QFd,
new_dirfd: QFd,
new_path: Q,
flags: AtFlags,
) -> io::Result<()> {
Expand Down Expand Up @@ -144,7 +144,7 @@ pub fn linkat<P: path::Arg, Q: path::Arg, PFd: AsFd, QFd: AsFd>(
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlinkat.html
/// [Linux]: https://man7.org/linux/man-pages/man2/unlinkat.2.html
#[inline]
pub fn unlinkat<P: path::Arg, Fd: AsFd>(dirfd: &Fd, path: P, flags: AtFlags) -> io::Result<()> {
pub fn unlinkat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, flags: AtFlags) -> io::Result<()> {
path.into_with_z_str(|path| imp::fs::syscalls::unlinkat(dirfd.as_fd(), path, flags))
}

Expand All @@ -159,9 +159,9 @@ pub fn unlinkat<P: path::Arg, Fd: AsFd>(dirfd: &Fd, path: P, flags: AtFlags) ->
/// [Linux]: https://man7.org/linux/man-pages/man2/renameat.2.html
#[inline]
pub fn renameat<P: path::Arg, Q: path::Arg, PFd: AsFd, QFd: AsFd>(
old_dirfd: &PFd,
old_dirfd: PFd,
old_path: P,
new_dirfd: &QFd,
new_dirfd: QFd,
new_path: Q,
) -> io::Result<()> {
old_path.into_with_z_str(|old_path| {
Expand All @@ -182,9 +182,9 @@ pub fn renameat<P: path::Arg, Q: path::Arg, PFd: AsFd, QFd: AsFd>(
#[inline]
#[doc(alias = "renameat2")]
pub fn renameat_with<P: path::Arg, Q: path::Arg, PFd: AsFd, QFd: AsFd>(
old_dirfd: &PFd,
old_dirfd: PFd,
old_path: P,
new_dirfd: &QFd,
new_dirfd: QFd,
new_path: Q,
flags: RenameFlags,
) -> io::Result<()> {
Expand Down Expand Up @@ -212,7 +212,7 @@ pub fn renameat_with<P: path::Arg, Q: path::Arg, PFd: AsFd, QFd: AsFd>(
#[inline]
pub fn symlinkat<P: path::Arg, Q: path::Arg, Fd: AsFd>(
old_path: P,
new_dirfd: &Fd,
new_dirfd: Fd,
new_path: Q,
) -> io::Result<()> {
old_path.into_with_z_str(|old_path| {
Expand All @@ -237,7 +237,7 @@ pub fn symlinkat<P: path::Arg, Q: path::Arg, Fd: AsFd>(
/// [`FileType::from_raw_mode`]: crate::fs::FileType::from_raw_mode
#[inline]
#[doc(alias = "fstatat")]
pub fn statat<P: path::Arg, Fd: AsFd>(dirfd: &Fd, path: P, flags: AtFlags) -> io::Result<Stat> {
pub fn statat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, flags: AtFlags) -> io::Result<Stat> {
path.into_with_z_str(|path| imp::fs::syscalls::statat(dirfd.as_fd(), path, flags))
}

Expand All @@ -254,7 +254,7 @@ pub fn statat<P: path::Arg, Fd: AsFd>(dirfd: &Fd, path: P, flags: AtFlags) -> io
#[inline]
#[doc(alias = "faccessat")]
pub fn accessat<P: path::Arg, Fd: AsFd>(
dirfd: &Fd,
dirfd: Fd,
path: P,
access: Access,
flags: AtFlags,
Expand All @@ -272,7 +272,7 @@ pub fn accessat<P: path::Arg, Fd: AsFd>(
/// [Linux]: https://man7.org/linux/man-pages/man2/utimensat.2.html
#[inline]
pub fn utimensat<P: path::Arg, Fd: AsFd>(
dirfd: &Fd,
dirfd: Fd,
path: P,
times: &Timestamps,
flags: AtFlags,
Expand All @@ -297,7 +297,7 @@ pub fn utimensat<P: path::Arg, Fd: AsFd>(
#[cfg(not(target_os = "wasi"))]
#[inline]
#[doc(alias = "fchmodat")]
pub fn chmodat<P: path::Arg, Fd: AsFd>(dirfd: &Fd, path: P, mode: Mode) -> io::Result<()> {
pub fn chmodat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, mode: Mode) -> io::Result<()> {
path.into_with_z_str(|path| imp::fs::syscalls::chmodat(dirfd.as_fd(), path, mode))
}

Expand Down Expand Up @@ -331,7 +331,7 @@ pub fn fclonefileat<Fd: AsFd, DstFd: AsFd, P: path::Arg>(
#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
#[inline]
pub fn mknodat<P: path::Arg, Fd: AsFd>(
dirfd: &Fd,
dirfd: Fd,
path: P,
file_type: FileType,
mode: Mode,
Expand All @@ -354,7 +354,7 @@ pub fn mknodat<P: path::Arg, Fd: AsFd>(
#[cfg(not(any(target_os = "wasi")))]
#[inline]
pub fn chownat<P: path::Arg, Fd: AsFd>(
dirfd: &Fd,
dirfd: Fd,
path: P,
owner: Uid,
group: Gid,
Expand Down
2 changes: 1 addition & 1 deletion src/fs/fadvise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ pub use imp::fs::Advice;
/// [Linux]: https://man7.org/linux/man-pages/man2/posix_fadvise.2.html
#[inline]
#[doc(alias = "posix_fadvise")]
pub fn fadvise<Fd: AsFd>(fd: &Fd, offset: u64, len: u64, advice: Advice) -> io::Result<()> {
pub fn fadvise<Fd: AsFd>(fd: Fd, offset: u64, len: u64, advice: Advice) -> io::Result<()> {
imp::fs::syscalls::fadvise(fd.as_fd(), offset, len, advice)
}
14 changes: 7 additions & 7 deletions src/fs/fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use imp::fs::{FdFlags, OFlags};
/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
#[inline]
#[doc(alias = "F_GETFD")]
pub fn fcntl_getfd<Fd: AsFd>(fd: &Fd) -> io::Result<FdFlags> {
pub fn fcntl_getfd<Fd: AsFd>(fd: Fd) -> io::Result<FdFlags> {
imp::fs::syscalls::fcntl_getfd(fd.as_fd())
}

Expand All @@ -32,7 +32,7 @@ pub fn fcntl_getfd<Fd: AsFd>(fd: &Fd) -> io::Result<FdFlags> {
/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
#[inline]
#[doc(alias = "F_SETFD")]
pub fn fcntl_setfd<Fd: AsFd>(fd: &Fd, flags: FdFlags) -> io::Result<()> {
pub fn fcntl_setfd<Fd: AsFd>(fd: Fd, flags: FdFlags) -> io::Result<()> {
imp::fs::syscalls::fcntl_setfd(fd.as_fd(), flags)
}

Expand All @@ -46,7 +46,7 @@ pub fn fcntl_setfd<Fd: AsFd>(fd: &Fd, flags: FdFlags) -> io::Result<()> {
/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
#[inline]
#[doc(alias = "F_GETFL")]
pub fn fcntl_getfl<Fd: AsFd>(fd: &Fd) -> io::Result<OFlags> {
pub fn fcntl_getfl<Fd: AsFd>(fd: Fd) -> io::Result<OFlags> {
imp::fs::syscalls::fcntl_getfl(fd.as_fd())
}

Expand All @@ -60,7 +60,7 @@ pub fn fcntl_getfl<Fd: AsFd>(fd: &Fd) -> io::Result<OFlags> {
/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
#[inline]
#[doc(alias = "F_SETFL")]
pub fn fcntl_setfl<Fd: AsFd>(fd: &Fd, flags: OFlags) -> io::Result<()> {
pub fn fcntl_setfl<Fd: AsFd>(fd: Fd, flags: OFlags) -> io::Result<()> {
imp::fs::syscalls::fcntl_setfl(fd.as_fd(), flags)
}

Expand All @@ -78,7 +78,7 @@ pub fn fcntl_setfl<Fd: AsFd>(fd: &Fd, flags: OFlags) -> io::Result<()> {
))]
#[inline]
#[doc(alias = "F_GET_SEALS")]
pub fn fcntl_get_seals<Fd: AsFd>(fd: &Fd) -> io::Result<SealFlags> {
pub fn fcntl_get_seals<Fd: AsFd>(fd: Fd) -> io::Result<SealFlags> {
imp::fs::syscalls::fcntl_get_seals(fd.as_fd())
}

Expand All @@ -104,7 +104,7 @@ pub use imp::fs::SealFlags;
))]
#[inline]
#[doc(alias = "F_ADD_SEALS")]
pub fn fcntl_add_seals<Fd: AsFd>(fd: &Fd, seals: SealFlags) -> io::Result<()> {
pub fn fcntl_add_seals<Fd: AsFd>(fd: Fd, seals: SealFlags) -> io::Result<()> {
imp::fs::syscalls::fcntl_add_seals(fd.as_fd(), seals)
}

Expand All @@ -126,6 +126,6 @@ pub fn fcntl_add_seals<Fd: AsFd>(fd: &Fd, seals: SealFlags) -> io::Result<()> {
#[cfg(not(target_os = "wasi"))]
#[inline]
#[doc(alias = "F_DUPFD_CLOEXEC")]
pub fn fcntl_dupfd_cloexec<Fd: AsFd>(fd: &Fd, min: RawFd) -> io::Result<OwnedFd> {
pub fn fcntl_dupfd_cloexec<Fd: AsFd>(fd: Fd, min: RawFd) -> io::Result<OwnedFd> {
imp::fs::syscalls::fcntl_dupfd_cloexec(fd.as_fd(), min)
}
4 changes: 2 additions & 2 deletions src/fs/fcntl_darwin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use imp::fd::AsFd;
///
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html
#[inline]
pub fn fcntl_rdadvise<Fd: AsFd>(fd: &Fd, offset: u64, len: u64) -> io::Result<()> {
pub fn fcntl_rdadvise<Fd: AsFd>(fd: Fd, offset: u64, len: u64) -> io::Result<()> {
imp::fs::syscalls::fcntl_rdadvise(fd.as_fd(), offset, len)
}

Expand All @@ -19,6 +19,6 @@ pub fn fcntl_rdadvise<Fd: AsFd>(fd: &Fd, offset: u64, len: u64) -> io::Result<()
///
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html
#[inline]
pub fn fcntl_fullfsync<Fd: AsFd>(fd: &Fd) -> io::Result<()> {
pub fn fcntl_fullfsync<Fd: AsFd>(fd: Fd) -> io::Result<()> {
imp::fs::syscalls::fcntl_fullfsync(fd.as_fd())
}
26 changes: 13 additions & 13 deletions src/fs/fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use imp::fs::{FlockOperation, Mode};
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html
/// [Linux]: https://man7.org/linux/man-pages/man2/lseek.2.html
#[inline]
pub fn seek<Fd: AsFd>(fd: &Fd, pos: SeekFrom) -> io::Result<u64> {
pub fn seek<Fd: AsFd>(fd: Fd, pos: SeekFrom) -> io::Result<u64> {
imp::fs::syscalls::seek(fd.as_fd(), pos)
}

Expand All @@ -52,7 +52,7 @@ pub fn seek<Fd: AsFd>(fd: &Fd, pos: SeekFrom) -> io::Result<u64> {
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html
/// [Linux]: https://man7.org/linux/man-pages/man2/lseek.2.html
#[inline]
pub fn tell<Fd: AsFd>(fd: &Fd) -> io::Result<u64> {
pub fn tell<Fd: AsFd>(fd: Fd) -> io::Result<u64> {
imp::fs::syscalls::tell(fd.as_fd())
}

Expand All @@ -69,7 +69,7 @@ pub fn tell<Fd: AsFd>(fd: &Fd) -> io::Result<u64> {
/// [Linux]: https://man7.org/linux/man-pages/man2/fchmod.2.html
#[cfg(not(target_os = "wasi"))]
#[inline]
pub fn fchmod<Fd: AsFd>(fd: &Fd, mode: Mode) -> io::Result<()> {
pub fn fchmod<Fd: AsFd>(fd: Fd, mode: Mode) -> io::Result<()> {
imp::fs::syscalls::fchmod(fd.as_fd(), mode)
}

Expand All @@ -83,7 +83,7 @@ pub fn fchmod<Fd: AsFd>(fd: &Fd, mode: Mode) -> io::Result<()> {
/// [Linux]: https://man7.org/linux/man-pages/man2/fchown.2.html
#[cfg(not(target_os = "wasi"))]
#[inline]
pub fn fchown<Fd: AsFd>(fd: &Fd, owner: Uid, group: Gid) -> io::Result<()> {
pub fn fchown<Fd: AsFd>(fd: Fd, owner: Uid, group: Gid) -> io::Result<()> {
imp::fs::syscalls::fchown(fd.as_fd(), owner, group)
}

Expand All @@ -101,7 +101,7 @@ pub fn fchown<Fd: AsFd>(fd: &Fd, owner: Uid, group: Gid) -> io::Result<()> {
/// [`Mode::from_raw_mode`]: crate::fs::Mode::from_raw_mode
/// [`FileType::from_raw_mode`]: crate::fs::FileType::from_raw_mode
#[inline]
pub fn fstat<Fd: AsFd>(fd: &Fd) -> io::Result<Stat> {
pub fn fstat<Fd: AsFd>(fd: Fd) -> io::Result<Stat> {
imp::fs::syscalls::fstat(fd.as_fd())
}

Expand All @@ -118,7 +118,7 @@ pub fn fstat<Fd: AsFd>(fd: &Fd) -> io::Result<Stat> {
target_os = "wasi"
)))] // not implemented in libc for netbsd yet
#[inline]
pub fn fstatfs<Fd: AsFd>(fd: &Fd) -> io::Result<StatFs> {
pub fn fstatfs<Fd: AsFd>(fd: Fd) -> io::Result<StatFs> {
imp::fs::syscalls::fstatfs(fd.as_fd())
}

Expand All @@ -131,7 +131,7 @@ pub fn fstatfs<Fd: AsFd>(fd: &Fd) -> io::Result<StatFs> {
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/futimens.html
/// [Linux]: https://man7.org/linux/man-pages/man2/utimensat.2.html
#[inline]
pub fn futimens<Fd: AsFd>(fd: &Fd, times: &Timestamps) -> io::Result<()> {
pub fn futimens<Fd: AsFd>(fd: Fd, times: &Timestamps) -> io::Result<()> {
imp::fs::syscalls::futimens(fd.as_fd(), times)
}

Expand Down Expand Up @@ -159,7 +159,7 @@ pub fn futimens<Fd: AsFd>(fd: &Fd, times: &Timestamps) -> io::Result<()> {
)))] // not implemented in libc for netbsd yet
#[inline]
#[doc(alias = "posix_fallocate")]
pub fn fallocate<Fd: AsFd>(fd: &Fd, mode: FallocateFlags, offset: u64, len: u64) -> io::Result<()> {
pub fn fallocate<Fd: AsFd>(fd: Fd, mode: FallocateFlags, offset: u64, len: u64) -> io::Result<()> {
imp::fs::syscalls::fallocate(fd.as_fd(), mode, offset, len)
}

Expand All @@ -170,7 +170,7 @@ pub fn fallocate<Fd: AsFd>(fd: &Fd, mode: FallocateFlags, offset: u64, len: u64)
/// example, it doesn't reflect whether sockets have been shut down; for
/// general I/O handle support, use [`io::is_read_write`].
#[inline]
pub fn is_file_read_write<Fd: AsFd>(fd: &Fd) -> io::Result<(bool, bool)> {
pub fn is_file_read_write<Fd: AsFd>(fd: Fd) -> io::Result<(bool, bool)> {
_is_file_read_write(fd.as_fd())
}

Expand Down Expand Up @@ -212,7 +212,7 @@ pub(crate) fn _is_file_read_write(fd: BorrowedFd<'_>) -> io::Result<(bool, bool)
/// [Linux]: https://man7.org/linux/man-pages/man2/fsync.2.html
/// [`fcntl_fullfsync`]: https://docs.rs/rustix/*/x86_64-apple-darwin/rustix/fs/fn.fcntl_fullfsync.html
#[inline]
pub fn fsync<Fd: AsFd>(fd: &Fd) -> io::Result<()> {
pub fn fsync<Fd: AsFd>(fd: Fd) -> io::Result<()> {
imp::fs::syscalls::fsync(fd.as_fd())
}

Expand All @@ -232,7 +232,7 @@ pub fn fsync<Fd: AsFd>(fd: &Fd) -> io::Result<()> {
target_os = "redox"
)))]
#[inline]
pub fn fdatasync<Fd: AsFd>(fd: &Fd) -> io::Result<()> {
pub fn fdatasync<Fd: AsFd>(fd: Fd) -> io::Result<()> {
imp::fs::syscalls::fdatasync(fd.as_fd())
}

Expand All @@ -245,7 +245,7 @@ pub fn fdatasync<Fd: AsFd>(fd: &Fd) -> io::Result<()> {
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html
/// [Linux]: https://man7.org/linux/man-pages/man2/ftruncate.2.html
#[inline]
pub fn ftruncate<Fd: AsFd>(fd: &Fd, length: u64) -> io::Result<()> {
pub fn ftruncate<Fd: AsFd>(fd: Fd, length: u64) -> io::Result<()> {
imp::fs::syscalls::ftruncate(fd.as_fd(), length)
}

Expand All @@ -257,6 +257,6 @@ pub fn ftruncate<Fd: AsFd>(fd: &Fd, length: u64) -> io::Result<()> {
/// [Linux]: https://man7.org/linux/man-pages/man2/flock.2.html
#[cfg(not(target_os = "wasi"))]
#[inline]
pub fn flock<Fd: AsFd>(fd: &Fd, operation: FlockOperation) -> io::Result<()> {
pub fn flock<Fd: AsFd>(fd: Fd, operation: FlockOperation) -> io::Result<()> {
imp::fs::syscalls::flock(fd.as_fd(), operation)
}
2 changes: 1 addition & 1 deletion src/fs/getpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ use imp::fd::AsFd;
///
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html
#[inline]
pub fn getpath<Fd: AsFd>(fd: &Fd) -> io::Result<ZString> {
pub fn getpath<Fd: AsFd>(fd: Fd) -> io::Result<ZString> {
imp::fs::syscalls::getpath(fd.as_fd())
}
2 changes: 1 addition & 1 deletion src/fs/openat2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use imp::fs::{Mode, OFlags, ResolveFlags};
/// [Linux]: https://man7.org/linux/man-pages/man2/openat2.2.html
#[inline]
pub fn openat2<Fd: AsFd, P: path::Arg>(
dirfd: &Fd,
dirfd: Fd,
path: P,
oflags: OFlags,
mode: Mode,
Expand Down
4 changes: 2 additions & 2 deletions src/fs/sendfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use imp::fd::AsFd;
#[cfg(any(linux_raw, all(libc, any(target_os = "android", target_os = "linux"))))]
#[inline]
pub fn sendfile<OutFd: AsFd, InFd: AsFd>(
out_fd: &OutFd,
in_fd: &InFd,
out_fd: OutFd,
in_fd: InFd,
offset: Option<&mut u64>,
count: usize,
) -> io::Result<usize> {
Expand Down
2 changes: 1 addition & 1 deletion src/fs/statx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub use imp::fs::StatxFlags;
/// [Linux]: https://man7.org/linux/man-pages/man2/statx.2.html
#[inline]
pub fn statx<P: path::Arg, Fd: AsFd>(
dirfd: &Fd,
dirfd: Fd,
path: P,
flags: AtFlags,
mask: StatxFlags,
Expand Down
Loading

0 comments on commit 1ef0865

Please sign in to comment.