From e7acaff07f39ece39eae38a45c82810bfbbf58cd Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Wed, 15 May 2024 19:00:47 -0600 Subject: [PATCH] Enable O_DSYNC on FreeBSD with fcntl and aio_fsync (#2404) It first appeared in FreeBSD 13.0. --- changelog/2404.added.md | 1 + src/fcntl.rs | 2 +- src/sys/aio.rs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelog/2404.added.md diff --git a/changelog/2404.added.md b/changelog/2404.added.md new file mode 100644 index 0000000000..7f50f5bb01 --- /dev/null +++ b/changelog/2404.added.md @@ -0,0 +1 @@ +`O_DSYNC` may now be used with `aio_fsync` and `fcntl` on FreeBSD. diff --git a/src/fcntl.rs b/src/fcntl.rs index 043cdde473..fd8d4b847c 100644 --- a/src/fcntl.rs +++ b/src/fcntl.rs @@ -114,7 +114,7 @@ libc_bitflags!( /// If the specified path isn't a directory, fail. O_DIRECTORY; /// Implicitly follow each `write()` with an `fdatasync()`. - #[cfg(any(linux_android, apple_targets, netbsdlike))] + #[cfg(any(linux_android, apple_targets, target_os = "freebsd", netbsdlike))] O_DSYNC; /// Error out if a file was not created. O_EXCL; diff --git a/src/sys/aio.rs b/src/sys/aio.rs index 8d9e6c8061..c7ba40534c 100644 --- a/src/sys/aio.rs +++ b/src/sys/aio.rs @@ -55,6 +55,7 @@ libc_enum! { /// on supported operating systems only, do it like `fdatasync` #[cfg(any(apple_targets, target_os = "linux", + target_os = "freebsd", netbsdlike))] O_DSYNC }