summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorequal-l2 <eng.equall2@gmail.com>2017-07-05 15:54:02 +0900
committerequal-l2 <eng.equall2@gmail.com>2017-07-05 17:45:12 +0900
commit73fff2189e609900d5af7ab0fcbd643acf583f69 (patch)
tree7f399f3fd920349fbe242d174c27a1e8deb29001 /src
parentdbeda43012030e515ac757a8eedfc58c36263e1b (diff)
downloadnix-73fff2189e609900d5af7ab0fcbd643acf583f69.zip
Unify BSD consts
Diffstat (limited to 'src')
-rw-r--r--src/fcntl.rs161
1 files changed, 16 insertions, 145 deletions
diff --git a/src/fcntl.rs b/src/fcntl.rs
index 6e55cd5a..474c9780 100644
--- a/src/fcntl.rs
+++ b/src/fcntl.rs
@@ -255,111 +255,7 @@ mod consts {
}
-#[cfg(any(target_os = "macos", target_os = "ios"))]
-mod consts {
- use libc::{self, c_int};
-
- libc_bitflags!(
- pub flags OFlag: c_int {
- O_ACCMODE,
- O_RDONLY,
- O_WRONLY,
- O_RDWR,
- O_CREAT,
- O_EXCL,
- O_NOCTTY,
- O_TRUNC,
- O_APPEND,
- O_NONBLOCK,
- O_DSYNC,
- O_DIRECTORY,
- O_NOFOLLOW,
- O_CLOEXEC,
- O_SYNC,
- O_NDELAY,
- O_FSYNC,
- }
- );
-
- libc_bitflags!(
- pub flags FdFlag: c_int {
- FD_CLOEXEC
- }
- );
-}
-
-#[cfg(target_os = "freebsd")]
-mod consts {
- use libc::{self, c_int};
-
- libc_bitflags!(
- pub flags OFlag: c_int {
- O_ACCMODE,
- O_RDONLY,
- O_WRONLY,
- O_RDWR,
- O_CREAT,
- O_EXCL,
- O_NOCTTY,
- O_TRUNC,
- O_APPEND,
- O_NONBLOCK,
- O_DIRECTORY,
- O_NOFOLLOW,
- O_CLOEXEC,
- O_SYNC,
- O_NDELAY,
- O_FSYNC,
- O_SHLOCK,
- O_EXLOCK,
- O_DIRECT,
- O_EXEC,
- O_TTY_INIT,
- }
- );
-
- libc_bitflags!(
- pub flags FdFlag: c_int {
- FD_CLOEXEC
- }
- );
-}
-
-#[cfg(target_os = "openbsd")]
-mod consts {
- use libc::{self, c_int};
-
- libc_bitflags!(
- pub flags OFlag: c_int {
- O_ACCMODE,
- O_RDONLY,
- O_WRONLY,
- O_RDWR,
- O_CREAT,
- O_EXCL,
- O_NOCTTY,
- O_TRUNC,
- O_APPEND,
- O_NONBLOCK,
- O_DIRECTORY,
- O_NOFOLLOW,
- O_CLOEXEC,
- O_SYNC,
- O_NDELAY,
- O_FSYNC,
- O_SHLOCK,
- O_EXLOCK,
- }
- );
-
- libc_bitflags!(
- pub flags FdFlag: c_int {
- FD_CLOEXEC
- }
- );
-}
-
-#[cfg(target_os = "netbsd")]
+#[cfg(any(target_os = "netbsd", target_os = "dragonfly", target_os = "openbsd", target_os = "freebsd", target_os = "macos", target_os = "ios"))]
mod consts {
use libc::{self,c_int};
@@ -380,51 +276,26 @@ mod consts {
O_TRUNC,
O_EXCL,
O_NOCTTY,
- O_DSYNC,
- O_RSYNC,
- O_ALT_IO,
- O_DIRECT,
- O_NOSIGPIPE,
O_DIRECTORY,
O_CLOEXEC,
- O_SEARCH,
O_FSYNC,
O_NDELAY,
- }
- );
-
- libc_bitflags!(
- pub flags FdFlag: c_int {
- FD_CLOEXEC
- }
- );
-}
-
-#[cfg(target_os = "dragonfly")]
-mod consts {
- use libc::c_int;
-
- libc_bitflags!(
- pub flags OFlag: c_int {
- O_ACCMODE,
- O_RDONLY,
- O_WRONLY,
- O_RDWR,
- O_CREAT,
- O_EXCL,
- O_NOCTTY,
- O_TRUNC,
- O_APPEND,
- O_NONBLOCK,
- O_DIRECTORY,
- O_NOFOLLOW,
- O_CLOEXEC,
- O_SYNC,
- O_NDELAY,
- O_FSYNC,
- O_SHLOCK,
- O_EXLOCK,
+ #[cfg(any(target_os = "netbsd", target_os = "openbsd", target_os = "macos", target_os = "ios"))]
+ O_DSYNC,
+ #[cfg(any(target_os = "netbsd", target_os = "dragonfly", target_os = "freebsd"))]
O_DIRECT,
+ #[cfg(any(target_os = "netbsd", target_os = "openbsd"))]
+ O_RSYNC,
+ #[cfg(target_os = "freebsd")]
+ O_EXEC,
+ #[cfg(target_os = "freebsd")]
+ O_TTY_INIT,
+ #[cfg(target_os = "netbsd")]
+ O_ALT_IO,
+ #[cfg(target_os = "netbsd")]
+ O_NOSIGPIPE,
+ #[cfg(target_os = "netbsd")]
+ O_SEARCH,
}
);