Skip to content

Commit

Permalink
fcntl: Support getting and setting pipe size on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
kamalmarhubi committed Feb 28, 2017
1 parent 06d9b04 commit 0554c3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 getting and setting pipe size with fcntl on Linux
([#TODO](https://github.com/nix-rust/nix/pull/TODO)

### Changed
- `::nix::sys::termios::{cfgetispeed, cfsetispeed, cfgetospeed, cfsetospeed}`
Expand Down
8 changes: 8 additions & 0 deletions src/fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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!()
}
};
Expand Down

0 comments on commit 0554c3f

Please sign in to comment.