From 3ffbd40b9cb238948409f5fe258a56cd3feac175 Mon Sep 17 00:00:00 2001 From: Stefano Garzarella Date: Tue, 4 Jun 2019 18:10:21 +0200 Subject: [PATCH] socket: expose MSG_WAITALL in MsgFlags MSG_WAITALL can be useful with recv() to wait the full amount of data requested. Signed-off-by: Stefano Garzarella --- CHANGELOG.md | 3 +++ src/sys/socket/mod.rs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 912b43e029..7f23d39adf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] ### Added +- Added `MSG_WAITALL` to `MsgFlags` in `sys::socket`. + ([#1079](https://github.com/nix-rust/nix/pull/1079)) + ### Changed ### Fixed ### Removed diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index 0ba28358da..a8631f2461 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -132,6 +132,10 @@ libc_bitflags!{ /// [`recv()`](fn.recv.html) /// or similar function shall still return this data. MSG_PEEK; + /// Receive operation blocks until the full amount of data can be + /// returned. The function may return smaller amount of data if a signal + /// is caught, an error or disconnect occurs. + MSG_WAITALL; /// Enables nonblocking operation; if the operation would block, /// `EAGAIN` or `EWOULDBLOCK` is returned. This provides similar /// behavior to setting the `O_NONBLOCK` flag