From patchwork Mon Jul 10 19:24:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 107319 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp3838867qge; Mon, 10 Jul 2017 12:25:05 -0700 (PDT) X-Received: by 10.99.54.205 with SMTP id d196mr13223448pga.79.1499714705546; Mon, 10 Jul 2017 12:25:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499714705; cv=none; d=google.com; s=arc-20160816; b=DAg41/awb9HXMmpGQnWL9j+Mj/mS4fAh1B4BxIS/ctUmA+iVsw0ze5juUS8xDggT3c qoQhD9xQYAIQJkakSoBS1EzrUPMpAFGTyrLRAyAp3mDZ5h5uwLeqbcND9Hboq3QvhtxY 6FJzEl3T4x0yhN7ugyAdPJsAAo5qTEBBygM3jPI5fE/6/1mvK4WJsZ5PG9FofnkWv3v3 wXGhEujm9XGIK5FwvxNT3Td3AGfoeB4B9VSg0d0OOprhJuSgvYgRoqZUXY0TIx56oclk sy6h7PnrHSBngWK+uphRZV1vazBUpy+wi/TQJgLWb9kiTMiYt36n1zylc1leL4Kf6own Tbng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:delivered-to:sender:list-help :list-post:list-archive:list-subscribe:list-unsubscribe:list-id :precedence:mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=ziVLy3GagaidP75Ahhgl6kuwzVGe1/bzcYVVHs5Ijow=; b=lWXDeDiLdCSSdQBkEHSBvS8dwFl+wfae4bGzfWPdXelnAsIxitZK1DoWQTmRb90b70 ZfnyUYUrIKVr7cPRe4WYayZkRj60AYepnmfk31g3duJNZ35OxBn7hgM4o/7mHy2ZxnKh VBCA4846JxgLK8uJnBwVb00n5fz5AYgq34ayhZDqdj3z9m5bmBUVKuXKDMo9PgDG/YST OYgoAQHfMus/9sIfeG68zU1YpZJ5dlytDRwVsrzpT8ykNyjO6VoZn+uILa8SpKTjndA2 QiWNNey7Eg5PujYyUvWbDfXpkTZ/jPVAJSbl3PuzYxPH93lJQOzodgRtNua4UKiUu+7G Nz5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.b=S9S9mcC4; spf=pass (google.com: domain of libc-alpha-return-81968-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-81968-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id r62si8437907pfj.353.2017.07.10.12.25.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jul 2017 12:25:05 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-81968-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.b=S9S9mcC4; spf=pass (google.com: domain of libc-alpha-return-81968-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-81968-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=Z9puX7L5tnnUGwpXjlq4mKB/k9sQpYkx0CtmWxPDWfqwy/UU4wzY9 v/zNOeCGPDSD9hmwdM9BKdySa3cDw//ymN2UIh3Fb255w9KHP/wXEm3HUqmVnQrl ib+405BNJ/DVjjMBdKcZUYax8avvKs632w+hb8Y7iFH14z/p8yU3F0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; s=default; bh=xeC5PAzttu23U6oR+d6ts/r2t8M=; b=S9S9mcC4WxN9CgOnIihAuldJnxTp t3sRxgpZyjBUbD+6a7OifnaOG/hzAYhg4ppQxkNTmKFjWOM/FlFUt5UpX4i1Fg6Z t8Lee/8vVUkMSh2Y+0SDxho/fi9fTRYpfspHxgdmZpJxi19gQYyVoCK+iuz8R15G SuNsLgRCESYxOpo= Received: (qmail 38336 invoked by alias); 10 Jul 2017 19:24:55 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 38320 invoked by uid 89); 10 Jul 2017 19:24:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=4.10 X-HELO: mail-qk0-f170.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=ziVLy3GagaidP75Ahhgl6kuwzVGe1/bzcYVVHs5Ijow=; b=cgKFGRHioGGemuGMMR9rjm5KdK3y+mGyRc9Sm/9Ifl6y+z+wG9nxwze+T7bEACASO5 rA8uFp1TBqcZBn/2bwjYswXnBEe6gx1mF779XJWducR2LKA3cQpzni+YCrTEZDu+V/mj bVWOZpf/X3+/H6LOURZJYTZZ6aufLrtKhR/AYqpR7TX+uPWw5AghJw5Ay+2A+eCiLemX S+E8sNRyUOlQi3Yo6Y44WXNryTdvcpmFmzVysdmzfPsozyiw+tNKtflhz01SGqQiS9Sg DY/KXECoLiDG9WlA/ywvkjjghhAbAQJUj7Z2pVjSJcH/rJGof62E2gGI2UvUfRf8ncm3 G0eg== X-Gm-Message-State: AIVw110ubwRv1ZP+U7yjRUMNngo5pQUoHIGrHMVgxP7uLZ6DAX26Dn8a N64b/gPrULwLvA8LWXfrXQ== X-Received: by 10.55.150.193 with SMTP id y184mr6074424qkd.113.1499714690462; Mon, 10 Jul 2017 12:24:50 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH] posix: Add p{read,write}v2 RWF_NOWAIT flag (BZ#21738) Date: Mon, 10 Jul 2017 16:24:45 -0300 Message-Id: <1499714685-12770-1-git-send-email-adhemerval.zanella@linaro.org> Linux 4.12 (b745fafaf70c0a98a2e1e7ac8cb14542889ceb0e) adds a new p{read,write}v2 flag RWF_NOWAIT. This patch adds it for linux uio-ext.h header along with RWF_SUPPORTED (a mask with all supported flags). Checked on x86_64-linux-gnu (on a 4.10 kernel). [BZ #21738] * manual/llio.texi (RWF_NOWAIT): New item. (RWF_SUPPORTED): Likewise. * misc/tst-preadvwritev2-common.c (do_test_with_invalid_flags): Create an invalid flag from RWF_SUPPORTED definition. * sysdeps/unix/sysv/linux/bits/uio-ext.h (RWF_NOWAIT): New flag. (RWF_SUPPORTED): Likewise. --- ChangeLog | 10 ++++++++++ manual/llio.texi | 6 ++++++ misc/tst-preadvwritev2-common.c | 14 ++++---------- sysdeps/unix/sysv/linux/bits/uio-ext.h | 4 ++++ 4 files changed, 24 insertions(+), 10 deletions(-) -- 2.7.4 diff --git a/manual/llio.texi b/manual/llio.texi index ba1f455..1aab522 100644 --- a/manual/llio.texi +++ b/manual/llio.texi @@ -770,6 +770,12 @@ Per-IO synchronization as if the file was opened with @code{O_DSYNC} flag. @item RWF_SYNC Per-IO synchronization as if the file was opened with @code{O_SYNC} flag. + +@item RWF_NOWAIT +Set @code{preadv2} to return -EAGAIN if operation would block. + +@item RWF_SUPPORTED +Mask with all supported flags. @end vtable When the source file is compiled with @code{_FILE_OFFSET_BITS == 64} the diff --git a/misc/tst-preadvwritev2-common.c b/misc/tst-preadvwritev2-common.c index 4c53d56..91cd58d 100644 --- a/misc/tst-preadvwritev2-common.c +++ b/misc/tst-preadvwritev2-common.c @@ -16,21 +16,15 @@ 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 + /* 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) }; diff --git a/sysdeps/unix/sysv/linux/bits/uio-ext.h b/sysdeps/unix/sysv/linux/bits/uio-ext.h index 4ddb644..12cd78e 100644 --- a/sysdeps/unix/sysv/linux/bits/uio-ext.h +++ b/sysdeps/unix/sysv/linux/bits/uio-ext.h @@ -46,6 +46,10 @@ extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec, #define RWF_HIPRI 0x00000001 /* High priority request. */ #define RWF_DSYNC 0x00000002 /* per-IO O_DSYNC. */ #define RWF_SYNC 0x00000004 /* per-IO O_SYNC. */ +#define RWF_NOWAIT 0x00000008 /* per-IO, return -EAGAIN if operation + would block */ +#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT) + __END_DECLS