Skip to content

Commit 0554c3f

Browse files
committed
fcntl: Support getting and setting pipe size on Linux
1 parent 06d9b04 commit 0554c3f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4444
([#503](https://github.com/nix-rust/nix/pull/503))
4545
- Added `ppoll` in `::nix::poll`
4646
([#520](https://github.com/nix-rust/nix/pull/520))
47+
- Added getting and setting pipe size with fcntl on Linux
48+
([#TODO](https://github.com/nix-rust/nix/pull/TODO)
4749

4850
### Changed
4951
- `::nix::sys::termios::{cfgetispeed, cfsetispeed, cfgetospeed, cfsetospeed}`

src/fcntl.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ pub enum FcntlArg<'a> {
4848
F_GET_SEALS,
4949
#[cfg(any(target_os = "macos", target_os = "ios"))]
5050
F_FULLFSYNC,
51+
#[cfg(any(target_os = "linux", target_os = "android"))]
52+
F_GETPIPE_SZ,
53+
#[cfg(any(target_os = "linux", target_os = "android"))]
54+
F_SETPIPE_SZ(libc::c_int),
5155

5256
// TODO: Rest of flags
5357
}
@@ -74,6 +78,10 @@ pub fn fcntl(fd: RawFd, arg: FcntlArg) -> Result<c_int> {
7478
#[cfg(any(target_os = "macos", target_os = "ios"))]
7579
F_FULLFSYNC => libc::fcntl(fd, libc::F_FULLFSYNC),
7680
#[cfg(any(target_os = "linux", target_os = "android"))]
81+
F_GETPIPE_SZ => libc::fcntl(fd, libc::F_GETPIPE_SZ),
82+
#[cfg(any(target_os = "linux", target_os = "android"))]
83+
F_SETPIPE_SZ(size) => libc::fcntl(fd, libc::F_SETPIPE_SZ, size),
84+
#[cfg(any(target_os = "linux", target_os = "android"))]
7785
_ => unimplemented!()
7886
}
7987
};

0 commit comments

Comments
 (0)