summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2017-02-28 14:28:46 +0900
committerHomu <homu@barosl.com>2017-02-28 14:28:46 +0900
commitc47f664f891ab569bac9bc470c21b77aaeb91604 (patch)
tree4fd4021f1e4b8556bcbde7df63c9f065bfd8dd70
parent06d9b04180288de9906afd8018dd19a403e1877d (diff)
parentb81229d4ba0cd6edea03a0a2cde9b565ba9b0038 (diff)
downloadnix-c47f664f891ab569bac9bc470c21b77aaeb91604.zip
Auto merge of #540 - kamalmarhubi:fcntl-getsetpipe-sz, r=posborne
fcntl: Support getting and setting pipe size on Linux
-rw-r--r--CHANGELOG.md2
-rw-r--r--src/fcntl.rs8
2 files changed, 10 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0a6dc8d2..c46e94f5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -44,6 +44,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
([#503](https://github.com/nix-rust/nix/pull/503))
- 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)
### Changed
- `::nix::sys::termios::{cfgetispeed, cfsetispeed, cfgetospeed, cfsetospeed}`
diff --git a/src/fcntl.rs b/src/fcntl.rs
index 9a3c601d..64e9fb60 100644
--- a/src/fcntl.rs
+++ b/src/fcntl.rs
@@ -48,6 +48,10 @@ pub enum FcntlArg<'a> {
F_GET_SEALS,
#[cfg(any(target_os = "macos", target_os = "ios"))]
F_FULLFSYNC,
+ #[cfg(any(target_os = "linux", target_os = "android"))]
+ F_GETPIPE_SZ,
+ #[cfg(any(target_os = "linux", target_os = "android"))]
+ F_SETPIPE_SZ(libc::c_int),
// TODO: Rest of flags
}
@@ -74,6 +78,10 @@ pub fn fcntl(fd: RawFd, arg: FcntlArg) -> Result<c_int> {
#[cfg(any(target_os = "macos", target_os = "ios"))]
F_FULLFSYNC => libc::fcntl(fd, libc::F_FULLFSYNC),
#[cfg(any(target_os = "linux", target_os = "android"))]
+ F_GETPIPE_SZ => libc::fcntl(fd, libc::F_GETPIPE_SZ),
+ #[cfg(any(target_os = "linux", target_os = "android"))]
+ F_SETPIPE_SZ(size) => libc::fcntl(fd, libc::F_SETPIPE_SZ, size),
+ #[cfg(any(target_os = "linux", target_os = "android"))]
_ => unimplemented!()
}
};