From eabdced459c0108613db8363d3ed76e9fd966565 Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Wed, 9 Aug 2017 09:32:56 -0700 Subject: Match libc_bitflags! syntax to upstream bitflags! --- src/sys/epoll.rs | 36 +++++----- src/sys/event.rs | 118 ++++++++++++++++---------------- src/sys/eventfd.rs | 8 +-- src/sys/mman.rs | 72 ++++++++++---------- src/sys/quota.rs | 22 +++--- src/sys/signal.rs | 48 ++++++------- src/sys/signalfd.rs | 6 +- src/sys/socket/mod.rs | 28 ++++---- src/sys/stat.rs | 18 ++--- src/sys/termios.rs | 184 +++++++++++++++++++++++++------------------------- src/sys/wait.rs | 24 +++---- 11 files changed, 282 insertions(+), 282 deletions(-) (limited to 'src/sys') diff --git a/src/sys/epoll.rs b/src/sys/epoll.rs index df48b9af..2618b70a 100644 --- a/src/sys/epoll.rs +++ b/src/sys/epoll.rs @@ -6,24 +6,24 @@ use std::mem; use ::Error; libc_bitflags!( - pub flags EpollFlags: libc::c_int { - EPOLLIN, - EPOLLPRI, - EPOLLOUT, - EPOLLRDNORM, - EPOLLRDBAND, - EPOLLWRNORM, - EPOLLWRBAND, - EPOLLMSG, - EPOLLERR, - EPOLLHUP, - EPOLLRDHUP, + pub struct EpollFlags: libc::c_int { + EPOLLIN; + EPOLLPRI; + EPOLLOUT; + EPOLLRDNORM; + EPOLLRDBAND; + EPOLLWRNORM; + EPOLLWRBAND; + EPOLLMSG; + EPOLLERR; + EPOLLHUP; + EPOLLRDHUP; #[cfg(target_os = "linux")] // Added in 4.5; not in Android. - EPOLLEXCLUSIVE, + EPOLLEXCLUSIVE; #[cfg(not(target_arch = "mips"))] - EPOLLWAKEUP, - EPOLLONESHOT, - EPOLLET, + EPOLLWAKEUP; + EPOLLONESHOT; + EPOLLET; } ); @@ -36,8 +36,8 @@ pub enum EpollOp { } libc_bitflags!{ - pub flags EpollCreateFlags: c_int { - EPOLL_CLOEXEC, + pub struct EpollCreateFlags: c_int { + EPOLL_CLOEXEC; } } diff --git a/src/sys/event.rs b/src/sys/event.rs index 9215c654..1f9c1251 100644 --- a/src/sys/event.rs +++ b/src/sys/event.rs @@ -84,11 +84,11 @@ pub type type_of_event_flag = u16; #[cfg(any(target_os = "netbsd"))] pub type type_of_event_flag = u32; libc_bitflags!{ - pub flags EventFlag: type_of_event_flag { - EV_ADD, - EV_CLEAR, - EV_DELETE, - EV_DISABLE, + pub struct EventFlag: type_of_event_flag { + EV_ADD; + EV_CLEAR; + EV_DELETE; + EV_DISABLE; // No released version of OpenBSD supports EV_DISPATCH or EV_RECEIPT. // These have been commited to the -current branch though and are // expected to be part of the OpenBSD 6.2 release in Nov 2017. @@ -97,117 +97,117 @@ libc_bitflags!{ #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", target_os = "netbsd"))] - EV_DISPATCH, + EV_DISPATCH; #[cfg(target_os = "freebsd")] - EV_DROP, - EV_ENABLE, - EV_EOF, - EV_ERROR, + EV_DROP; + EV_ENABLE; + EV_EOF; + EV_ERROR; #[cfg(any(target_os = "macos", target_os = "ios"))] - EV_FLAG0, - EV_FLAG1, + EV_FLAG0; + EV_FLAG1; #[cfg(target_os = "dragonfly")] - EV_NODATA, - EV_ONESHOT, + EV_NODATA; + EV_ONESHOT; #[cfg(any(target_os = "macos", target_os = "ios"))] - EV_OOBAND, + EV_OOBAND; #[cfg(any(target_os = "macos", target_os = "ios"))] - EV_POLL, + EV_POLL; #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", target_os = "netbsd"))] - EV_RECEIPT, - EV_SYSFLAGS, + EV_RECEIPT; + EV_SYSFLAGS; } } libc_bitflags!( - pub flags FilterFlag: u32 { + pub struct FilterFlag: u32 { #[cfg(any(target_os = "macos", target_os = "ios"))] - NOTE_ABSOLUTE, - NOTE_ATTRIB, - NOTE_CHILD, - NOTE_DELETE, + NOTE_ABSOLUTE; + NOTE_ATTRIB; + NOTE_CHILD; + NOTE_DELETE; #[cfg(target_os = "openbsd")] - NOTE_EOF, - NOTE_EXEC, - NOTE_EXIT, + NOTE_EOF; + NOTE_EXEC; + NOTE_EXIT; #[cfg(any(target_os = "macos", target_os = "ios"))] - NOTE_EXIT_REPARENTED, + NOTE_EXIT_REPARENTED; #[cfg(any(target_os = "macos", target_os = "ios"))] - NOTE_EXITSTATUS, - NOTE_EXTEND, + NOTE_EXITSTATUS; + NOTE_EXTEND; #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "dragonfly"))] - NOTE_FFAND, + NOTE_FFAND; #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "dragonfly"))] - NOTE_FFCOPY, + NOTE_FFCOPY; #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "dragonfly"))] - NOTE_FFCTRLMASK, + NOTE_FFCTRLMASK; #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "dragonfly"))] - NOTE_FFLAGSMASK, + NOTE_FFLAGSMASK; #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "dragonfly"))] - NOTE_FFNOP, + NOTE_FFNOP; #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "dragonfly"))] - NOTE_FFOR, - NOTE_FORK, - NOTE_LINK, - NOTE_LOWAT, + NOTE_FFOR; + NOTE_FORK; + NOTE_LINK; + NOTE_LOWAT; #[cfg(target_os = "freebsd")] - NOTE_MSECONDS, + NOTE_MSECONDS; #[cfg(any(target_os = "macos", target_os = "ios"))] - NOTE_NONE, + NOTE_NONE; #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))] - NOTE_NSECONDS, + NOTE_NSECONDS; #[cfg(target_os = "dragonfly")] - NOTE_OOB, - NOTE_PCTRLMASK, - NOTE_PDATAMASK, + NOTE_OOB; + NOTE_PCTRLMASK; + NOTE_PDATAMASK; #[cfg(any(target_os = "macos", target_os = "ios"))] - NOTE_REAP, - NOTE_RENAME, - NOTE_REVOKE, + NOTE_REAP; + NOTE_RENAME; + NOTE_REVOKE; #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))] - NOTE_SECONDS, + NOTE_SECONDS; #[cfg(any(target_os = "macos", target_os = "ios"))] - NOTE_SIGNAL, - NOTE_TRACK, - NOTE_TRACKERR, + NOTE_SIGNAL; + NOTE_TRACK; + NOTE_TRACKERR; #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "dragonfly"))] - NOTE_TRIGGER, + NOTE_TRIGGER; #[cfg(target_os = "openbsd")] - NOTE_TRUNCATE, + NOTE_TRUNCATE; #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))] - NOTE_USECONDS, + NOTE_USECONDS; #[cfg(any(target_os = "macos", target_os = "ios"))] - NOTE_VM_ERROR, + NOTE_VM_ERROR; #[cfg(any(target_os = "macos", target_os = "ios"))] - NOTE_VM_PRESSURE, + NOTE_VM_PRESSURE; #[cfg(any(target_os = "macos", target_os = "ios"))] - NOTE_VM_PRESSURE_SUDDEN_TERMINATE, + NOTE_VM_PRESSURE_SUDDEN_TERMINATE; #[cfg(any(target_os = "macos", target_os = "ios"))] - NOTE_VM_PRESSURE_TERMINATE, - NOTE_WRITE, + NOTE_VM_PRESSURE_TERMINATE; + NOTE_WRITE; } ); diff --git a/src/sys/eventfd.rs b/src/sys/eventfd.rs index ad23dec7..51091478 100644 --- a/src/sys/eventfd.rs +++ b/src/sys/eventfd.rs @@ -3,10 +3,10 @@ use std::os::unix::io::RawFd; use {Errno, Result}; libc_bitflags! { - pub flags EfdFlags: libc::c_int { - EFD_CLOEXEC, // Since Linux 2.6.27 - EFD_NONBLOCK, // Since Linux 2.6.27 - EFD_SEMAPHORE, // Since Linux 2.6.30 + pub struct EfdFlags: libc::c_int { + EFD_CLOEXEC; // Since Linux 2.6.27 + EFD_NONBLOCK; // Since Linux 2.6.27 + EFD_SEMAPHORE; // Since Linux 2.6.30 } } diff --git a/src/sys/mman.rs b/src/sys/mman.rs index e1ddc38f..dc21899b 100644 --- a/src/sys/mman.rs +++ b/src/sys/mman.rs @@ -6,94 +6,94 @@ use std::os::unix::io::RawFd; libc_bitflags!{ /// Desired memory protection of a memory mapping. - pub flags ProtFlags: libc::c_int { + pub struct ProtFlags: libc::c_int { /// Pages cannot be accessed. - PROT_NONE, + PROT_NONE; /// Pages can be read. - PROT_READ, + PROT_READ; /// Pages can be written. - PROT_WRITE, + PROT_WRITE; /// Pages can be executed - PROT_EXEC, + PROT_EXEC; /// Apply protection up to the end of a mapping that grows upwards. #[cfg(any(target_os = "android", target_os = "linux"))] - PROT_GROWSDOWN, + PROT_GROWSDOWN; /// Apply protection down to the beginning of a mapping that grows downwards. #[cfg(any(target_os = "android", target_os = "linux"))] - PROT_GROWSUP, + PROT_GROWSUP; } } libc_bitflags!{ /// Additional parameters for `mmap()`. - pub flags MapFlags: c_int { + pub struct MapFlags: c_int { /// Compatibility flag. Ignored. - MAP_FILE, + MAP_FILE; /// Share this mapping. Mutually exclusive with `MAP_PRIVATE`. - MAP_SHARED, + MAP_SHARED; /// Create a private copy-on-write mapping. Mutually exclusive with `MAP_SHARED`. - MAP_PRIVATE, + MAP_PRIVATE; /// Place the mapping at exactly the address specified in `addr`. - MAP_FIXED, + MAP_FIXED; /// Synonym for `MAP_ANONYMOUS`. - MAP_ANON, + MAP_ANON; /// The mapping is not backed by any file. #[cfg(any(target_os = "android", target_os = "linux", target_os = "freebsd"))] - MAP_ANONYMOUS, + MAP_ANONYMOUS; /// Put the mapping into the first 2GB of the process address space. #[cfg(any(all(any(target_os = "android", target_os = "linux"), any(target_arch = "x86", target_arch = "x86_64")), all(target_os = "linux", target_env = "musl", any(target_arch = "x86", target_pointer_width = "64")), all(target_os = "freebsd", target_pointer_width = "64")))] - MAP_32BIT, + MAP_32BIT; /// Used for stacks; indicates to the kernel that the mapping should extend downward in memory. #[cfg(any(target_os = "android", target_os = "linux"))] - MAP_GROWSDOWN, + MAP_GROWSDOWN; /// Compatibility flag. Ignored. #[cfg(any(target_os = "android", target_os = "linux"))] - MAP_DENYWRITE, + MAP_DENYWRITE; /// Compatibility flag. Ignored. #[cfg(any(target_os = "android", target_os = "linux"))] - MAP_EXECUTABLE, + MAP_EXECUTABLE; /// Mark the mmaped region to be locked in the same way as `mlock(2)`. #[cfg(any(target_os = "android", target_os = "linux"))] - MAP_LOCKED, + MAP_LOCKED; /// Do not reserve swap space for this mapping. /// /// This was removed in FreeBSD 11. #[cfg(not(target_os = "freebsd"))] - MAP_NORESERVE, + MAP_NORESERVE; /// Populate page tables for a mapping. #[cfg(any(target_os = "android", target_os = "linux"))] - MAP_POPULATE, + MAP_POPULATE; /// Only meaningful when used with `MAP_POPULATE`. Don't perform read-ahead. #[cfg(any(target_os = "android", target_os = "linux"))] - MAP_NONBLOCK, + MAP_NONBLOCK; /// Allocate the mapping using "huge pages." #[cfg(any(target_os = "android", target_os = "linux"))] - MAP_HUGETLB, + MAP_HUGETLB; /// Lock the mapped region into memory as with `mlock(2)`. #[cfg(target_os = "netbsd")] - MAP_WIRED, + MAP_WIRED; /// Causes dirtied data in the specified range to be flushed to disk only when necessary. #[cfg(any(target_os = "dragonfly", target_os = "freebsd"))] - MAP_NOSYNC, + MAP_NOSYNC; /// Rename private pages to a file. /// /// This was removed in FreeBSD 11. #[cfg(any(target_os = "dragonfly", target_os = "netbsd", target_os = "openbsd"))] - MAP_RENAME, + MAP_RENAME; /// Region may contain semaphores. #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))] - MAP_HASSEMAPHORE, + MAP_HASSEMAPHORE; /// Region grows down, like a stack. #[cfg(any(target_os = "android", target_os = "dragonfly", target_os = "freebsd", target_os = "linux"))] - MAP_STACK, + MAP_STACK; /// Pages in this mapping are not retained in the kernel's memory cache. #[cfg(any(target_os = "ios", target_os = "macos"))] - MAP_NOCACHE, + MAP_NOCACHE; #[cfg(any(target_os = "ios", target_os = "macos"))] - MAP_JIT, + MAP_JIT; } } @@ -185,19 +185,19 @@ libc_enum!{ libc_bitflags!{ /// Configuration flags for `msync`. - pub flags MsFlags: c_int { + pub struct MsFlags: c_int { /// Schedule an update but return immediately. - MS_ASYNC, + MS_ASYNC; /// Invalidate all cached data. - MS_INVALIDATE, + MS_INVALIDATE; /// Invalidate pages, but leave them mapped. #[cfg(any(target_os = "ios", target_os = "macos"))] - MS_KILLPAGES, + MS_KILLPAGES; /// Deactivate pages, but leave them mapped. #[cfg(any(target_os = "ios", target_os = "macos"))] - MS_DEACTIVATE, + MS_DEACTIVATE; /// Perform an update and wait for it to complete. - MS_SYNC, + MS_SYNC; } } diff --git a/src/sys/quota.rs b/src/sys/quota.rs index b66d558d..5990aae5 100644 --- a/src/sys/quota.rs +++ b/src/sys/quota.rs @@ -41,17 +41,17 @@ pub mod quota { libc_bitflags!( #[derive(Default)] - pub flags QuotaValidFlags: u32 { - QIF_BLIMITS, - QIF_SPACE, - QIF_ILIMITS, - QIF_INODES, - QIF_BTIME, - QIF_ITIME, - QIF_LIMITS, - QIF_USAGE, - QIF_TIMES, - QIF_ALL, + pub struct QuotaValidFlags: u32 { + QIF_BLIMITS; + QIF_SPACE; + QIF_ILIMITS; + QIF_INODES; + QIF_BTIME; + QIF_ITIME; + QIF_LIMITS; + QIF_USAGE; + QIF_TIMES; + QIF_ALL; } ); diff --git a/src/sys/signal.rs b/src/sys/signal.rs index d7e9d91d..d0978085 100644 --- a/src/sys/signal.rs +++ b/src/sys/signal.rs @@ -201,14 +201,14 @@ pub const SIGUNUSED : Signal = SIGSYS; #[cfg(not(target_os = "android"))] libc_bitflags!{ - pub flags SaFlags: libc::c_int { - SA_NOCLDSTOP, - SA_NOCLDWAIT, - SA_NODEFER, - SA_ONSTACK, - SA_RESETHAND, - SA_RESTART, - SA_SIGINFO, + pub struct SaFlags: libc::c_int { + SA_NOCLDSTOP; + SA_NOCLDWAIT; + SA_NODEFER; + SA_ONSTACK; + SA_RESETHAND; + SA_RESTART; + SA_SIGINFO; } } @@ -217,27 +217,27 @@ libc_bitflags!{ // FIXME: https://github.com/rust-lang/libc/pull/511 #[cfg(all(target_os = "android", target_pointer_width = "32"))] libc_bitflags!{ - pub flags SaFlags: libc::c_ulong { - SA_NOCLDSTOP as libc::c_ulong, - SA_NOCLDWAIT as libc::c_ulong, - SA_NODEFER as libc::c_ulong, - SA_ONSTACK as libc::c_ulong, - SA_RESETHAND as libc::c_ulong, - SA_RESTART as libc::c_ulong, - SA_SIGINFO as libc::c_ulong, + pub struct SaFlags: libc::c_ulong { + SA_NOCLDSTOP as libc::c_ulong; + SA_NOCLDWAIT as libc::c_ulong; + SA_NODEFER as libc::c_ulong; + SA_ONSTACK as libc::c_ulong; + SA_RESETHAND as libc::c_ulong; + SA_RESTART as libc::c_ulong; + SA_SIGINFO as libc::c_ulong; } } #[cfg(all(target_os = "android", target_pointer_width = "64"))] libc_bitflags!{ - pub flags SaFlags: libc::c_uint { - SA_NOCLDSTOP as libc::c_uint, - SA_NOCLDWAIT as libc::c_uint, - SA_NODEFER as libc::c_uint, - SA_ONSTACK as libc::c_uint, - SA_RESETHAND as libc::c_uint, - SA_RESTART as libc::c_uint, - SA_SIGINFO as libc::c_uint, + pub struct SaFlags: libc::c_uint { + SA_NOCLDSTOP as libc::c_uint; + SA_NOCLDWAIT as libc::c_uint; + SA_NODEFER as libc::c_uint; + SA_ONSTACK as libc::c_uint; + SA_RESETHAND as libc::c_uint; + SA_RESTART as libc::c_uint; + SA_SIGINFO as libc::c_uint; } } diff --git a/src/sys/signalfd.rs b/src/sys/signalfd.rs index fcf2efa9..abc96b8c 100644 --- a/src/sys/signalfd.rs +++ b/src/sys/signalfd.rs @@ -26,9 +26,9 @@ use std::mem; libc_bitflags!{ - pub flags SfdFlags: libc::c_int { - SFD_NONBLOCK, - SFD_CLOEXEC, + pub struct SfdFlags: libc::c_int { + SFD_NONBLOCK; + SFD_CLOEXEC; } } diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index a136a0c4..f86a7de1 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -92,7 +92,7 @@ pub enum SockProtocol { libc_bitflags!{ /// Additional socket options - pub flags SockFlag: c_int { + pub struct SockFlag: c_int { /// Set non-blocking mode on the new socket #[cfg(any(target_os = "android", target_os = "dragonfly", @@ -100,7 +100,7 @@ libc_bitflags!{ target_os = "linux", target_os = "netbsd", target_os = "openbsd"))] - SOCK_NONBLOCK, + SOCK_NONBLOCK; /// Set close-on-exec on the new descriptor #[cfg(any(target_os = "android", target_os = "dragonfly", @@ -108,28 +108,28 @@ libc_bitflags!{ target_os = "linux", target_os = "netbsd", target_os = "openbsd"))] - SOCK_CLOEXEC, + SOCK_CLOEXEC; /// Return `EPIPE` instead of raising `SIGPIPE` #[cfg(target_os = "netbsd")] - SOCK_NOSIGPIPE, + SOCK_NOSIGPIPE; /// For domains `AF_INET(6)`, only allow `connect(2)`, `sendto(2)`, or `sendmsg(2)` /// to the DNS port (typically 53) #[cfg(target_os = "openbsd")] - SOCK_DNS, + SOCK_DNS; } } libc_bitflags!{ /// Flags for send/recv and their relatives - pub flags MsgFlags: libc::c_int { + pub struct MsgFlags: libc::c_int { /// Sends or requests out-of-band data on sockets that support this notion /// (e.g., of type [`Stream`](enum.SockType.html)); the underlying protocol must also /// support out-of-band data. - MSG_OOB, + MSG_OOB; /// Peeks at an incoming message. The data is treated as unread and the next /// [`recv()`](fn.recv.html) /// or similar function shall still return this data. - MSG_PEEK, + MSG_PEEK; /// Enables nonblocking operation; if the operation would block, /// `EAGAIN` or `EWOULDBLOCK` is returned. This provides similar /// behavior to setting the `O_NONBLOCK` flag @@ -140,9 +140,9 @@ libc_bitflags!{ /// which will affect all threads in /// the calling process and as well as other processes that hold /// file descriptors referring to the same open file description. - MSG_DONTWAIT, + MSG_DONTWAIT; /// Receive flags: Control Data was discarded (buffer too small) - MSG_CTRUNC, + MSG_CTRUNC; /// For raw ([`Packet`](addr/enum.AddressFamily.html)), Internet datagram /// (since Linux 2.4.27/2.6.8), /// netlink (since Linux 2.6.22) and UNIX datagram (since Linux 3.4) @@ -151,15 +151,15 @@ libc_bitflags!{ /// domain ([unix(7)](https://linux.die.net/man/7/unix)) sockets. /// /// For use with Internet stream sockets, see [tcp(7)](https://linux.die.net/man/7/tcp). - MSG_TRUNC, + MSG_TRUNC; /// Terminates a record (when this notion is supported, as for /// sockets of type [`SeqPacket`](enum.SockType.html)). - MSG_EOR, + MSG_EOR; /// This flag specifies that queued errors should be received from /// the socket error queue. (For more details, see /// [recvfrom(2)](https://linux.die.net/man/2/recvfrom)) #[cfg(any(target_os = "linux", target_os = "android"))] - MSG_ERRQUEUE, + MSG_ERRQUEUE; /// Set the `close-on-exec` flag for the file descriptor received via a UNIX domain /// file descriptor using the `SCM_RIGHTS` operation (described in /// [unix(7)](https://linux.die.net/man/7/unix)). @@ -168,7 +168,7 @@ libc_bitflags!{ /// /// Only used in [`recvmsg`](fn.recvmsg.html) function. #[cfg(any(target_os = "linux", target_os = "android"))] - MSG_CMSG_CLOEXEC, + MSG_CMSG_CLOEXEC; } } diff --git a/src/sys/stat.rs b/src/sys/stat.rs index b089d3b5..ee086323 100644 --- a/src/sys/stat.rs +++ b/src/sys/stat.rs @@ -8,15 +8,15 @@ use std::mem; use std::os::unix::io::RawFd; libc_bitflags!( - pub flags SFlag: mode_t { - S_IFIFO, - S_IFCHR, - S_IFDIR, - S_IFBLK, - S_IFREG, - S_IFLNK, - S_IFSOCK, - S_IFMT, + pub struct SFlag: mode_t { + S_IFIFO; + S_IFCHR; + S_IFDIR; + S_IFBLK; + S_IFREG; + S_IFLNK; + S_IFSOCK; + S_IFMT; } ); diff --git a/src/sys/termios.rs b/src/sys/termios.rs index 8651a84d..89f18ee1 100644 --- a/src/sys/termios.rs +++ b/src/sys/termios.rs @@ -456,163 +456,163 @@ pub use libc::_POSIX_VDISABLE; libc_bitflags! { /// Flags for configuring the input mode of a terminal - pub flags InputFlags: tcflag_t { - IGNBRK, - BRKINT, - IGNPAR, - PARMRK, - INPCK, - ISTRIP, - INLCR, - IGNCR, - ICRNL, - IXON, - IXOFF, - IXANY, - IMAXBEL, + pub struct InputFlags: tcflag_t { + IGNBRK; + BRKINT; + IGNPAR; + PARMRK; + INPCK; + ISTRIP; + INLCR; + IGNCR; + ICRNL; + IXON; + IXOFF; + IXANY; + IMAXBEL; #[cfg(any(target_os = "android", target_os = "linux", target_os = "macos"))] - IUTF8, + IUTF8; } } libc_bitflags! { /// Flags for configuring the output mode of a terminal - pub flags OutputFlags: tcflag_t { - OPOST, + pub struct OutputFlags: tcflag_t { + OPOST; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "linux", target_os = "openbsd"))] - OLCUC, - ONLCR, - OCRNL as tcflag_t, - ONOCR as tcflag_t, - ONLRET as tcflag_t, + OLCUC; + ONLCR; + OCRNL as tcflag_t; + ONOCR as tcflag_t; + ONLRET as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - OFILL as tcflag_t, + OFILL as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - OFDEL as tcflag_t, + OFDEL as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - NL0 as tcflag_t, + NL0 as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - NL1 as tcflag_t, + NL1 as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - CR0 as tcflag_t, + CR0 as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - CR1 as tcflag_t, + CR1 as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - CR2 as tcflag_t, + CR2 as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - CR3 as tcflag_t, + CR3 as tcflag_t; #[cfg(any(target_os = "android", target_os = "freebsd", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - TAB0 as tcflag_t, + TAB0 as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - TAB1 as tcflag_t, + TAB1 as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - TAB2 as tcflag_t, + TAB2 as tcflag_t; #[cfg(any(target_os = "android", target_os = "freebsd", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - TAB3 as tcflag_t, + TAB3 as tcflag_t; #[cfg(any(target_os = "android", target_os = "linux"))] - XTABS, + XTABS; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - BS0 as tcflag_t, + BS0 as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - BS1 as tcflag_t, + BS1 as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - VT0 as tcflag_t, + VT0 as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - VT1 as tcflag_t, + VT1 as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - FF0 as tcflag_t, + FF0 as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - FF1 as tcflag_t, + FF1 as tcflag_t; #[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd"))] - OXTABS, + OXTABS; #[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "macos", target_os = "netbsd", target_os = "openbsd"))] - ONOEOT as tcflag_t, + ONOEOT as tcflag_t; // Bitmasks for use with OutputFlags to select specific settings // These should be moved to be a mask once https://github.com/rust-lang-nursery/bitflags/issues/110 @@ -623,140 +623,140 @@ libc_bitflags! { target_os = "ios", target_os = "linux", target_os = "macos"))] - NLDLY as tcflag_t, // FIXME: Datatype needs to be corrected in libc for mac + NLDLY as tcflag_t; // FIXME: Datatype needs to be corrected in libc for mac #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - CRDLY as tcflag_t, + CRDLY as tcflag_t; #[cfg(any(target_os = "android", target_os = "freebsd", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - TABDLY as tcflag_t, + TABDLY as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - BSDLY as tcflag_t, + BSDLY as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - VTDLY as tcflag_t, + VTDLY as tcflag_t; #[cfg(any(target_os = "android", target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos"))] - FFDLY as tcflag_t, + FFDLY as tcflag_t; } } libc_bitflags! { /// Flags for setting the control mode of a terminal - pub flags ControlFlags: tcflag_t { + pub struct ControlFlags: tcflag_t { #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd"))] - CIGNORE, - CS5, - CS6, - CS7, - CS8, - CSTOPB, - CREAD, - PARENB, - PARODD, - HUPCL, - CLOCAL, - CRTSCTS, + CIGNORE; + CS5; + CS6; + CS7; + CS8; + CSTOPB; + CREAD; + PARENB; + PARODD; + HUPCL; + CLOCAL; + CRTSCTS; #[cfg(any(target_os = "android", target_os = "linux"))] - CBAUD, + CBAUD; #[cfg(any(target_os = "android", all(target_os = "linux", not(target_arch = "mips"))))] - CMSPAR, + CMSPAR; #[cfg(any(target_os = "android", all(target_os = "linux", not(any(target_arch = "powerpc", target_arch = "powerpc64")))))] - CIBAUD, + CIBAUD; #[cfg(any(target_os = "android", target_os = "linux"))] - CBAUDEX, + CBAUDEX; #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "macos", target_os = "netbsd", target_os = "openbsd"))] - MDMBUF, + MDMBUF; #[cfg(any(target_os = "netbsd", target_os = "openbsd"))] - CHWFLOW, + CHWFLOW; #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))] - CCTS_OFLOW, + CCTS_OFLOW; #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))] - CRTS_IFLOW, + CRTS_IFLOW; #[cfg(any(target_os = "dragonfly", target_os = "freebsd"))] - CDTR_IFLOW, + CDTR_IFLOW; #[cfg(any(target_os = "dragonfly", target_os = "freebsd"))] - CDSR_OFLOW, + CDSR_OFLOW; #[cfg(any(target_os = "dragonfly", target_os = "freebsd"))] - CCAR_OFLOW, + CCAR_OFLOW; // Bitmasks for use with ControlFlags to select specific settings // These should be moved to be a mask once https://github.com/rust-lang-nursery/bitflags/issues/110 // is resolved. - CSIZE, + CSIZE; } } libc_bitflags! { /// Flags for setting any local modes - pub flags LocalFlags: tcflag_t { - ECHOKE, - ECHOE, - ECHOK, - ECHO, - ECHONL, - ECHOPRT, - ECHOCTL, - ISIG, - ICANON, + pub struct LocalFlags: tcflag_t { + ECHOKE; + ECHOE; + ECHOK; + ECHO; + ECHONL; + ECHOPRT; + ECHOCTL; + ISIG; + ICANON; #[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd"))] - ALTWERASE, - IEXTEN, - EXTPROC, - TOSTOP, - FLUSHO, + ALTWERASE; + IEXTEN; + EXTPROC; + TOSTOP; + FLUSHO; #[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd"))] - NOKERNINFO, - PENDIN, - NOFLSH, + NOKERNINFO; + PENDIN; + NOFLSH; } } diff --git a/src/sys/wait.rs b/src/sys/wait.rs index b2ca3bd6..2ad530ce 100644 --- a/src/sys/wait.rs +++ b/src/sys/wait.rs @@ -15,24 +15,24 @@ mod ffi { #[cfg(not(any(target_os = "linux", target_os = "android")))] libc_bitflags!( - pub flags WaitPidFlag: c_int { - WNOHANG, - WUNTRACED, + pub struct WaitPidFlag: c_int { + WNOHANG; + WUNTRACED; } ); #[cfg(any(target_os = "linux", target_os = "android"))] libc_bitflags!( - pub flags WaitPidFlag: c_int { - WNOHANG, - WUNTRACED, - WEXITED, - WCONTINUED, - WNOWAIT, // Don't reap, just poll status. - __WNOTHREAD, // Don't wait on children of other threads in this group - __WALL, // Wait on all children, regardless of type - __WCLONE, + pub struct WaitPidFlag: c_int { + WNOHANG; + WUNTRACED; + WEXITED; + WCONTINUED; + WNOWAIT; // Don't reap, just poll status. + __WNOTHREAD; // Don't wait on children of other threads in this group + __WALL; // Wait on all children, regardless of type + __WCLONE; } ); -- cgit v1.2.3