From b81229d4ba0cd6edea03a0a2cde9b565ba9b0038 Mon Sep 17 00:00:00 2001 From: Kamal Marhubi Date: Mon, 27 Feb 2017 22:37:28 -0500 Subject: fcntl: Support getting and setting pipe size on Linux --- CHANGELOG.md | 2 ++ src/fcntl.rs | 8 ++++++++ 2 files changed, 10 insertions(+) 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 { #[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!() } }; -- cgit v1.2.3