Skip to content

Commit 12e911d

Browse files
committed
Enable pwritev and preadv for more operating systems.
1 parent 525c073 commit 12e911d

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
3232
(#[1447](https://github.com/nix-rust/nix/pull/1447))
3333
- Added `TcpRepair`
3434
(#[1503](https://github.com/nix-rust/nix/pull/1503))
35+
- Enabled `pwritev` and `preadv` for more operating systems.
36+
(#[1511](https://github.com/nix-rust/nix/pull/1511))
3537

3638
### Changed
3739

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ targets = [
2525
]
2626

2727
[dependencies]
28-
libc = { git = "https://github.com/rust-lang/libc", rev = "f5e31f208", features = [ "extra_traits" ] }
28+
libc = { git = "https://github.com/rust-lang/libc", rev = "621a95373", features = [ "extra_traits" ] }
2929
bitflags = "1.3.1"
3030
cfg-if = "1.0"
3131

src/sys/uio.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ pub fn readv(fd: RawFd, iov: &mut [IoVec<&mut [u8]>]) -> Result<usize> {
3030
/// or an error occurs. The file offset is not changed.
3131
///
3232
/// See also: [`writev`](fn.writev.html) and [`pwrite`](fn.pwrite.html)
33-
#[cfg(any(target_os = "dragonfly",
34-
target_os = "freebsd",
35-
target_os = "linux",
36-
target_os = "netbsd",
37-
target_os = "openbsd"))]
33+
#[cfg(not(target_os = "redox"))]
3834
pub fn pwritev(fd: RawFd, iov: &[IoVec<&[u8]>],
3935
offset: off_t) -> Result<usize> {
4036
let res = unsafe {
@@ -51,11 +47,7 @@ pub fn pwritev(fd: RawFd, iov: &[IoVec<&[u8]>],
5147
/// changed.
5248
///
5349
/// See also: [`readv`](fn.readv.html) and [`pread`](fn.pread.html)
54-
#[cfg(any(target_os = "dragonfly",
55-
target_os = "freebsd",
56-
target_os = "linux",
57-
target_os = "netbsd",
58-
target_os = "openbsd"))]
50+
#[cfg(not(target_os = "redox"))]
5951
pub fn preadv(fd: RawFd, iov: &[IoVec<&mut [u8]>],
6052
offset: off_t) -> Result<usize> {
6153
let res = unsafe {
@@ -181,7 +173,7 @@ pub fn process_vm_readv(
181173

182174
/// A vector of buffers.
183175
///
184-
/// Vectored I/O methods like [`pwritev`] and [`preadv`] use this structure for
176+
/// Vectored I/O methods like [`writev`] and [`readv`] use this structure for
185177
/// both reading and writing. Each `IoVec` specifies the base address and
186178
/// length of an area in memory.
187179
#[repr(transparent)]

0 commit comments

Comments
 (0)