Skip to content

Commit

Permalink
Merge #1581
Browse files Browse the repository at this point in the history
1581: Add fdatasync for missing platforms r=rtzoeller a=rtzoeller

These platforms stub out `fdatasync()` by just calling `fsync()`, but that is a conforming implementation.

DragonFly recently provided [an implementation](DragonFlyBSD/DragonFlyBSD@74fa256), but it has not made it into a release or rust-lang/libc.

Co-authored-by: Ryan Zoeller <rtzoeller@rtzoeller.com>
  • Loading branch information
bors[bot] and rtzoeller committed Dec 22, 2021
2 parents 78f2301 + 11494ec commit e2298bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -13,6 +13,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
(#[1611](https://github.com/nix-rust/nix/pull/1611))
- Added `EPOLLEXCLUSIVE` on Android.
(#[1567](https://github.com/nix-rust/nix/pull/1567))
- Added `fdatasync` for FreeBSD, Fuchsia, NetBSD, and OpenBSD.
(#[1581](https://github.com/nix-rust/nix/pull/1581))

### Changed
### Fixed
Expand Down
6 changes: 4 additions & 2 deletions src/unistd.rs
Expand Up @@ -1323,11 +1323,13 @@ pub fn fsync(fd: RawFd) -> Result<()> {
///
/// See also
/// [fdatasync(2)](https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html)
// `fdatasync(2) is in POSIX, but in libc it is only defined in `libc::notbsd`.
// TODO: exclude only Apple systems after https://github.com/rust-lang/libc/pull/211
#[cfg(any(target_os = "linux",
target_os = "android",
target_os = "emscripten",
target_os = "freebsd",
target_os = "fuchsia",
target_os = "netbsd",
target_os = "openbsd",
target_os = "illumos",
target_os = "solaris"))]
#[inline]
Expand Down

0 comments on commit e2298bb

Please sign in to comment.