diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2017-12-03 03:52:43 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2017-12-03 03:52:43 +0000 |
commit | 86ebf7b0eac4cd0d092b816060042c55ca8871c5 (patch) | |
tree | 3e4e6714d843edc493dfc3cf879d659bbd264e65 /src/sys/socket/mod.rs | |
parent | d374a1ecd3f69027a2ce28e87806f459ef3f9105 (diff) | |
parent | e1baab9dc132f18e13f446df0271a5e46723848d (diff) | |
download | nix-86ebf7b0eac4cd0d092b816060042c55ca8871c5.zip |
Merge #801
801: Upgrade to Bitflags 1.0 r=asomers a=Susurrus
The libc_bitflags! macro was replaced with a non-recursive one supporting
only public structs. I could not figure out how to make the old macro work
with the upgrade, so I reworked part of the bitflags! macro directly to suit
our needs, much as the original recursive macro was made. There are no uses
of this macro for non-public structs, so this is not a problem for internal code.
Closes #766.
Diffstat (limited to 'src/sys/socket/mod.rs')
-rw-r--r-- | src/sys/socket/mod.rs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index e333f005..cdb8b4b3 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -571,16 +571,16 @@ pub fn socket<T: Into<Option<SockProtocol>>>(domain: AddressFamily, ty: SockType target_os = "netbsd", target_os = "openbsd"))] { - use fcntl::{fcntl, FD_CLOEXEC, O_NONBLOCK}; + use fcntl::{fcntl, FdFlag, OFlag}; use fcntl::FcntlArg::{F_SETFD, F_SETFL}; if !feat_atomic { - if flags.contains(SOCK_CLOEXEC) { - try!(fcntl(res, F_SETFD(FD_CLOEXEC))); + if flags.contains(SockFlag::SOCK_CLOEXEC) { + try!(fcntl(res, F_SETFD(FdFlag::FD_CLOEXEC))); } - if flags.contains(SOCK_NONBLOCK) { - try!(fcntl(res, F_SETFL(O_NONBLOCK))); + if flags.contains(SockFlag::SOCK_NONBLOCK) { + try!(fcntl(res, F_SETFL(OFlag::O_NONBLOCK))); } } } @@ -616,18 +616,18 @@ pub fn socketpair<T: Into<Option<SockProtocol>>>(domain: AddressFamily, ty: Sock target_os = "netbsd", target_os = "openbsd"))] { - use fcntl::{fcntl, FD_CLOEXEC, O_NONBLOCK}; + use fcntl::{fcntl, FdFlag, OFlag}; use fcntl::FcntlArg::{F_SETFD, F_SETFL}; if !feat_atomic { - if flags.contains(SOCK_CLOEXEC) { - try!(fcntl(fds[0], F_SETFD(FD_CLOEXEC))); - try!(fcntl(fds[1], F_SETFD(FD_CLOEXEC))); + if flags.contains(SockFlag::SOCK_CLOEXEC) { + try!(fcntl(fds[0], F_SETFD(FdFlag::FD_CLOEXEC))); + try!(fcntl(fds[1], F_SETFD(FdFlag::FD_CLOEXEC))); } - if flags.contains(SOCK_NONBLOCK) { - try!(fcntl(fds[0], F_SETFL(O_NONBLOCK))); - try!(fcntl(fds[1], F_SETFL(O_NONBLOCK))); + if flags.contains(SockFlag::SOCK_NONBLOCK) { + try!(fcntl(fds[0], F_SETFL(OFlag::O_NONBLOCK))); + try!(fcntl(fds[1], F_SETFL(OFlag::O_NONBLOCK))); } } } @@ -698,15 +698,15 @@ fn accept4_polyfill(sockfd: RawFd, flags: SockFlag) -> Result<RawFd> { target_os = "netbsd", target_os = "openbsd"))] { - use fcntl::{fcntl, FD_CLOEXEC, O_NONBLOCK}; + use fcntl::{fcntl, FdFlag, OFlag}; use fcntl::FcntlArg::{F_SETFD, F_SETFL}; - if flags.contains(SOCK_CLOEXEC) { - try!(fcntl(res, F_SETFD(FD_CLOEXEC))); + if flags.contains(SockFlag::SOCK_CLOEXEC) { + try!(fcntl(res, F_SETFD(FdFlag::FD_CLOEXEC))); } - if flags.contains(SOCK_NONBLOCK) { - try!(fcntl(res, F_SETFL(O_NONBLOCK))); + if flags.contains(SockFlag::SOCK_NONBLOCK) { + try!(fcntl(res, F_SETFL(OFlag::O_NONBLOCK))); } } |