Repository: bytecodealliance/rustix (language: rust)

Issue:
rustix::fs::OFlags::Async is missing
`linux-raw-sys` defines `FASYNC` instead of `O_ASYNC` [`linux-raw-sys/.../general.rs`](https://docs.rs/linux-raw-sys/0.6.5/src/linux_raw_sys/x86_64/general.rs.html#1061)

> The Linux header file `<asm/fcntl.h>` doesn't define `O_ASYNC`; the (BSD-derived) `FASYNC` synonym is defined instead.
([`man 2 open`](https://man.archlinux.org/man/open.2#NOTES))

Note that `O_ASYNC` can't be used for `open(2)`, so this should probably be noted if `Async` is ever added to `OFlags`


Discussion / hints:

Fix patch:
diff --git a/src/backend/libc/fs/types.rs b/src/backend/libc/fs/types.rs
index c92250475..f134d409b 100644
--- a/src/backend/libc/fs/types.rs
+++ b/src/backend/libc/fs/types.rs
@@ -338,6 +338,20 @@ bitflags! {
         #[cfg(any(linux_kernel, solarish))]
         const LARGEFILE = bitcast!(c::O_LARGEFILE);
 
+        /// `O_ASYNC`, `FASYNC`
+        ///
+        /// Note that this flag can't be used with [`rustix::fs::open`] family of functions, use
+        /// [`rustix::fs::fcntl_setfl`] instead
+        #[cfg(not(any(
+            target_os = "aix",
+            target_os = "espidf",
+            target_os = "haiku",
+            target_os = "wasi",
+            target_os = "vita",
+            solarish
+        )))]
+        const ASYNC = bitcast!(c::O_ASYNC);
+
         /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
         const _ = !0;
     }
diff --git a/src/backend/linux_raw/fs/types.rs b/src/backend/linux_raw/fs/types.rs
index 629ca4a22..1f20ac6a3 100644
--- a/src/backend/linux_raw/fs/types.rs
+++ b/src/backend/linux_raw/fs/types.rs
@@ -257,6 +257,12 @@ bitflags! {
         /// It will may be reported in return of `fcntl_getfl`, though.
         const LARGEFILE = linux_raw_sys::general::O_LARGEFILE;
 
+        /// `O_ASYNC`, `FASYNC`
+        ///
+        /// Note that this flag can't be used with [`rustix::fs::open`] family of functions, use
+        /// [`rustix::fs::fcntl_setfl`] instead
+        const ASYNC = linux_raw_sys::general::FASYNC;
+
         /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
         const _ = !0;
     }


Test patch: