From 1e0393a3cd1ec68565e8dc5c4233f80a001ed420 Mon Sep 17 00:00:00 2001 From: Kamal Marhubi Date: Mon, 27 Feb 2017 22:55:49 -0500 Subject: [PATCH] fcntl: Expose FcntlArg variants at the module level This allows importing them directly from `nix::fcntl` which is more ergonomic than needing to use them via `FcntlArg`. --- CHANGELOG.md | 3 +++ src/fcntl.rs | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a6dc8d2bf..2037ad817a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,6 +90,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). return a `&CStr` within the provided buffer that is always properly NUL-terminated (this is not guaranteed by the call with all platforms/libc implementations). +- Exposed all fcntl(2) operations at the module level, so they can be + imported direclty instead of via `FcntlArg` enum. + ([#541](https://github.com/nix-rust/nix/pull/541)) ### Fixed - Fixed multiple issues with Unix domain sockets on non-Linux OSes diff --git a/src/fcntl.rs b/src/fcntl.rs index 9a3c601d19..85880a673d 100644 --- a/src/fcntl.rs +++ b/src/fcntl.rs @@ -51,11 +51,10 @@ pub enum FcntlArg<'a> { // TODO: Rest of flags } +pub use self::FcntlArg::*; // TODO: Figure out how to handle value fcntl returns pub fn fcntl(fd: RawFd, arg: FcntlArg) -> Result { - use self::FcntlArg::*; - let res = unsafe { match arg { F_DUPFD(rawfd) => libc::fcntl(fd, libc::F_DUPFD, rawfd),