diff --git a/.travis.yml b/.travis.yml
index f0e94c67c3..aa23815797 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -108,23 +108,6 @@ matrix:
rust: nightly
allow_failures:
- # iOS is still being worked on, so for now don't block on compilation failures
- - env: TARGET=aarch64-apple-ios DISABLE_TESTS=1
- rust: 1.13.0
- os: osx
- - env: TARGET=armv7-apple-ios DISABLE_TESTS=1
- rust: 1.13.0
- os: osx
- - env: TARGET=armv7s-apple-ios DISABLE_TESTS=1
- rust: 1.13.0
- os: osx
- - env: TARGET=i386-apple-ios DISABLE_TESTS=1
- rust: 1.13.0
- os: osx
- - env: TARGET=x86_64-apple-ios DISABLE_TESTS=1
- rust: 1.13.0
- os: osx
-
# Planning to add these targets, but they can fail for now
- env: TARGET=mips64-unknown-linux-gnuabi64
rust: 1.13.0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4ceae9c275..b2f82ef651 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,30 +21,32 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Added `nix::ptrace::{ptrace_get_data, ptrace_getsiginfo, ptrace_setsiginfo
and nix::Error::UnsupportedOperation}`
([#614](https://github.com/nix-rust/nix/pull/614))
+- Added `cfmakeraw`, `cfsetspeed`, and `tcgetsid`. ([#527](https://github.com/nix-rust/nix/pull/527))
### Changed
-- Changed ioctl! write to take argument by value instead as pointer.
- If you need a pointer as argument, use ioctl! write buf.
+- Changed `ioctl!(write ...)` to take argument by value instead as pointer.
+ If you need a pointer as argument, use `ioctl!(write buf ...)`.
([#626](https://github.com/nix-rust/nix/pull/626))
- Marked `sys::mman::{ mmap, munmap, madvise, munlock, msync }` as unsafe.
([#559](https://github.com/nix-rust/nix/pull/559))
-- Minimum supported Rust version is now 1.13
+- Minimum supported Rust version is now 1.13.
- Removed `revents` argument from `PollFd::new()` as it's an output argument and
will be overwritten regardless of value.
([#542](https://github.com/nix-rust/nix/pull/542))
- Changed type signature of `sys::select::FdSet::contains` to make `self`
immutable ([#564](https://github.com/nix-rust/nix/pull/564))
-- Changed type of `sched::sched_setaffinity`'s `pid` argument to `pid_t`
-- Introduced wrapper types for gid_t, pid_t, and uid_t as Gid, Pid, and Uid
+- Introduced wrapper types for `gid_t`, `pid_t`, and `uid_t` as `Gid`, `Pid`, and `Uid`
respectively. Various functions have been changed to use these new types as
arguments. ([#629](https://github.com/nix-rust/nix/pull/629))
-- Promoted all Android targets to Tier 2 support
+- Fixed compilation on all Android and iOS targets ([#527](https://github.com/nix-rust/nix/pull/527))
+ and promoted them to Tier 2 support.
- `nix::sys::statfs::{statfs,fstatfs}` uses statfs definition from `libc::statfs` instead of own linux specific type `nix::sys::Statfs`.
Also file system type constants like `nix::sys::statfs::ADFS_SUPER_MAGIC` were removed in favor of the libc equivalent.
([#561](https://github.com/nix-rust/nix/pull/561))
+- Revised the termios API including additional tests and documentation and exposed it on iOS. ([#527](https://github.com/nix-rust/nix/pull/527))
### Removed
-- Removed io::Error from nix::Error and conversion from nix::Error to Errno
+- Removed `io::Error` from `nix::Error` and the conversion from `nix::Error` to `Errno`
([#614](https://github.com/nix-rust/nix/pull/614))
### Fixed
@@ -62,6 +64,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
only available on x86, x86-64, and ARM, and also not on Android.
- Fixed `sys::socket::sendmsg` with zero entry `cmsgs` parameter.
([#623](https://github.com/nix-rust/nix/pull/623))
+- Multiple constants related to the termios API have now been properly defined for
+ all supported platforms. ([#527](https://github.com/nix-rust/nix/pull/527))
## [0.8.1] 2017-04-16
@@ -75,7 +79,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Added `::nix::sys::termios::BaudRate` enum to provide portable baudrate
values. ([#518](https://github.com/nix-rust/nix/pull/518))
- Added a new `WaitStatus::PtraceEvent` to support ptrace events on Linux
- and Android ([([#438](https://github.com/nix-rust/nix/pull/438))
+ and Android ([#438](https://github.com/nix-rust/nix/pull/438))
- Added support for POSIX AIO
([#483](https://github.com/nix-rust/nix/pull/483))
([#506](https://github.com/nix-rust/nix/pull/506))
@@ -111,7 +115,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Added `ppoll` in `::nix::poll`
([#520](https://github.com/nix-rust/nix/pull/520))
- Added support for getting and setting pipe size with fcntl(2) on Linux
- ([#540](https://github.com/nix-rust/nix/pull/540)
+ ([#540](https://github.com/nix-rust/nix/pull/540))
### Changed
- `::nix::sys::termios::{cfgetispeed, cfsetispeed, cfgetospeed, cfsetospeed}`
diff --git a/README.md b/README.md
index 8cda561a1a..4ccc47857e 100644
--- a/README.md
+++ b/README.md
@@ -50,41 +50,41 @@ The following targets are all supported by nix on Rust 1.13.0 or newer (unless
otherwise noted):
Tier 1:
- * i686-unknown-linux-gnu
- * x86_64-unknown-linux-gnu
- * i686-apple-darwin
- * x86_64-apple-darwin
* aarch64-unknown-linux-gnu
- * armv7-unknown-linux-gnueabihf
* arm-unknown-linux-gnueabi
- * x86_64-unknown-freebsd
+ * armv7-unknown-linux-gnueabihf
+ * i686-apple-darwin
+ * i686-unknown-linux-gnu
+ * i686-unknown-linux-musl
+ * mips-unknown-linux-gnu
+ * mipsel-unknown-linux-gnu
* powerpc-unknown-linux-gnu
* powerpc64-unknown-linux-gnu
* powerpc64le-unknown-linux-gnu
- * mips-unknown-linux-gnu
- * mipsel-unknown-linux-gnu
- * i686-unknown-linux-musl
+ * x86_64-apple-darwin
+ * x86_64-unknown-freebsd
+ * x86_64-unknown-linux-gnu
* x86_64-unknown-linux-musl
Tier 2:
- * i686-unknown-freebsd
- * x86_64-unknown-netbsd
+ * aarch64-apple-ios
* aarch64-linux-android
* arm-linux-androideabi
+ * armv7-apple-ios
* armv7-linux-androideabi
+ * armv7s-apple-ios
+ * i386-apple-ios
* i686-linux-android (requires Rust >= 1.18)
+ * i686-unknown-freebsd
+ * x86_64-apple-ios
* x86_64-linux-android (requires Rust >= 1.18)
+ * x86_64-unknown-netbsd
Tier 3:
- * aarch64-apple-ios
* arm-unknown-linux-musleabi (requires Rust >= 1.14)
- * armv7-apple-ios
- * armv7s-apple-ios
- * i386-apple-ios
* mips64-unknown-linux-gnuabi64
* mips64el-unknown-linux-gnuabi64
* s390x-unknown-linux-gnu
- * x86_64-apple-ios
## Usage
diff --git a/src/macros.rs b/src/macros.rs
index b8707d0b7e..d8284f71ec 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -239,6 +239,184 @@ macro_rules! libc_bitflags {
};
}
+/// The `libc_enum!` macro helps with a common use case of defining an enum exclusively using
+/// values from the `libc` crate. This macro supports both `pub` and private `enum`s.
+///
+/// The `libc` crate must be in scope with the name `libc`.
+///
+/// # Example
+/// ```
+/// libc_enum!{
+/// pub enum ProtFlags {
+/// PROT_NONE,
+/// PROT_READ,
+/// PROT_WRITE,
+/// PROT_EXEC,
+/// #[cfg(any(target_os = "linux", target_os = "android"))]
+/// PROT_GROWSDOWN,
+/// #[cfg(any(target_os = "linux", target_os = "android"))]
+/// PROT_GROWSUP,
+/// }
+/// }
+/// ```
+macro_rules! libc_enum {
+ // (non-pub) Exit rule.
+ (@make_enum
+ {
+ name: $BitFlags:ident,
+ attrs: [$($attrs:tt)*],
+ entries: [$($entries:tt)*],
+ }
+ ) => {
+ $($attrs)*
+ #[derive(Clone, Copy, Debug, PartialEq, Eq)]
+ enum $BitFlags {
+ $($entries)*
+ }
+ };
+
+ // (pub) Exit rule.
+ (@make_enum
+ {
+ pub,
+ name: $BitFlags:ident,
+ attrs: [$($attrs:tt)*],
+ entries: [$($entries:tt)*],
+ }
+ ) => {
+ $($attrs)*
+ #[derive(Clone, Copy, Debug, PartialEq, Eq)]
+ pub enum $BitFlags {
+ $($entries)*
+ }
+ };
+
+ // (non-pub) Done accumulating.
+ (@accumulate_entries
+ {
+ name: $BitFlags:ident,
+ attrs: $attrs:tt,
+ },
+ $entries:tt;
+ ) => {
+ libc_enum! {
+ @make_enum
+ {
+ name: $BitFlags,
+ attrs: $attrs,
+ entries: $entries,
+ }
+ }
+ };
+
+ // (pub) Done accumulating.
+ (@accumulate_entries
+ {
+ pub,
+ name: $BitFlags:ident,
+ attrs: $attrs:tt,
+ },
+ $entries:tt;
+ ) => {
+ libc_enum! {
+ @make_enum
+ {
+ pub,
+ name: $BitFlags,
+ attrs: $attrs,
+ entries: $entries,
+ }
+ }
+ };
+
+ // Munch an attr.
+ (@accumulate_entries
+ $prefix:tt,
+ [$($entries:tt)*];
+ #[$attr:meta] $($tail:tt)*
+ ) => {
+ libc_enum! {
+ @accumulate_entries
+ $prefix,
+ [
+ $($entries)*
+ #[$attr]
+ ];
+ $($tail)*
+ }
+ };
+
+ // Munch last ident if not followed by a comma.
+ (@accumulate_entries
+ $prefix:tt,
+ [$($entries:tt)*];
+ $entry:ident
+ ) => {
+ libc_enum! {
+ @accumulate_entries
+ $prefix,
+ [
+ $($entries)*
+ $entry = libc::$entry,
+ ];
+ }
+ };
+
+ // Munch an ident; covers terminating comma case.
+ (@accumulate_entries
+ $prefix:tt,
+ [$($entries:tt)*];
+ $entry:ident, $($tail:tt)*
+ ) => {
+ libc_enum! {
+ @accumulate_entries
+ $prefix,
+ [
+ $($entries)*
+ $entry = libc::$entry,
+ ];
+ $($tail)*
+ }
+ };
+
+ // (non-pub) Entry rule.
+ (
+ $(#[$attr:meta])*
+ enum $BitFlags:ident {
+ $($vals:tt)*
+ }
+ ) => {
+ libc_enum! {
+ @accumulate_entries
+ {
+ name: $BitFlags,
+ attrs: [$(#[$attr])*],
+ },
+ [];
+ $($vals)*
+ }
+ };
+
+ // (pub) Entry rule.
+ (
+ $(#[$attr:meta])*
+ pub enum $BitFlags:ident {
+ $($vals:tt)*
+ }
+ ) => {
+ libc_enum! {
+ @accumulate_entries
+ {
+ pub,
+ name: $BitFlags,
+ attrs: [$(#[$attr])*],
+ },
+ [];
+ $($vals)*
+ }
+ };
+}
+
/// A Rust version of the familiar C `offset_of` macro. It returns the byte
/// offset of `field` within struct `ty`
macro_rules! offset_of {
diff --git a/src/pty.rs b/src/pty.rs
index c450e0588b..88c9cc14e2 100644
--- a/src/pty.rs
+++ b/src/pty.rs
@@ -188,23 +188,57 @@ pub fn unlockpt(fd: &PtyMaster) -> Result<()> {
pub fn openpty<'a, 'b, T: Into