Skip to content

Commit 82bc59a

Browse files
committed
Merge Upstream Changes
2 parents 8632b56 + 59d6b3c commit 82bc59a

15 files changed

+706
-228
lines changed

CHANGELOG.md

+17-3
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).
2424
and nix::Error::UnsupportedOperation}`
2525
([#614](https://github.com/nix-rust/nix/pull/614))
2626
- Added `cfmakeraw`, `cfsetspeed`, and `tcgetsid`. ([#527](https://github.com/nix-rust/nix/pull/527))
27+
- Added "bad none", "bad write_ptr", "bad write_int", and "bad readwrite" variants to the `ioctl!`
28+
macro. ([#670](https://github.com/nix-rust/nix/pull/670))
29+
- On Linux and Android, added support for receiving `PTRACE_O_TRACESYSGOOD`
30+
events from `wait` and `waitpid` using `WaitStatus::PtraceSyscall`
31+
([#566](https://github.com/nix-rust/nix/pull/566)).
2732

2833
### Changed
29-
- Changed `ioctl!(write ...)` to take argument by value instead as pointer.
30-
If you need a pointer as argument, use `ioctl!(write buf ...)`.
31-
([#626](https://github.com/nix-rust/nix/pull/626))
34+
- Changed `ioctl!(write ...)` into `ioctl!(write_ptr ...)` and `ioctl!(write_int ..)` variants
35+
to more clearly separate those use cases. ([#670](https://github.com/nix-rust/nix/pull/670))
3236
- Marked `sys::mman::{ mmap, munmap, madvise, munlock, msync }` as unsafe.
3337
([#559](https://github.com/nix-rust/nix/pull/559))
3438
- Minimum supported Rust version is now 1.13.
@@ -48,13 +52,21 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4852
- Revised the termios API including additional tests and documentation and exposed it on iOS. ([#527](https://github.com/nix-rust/nix/pull/527))
4953
- `eventfd`, `signalfd`, and `pwritev`/`preadv` functionality is now included by default for all
5054
supported platforms. ([#681](https://github.com/nix-rust/nix/pull/561))
55+
- The `ioctl!` macro's plain variants has been replaced with "bad read" to be consistent with
56+
other variants. The generated functions also have more strict types for their arguments. The
57+
"*_buf" variants also now calculate total array size and take slice references for improved type
58+
safety. The documentation has also been dramatically improved.
59+
([#670](https://github.com/nix-rust/nix/pull/670))
5160

5261
### Removed
5362
- Removed `io::Error` from `nix::Error` and the conversion from `nix::Error` to `Errno`
5463
([#614](https://github.com/nix-rust/nix/pull/614))
5564
- All feature flags have been removed in favor of conditional compilation on supported platforms.
5665
`execvpe` is no longer supported, but this was already broken and will be added back in the next
5766
release. ([#681](https://github.com/nix-rust/nix/pull/561))
67+
- Removed `ioc_*` functions and many helper constants and macros within the `ioctl` module. These
68+
should always have been private and only the `ioctl!` should be used in public code.
69+
([#670](https://github.com/nix-rust/nix/pull/670))
5870

5971
### Fixed
6072
- Fixed multiple issues compiling under different archetectures and OSes.
@@ -73,6 +85,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
7385
([#623](https://github.com/nix-rust/nix/pull/623))
7486
- Multiple constants related to the termios API have now been properly defined for
7587
all supported platforms. ([#527](https://github.com/nix-rust/nix/pull/527))
88+
- `ioctl!` macro now supports working with non-int datatypes and properly supports all platforms.
89+
([#670](https://github.com/nix-rust/nix/pull/670))
7690

7791
## [0.8.1] 2017-04-16
7892

Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ name = "nix"
44
description = "Rust friendly bindings to *nix APIs"
55
version = "0.9.0-pre"
66
authors = ["The nix-rust Project Developers"]
7-
homepage = "https://github.com/nix-rust/nix"
87
repository = "https://github.com/nix-rust/nix"
98
license = "MIT"
109
categories = ["os::unix-apis"]

src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ pub mod libc {
3131
pub use self::libc::*;
3232
}
3333

34-
pub use libc::{c_int, c_void};
3534
pub use errno::Errno;
3635

3736
pub mod errno;
@@ -96,7 +95,7 @@ pub enum Error {
9695
/// The operation involved a conversion to Rust's native String type, which failed because the
9796
/// string did not contain all valid UTF-8.
9897
InvalidUtf8,
99-
/// The operation is not supported by Nix, in this instance either use the libc bindings or
98+
/// The operation is not supported by Nix, in this instance either use the libc bindings or
10099
/// consult the module documentation to see if there is a more appropriate interface available.
101100
UnsupportedOperation,
102101
}

src/sys/aio.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl<'a> AioCb<'a> {
9494
/// be prioritized at the process's priority level minus `prio`
9595
/// * `sigev_notify` Determines how you will be notified of event
9696
/// completion.
97-
pub fn from_fd(fd: RawFd, prio: ::c_int,
97+
pub fn from_fd(fd: RawFd, prio: libc::c_int,
9898
sigev_notify: SigevNotify) -> AioCb<'a> {
9999
let mut a = AioCb::common_init(fd, prio, sigev_notify);
100100
a.aio_offset = 0;
@@ -118,13 +118,13 @@ impl<'a> AioCb<'a> {
118118
/// * `opcode` This field is only used for `lio_listio`. It determines
119119
/// which operation to use for this individual aiocb
120120
pub fn from_mut_slice(fd: RawFd, offs: off_t, buf: &'a mut [u8],
121-
prio: ::c_int, sigev_notify: SigevNotify,
121+
prio: libc::c_int, sigev_notify: SigevNotify,
122122
opcode: LioOpcode) -> AioCb<'a> {
123123
let mut a = AioCb::common_init(fd, prio, sigev_notify);
124124
a.aio_offset = offs;
125125
a.aio_nbytes = buf.len() as size_t;
126126
a.aio_buf = buf.as_ptr() as *mut c_void;
127-
a.aio_lio_opcode = opcode as ::c_int;
127+
a.aio_lio_opcode = opcode as libc::c_int;
128128

129129
let aiocb = AioCb { aiocb: a, mutable: true, in_progress: false,
130130
keeper: Keeper::phantom(PhantomData)};
@@ -146,13 +146,13 @@ impl<'a> AioCb<'a> {
146146
/// * `opcode` This field is only used for `lio_listio`. It determines
147147
/// which operation to use for this individual aiocb
148148
pub fn from_boxed_slice(fd: RawFd, offs: off_t, buf: Rc<Box<[u8]>>,
149-
prio: ::c_int, sigev_notify: SigevNotify,
149+
prio: libc::c_int, sigev_notify: SigevNotify,
150150
opcode: LioOpcode) -> AioCb<'a> {
151151
let mut a = AioCb::common_init(fd, prio, sigev_notify);
152152
a.aio_offset = offs;
153153
a.aio_nbytes = buf.len() as size_t;
154154
a.aio_buf = buf.as_ptr() as *mut c_void;
155-
a.aio_lio_opcode = opcode as ::c_int;
155+
a.aio_lio_opcode = opcode as libc::c_int;
156156

157157
let aiocb = AioCb{ aiocb: a, mutable: true, in_progress: false,
158158
keeper: Keeper::boxed(buf)};
@@ -173,7 +173,7 @@ impl<'a> AioCb<'a> {
173173
// AioCb, and they must all be the same type. We're basically stuck with
174174
// using an unsafe function, since aio (as designed in C) is an unsafe API.
175175
pub fn from_slice(fd: RawFd, offs: off_t, buf: &'a [u8],
176-
prio: ::c_int, sigev_notify: SigevNotify,
176+
prio: libc::c_int, sigev_notify: SigevNotify,
177177
opcode: LioOpcode) -> AioCb {
178178
let mut a = AioCb::common_init(fd, prio, sigev_notify);
179179
a.aio_offset = offs;
@@ -183,14 +183,14 @@ impl<'a> AioCb<'a> {
183183
// it.
184184
a.aio_buf = buf.as_ptr() as *mut c_void;
185185
assert!(opcode != LioOpcode::LIO_READ, "Can't read into an immutable buffer");
186-
a.aio_lio_opcode = opcode as ::c_int;
186+
a.aio_lio_opcode = opcode as libc::c_int;
187187

188188
let aiocb = AioCb { aiocb: a, mutable: false, in_progress: false,
189189
keeper: Keeper::none};
190190
aiocb
191191
}
192192

193-
fn common_init(fd: RawFd, prio: ::c_int,
193+
fn common_init(fd: RawFd, prio: libc::c_int,
194194
sigev_notify: SigevNotify) -> libc::aiocb {
195195
// Use mem::zeroed instead of explicitly zeroing each field, because the
196196
// number and name of reserved fields is OS-dependent. On some OSes,
@@ -235,7 +235,7 @@ impl<'a> AioCb<'a> {
235235
pub fn fsync(&mut self, mode: AioFsyncMode) -> Result<()> {
236236
let p: *mut libc::aiocb = &mut self.aiocb;
237237
self.in_progress = true;
238-
Errno::result(unsafe { libc::aio_fsync(mode as ::c_int, p) }).map(drop)
238+
Errno::result(unsafe { libc::aio_fsync(mode as libc::c_int, p) }).map(drop)
239239
}
240240

241241
/// Asynchronously reads from a file descriptor into a buffer

src/sys/event.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct KEvent {
2121
#[cfg(any(target_os = "openbsd", target_os = "freebsd",
2222
target_os = "dragonfly", target_os = "macos",
2323
target_os = "ios"))]
24-
type type_of_udata = *mut ::c_void;
24+
type type_of_udata = *mut libc::c_void;
2525
#[cfg(any(target_os = "openbsd", target_os = "freebsd",
2626
target_os = "dragonfly", target_os = "macos",
2727
target_os = "ios"))]
@@ -127,7 +127,7 @@ libc_bitflags!(
127127
#[cfg(any(target_os = "macos", target_os = "ios"))]
128128
NOTE_EXITSTATUS,
129129
NOTE_EXTEND,
130-
#[cfg(any(target_os = "macos",
130+
#[cfg(any(target_os = "macos",
131131
target_os = "ios",
132132
target_os = "freebsd",
133133
target_os = "dragonfly"))]

0 commit comments

Comments
 (0)