From 94070f86c0c849c71ed2e7e2189bb4d1f7411a17 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Mon, 10 Jul 2017 15:53:32 -0300 Subject: posix: Add p{read,write}v2 RWF_NOWAIT flag (BZ#21738) Linux 4.12 (b745fafaf70c0a98a2e1e7ac8cb14542889ceb0e) adds a new p{read,write}v2 flag RWF_NOWAIT. This patch adds it for linux uio-ext.h header. Checked on x86_64-linux-gnu (on a 4.10 kernel). [BZ #21738] * manual/llio.texi (RWF_NOWAIT): New item. * misc/tst-preadvwritev2-common.c (do_test_with_invalid_flags): Add RWF_NOWAIT check. * sysdeps/unix/sysv/linux/bits/uio-ext.h (RWF_NOWAIT): New flag. --- misc/tst-preadvwritev2-common.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'misc') diff --git a/misc/tst-preadvwritev2-common.c b/misc/tst-preadvwritev2-common.c index 4c53d56..8abedc1 100644 --- a/misc/tst-preadvwritev2-common.c +++ b/misc/tst-preadvwritev2-common.c @@ -16,21 +16,16 @@ License along with the GNU C Library; if not, see . */ +#include #include static void do_test_with_invalid_flags (void) { - int invalid_flag = 0x1; -#ifdef RWF_HIPRI - invalid_flag <<= 1; -#endif -#ifdef RWF_DSYNC - invalid_flag <<= 1; -#endif -#ifdef RWF_SYNC - invalid_flag <<= 1; -#endif +#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT) + /* Set the next bit from the mask of all supported flags. */ + int invalid_flag = __builtin_clz (RWF_SUPPORTED); + invalid_flag = 0x1 << ((sizeof (int) * CHAR_BIT) - invalid_flag); char buf[32]; const struct iovec vec = { .iov_base = buf, .iov_len = sizeof (buf) }; -- cgit v1.1