From patchwork Mon Mar 16 18:32:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milosz Tanski X-Patchwork-Id: 6023671 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 899EBBF90F for ; Mon, 16 Mar 2015 18:32:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9B668203E9 for ; Mon, 16 Mar 2015 18:32:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 834C620166 for ; Mon, 16 Mar 2015 18:32:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753347AbbCPScb (ORCPT ); Mon, 16 Mar 2015 14:32:31 -0400 Received: from mail-ie0-f172.google.com ([209.85.223.172]:35218 "EHLO mail-ie0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754615AbbCPSc3 (ORCPT ); Mon, 16 Mar 2015 14:32:29 -0400 Received: by ieclw3 with SMTP id lw3so179045938iec.2 for ; Mon, 16 Mar 2015 11:32:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fzAUVp0PU0Ar6s5x6R/8TyoCuw5LeW/B2noAJQ3Hz3E=; b=TLrGbImNpNGvHWTn8QW0NsD7Ug469421mlLZK8rHfzhXU9PBdMvrl2/Fo3on5C3I1g UadLC4WspXjTcip6iCCUzeRILOf/dYVcbtVdnxOTph94syLKij8bIXB7UnPg96kadcCb J+tRst1/3Eu1hhCQE/FJtySPRkWGB3hSuEeBDePPt2CLF79yJFy6gEb9a/3/7vNs4aah 5+8GAhtmPWZE1M+eEuevguKs8lmbmeKwjRQzDRkLghnIU41WaQd1XCh0smTQY3pww9Mp i3VuehXqRthsfLyNW/2XYBrf6UeyJgph1dZJmFGn1bElY5HjEWcW6QtoTO494HW3bJ2R YucA== X-Gm-Message-State: ALoCoQnjffRAHACNMca9eMVK7wiIqpo8NPjQjILtdAcb0Su0oX39fSm2J4uBCv1lrzTxWFqC3dxn X-Received: by 10.107.162.74 with SMTP id l71mr34736701ioe.77.1426530748902; Mon, 16 Mar 2015 11:32:28 -0700 (PDT) Received: from adfin.com ([65.244.82.98]) by mx.google.com with ESMTPSA id w3sm7168587ioi.32.2015.03.16.11.32.26 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Mar 2015 11:32:27 -0700 (PDT) From: Milosz Tanski To: linux-kernel@vger.kernel.org Cc: Christoph Hellwig , linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, Mel Gorman , Volker Lendecke , Tejun Heo , Jeff Moyer , Theodore Ts'o , Al Viro , linux-api@vger.kernel.org, Michael Kerrisk , linux-arch@vger.kernel.org, Dave Chinner , Andrew Morton Subject: [PATCH] Add preadv2/pwritev2 documentation. Date: Mon, 16 Mar 2015 14:32:26 -0400 Message-Id: <1426530746-32222-1-git-send-email-milosz@adfin.com> X-Mailer: git-send-email 1.9.3 (Apple Git-50) In-Reply-To: References: Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP New syscalls that are a variation on the preadv/pwritev but support an extra flag argument. Signed-off-by: Milosz Tanski Suggested-by: Jeff Moyer Fixes: Jeff Moyer --- man2/readv.2 | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 10 deletions(-) diff --git a/man2/readv.2 b/man2/readv.2 index 756a23f..83265c6 100644 --- a/man2/readv.2 +++ b/man2/readv.2 @@ -45,6 +45,12 @@ readv, writev, preadv, pwritev \- read or write data into multiple buffers .sp .BI "ssize_t pwritev(int " fd ", const struct iovec *" iov ", int " iovcnt , .BI " off_t " offset ); +.sp +.BI "ssize_t preadv2(int " fd ", const struct iovec *" iov ", int " iovcnt , +.BI " off_t " offset ", int " flags ); +.sp +.BI "ssize_t pwritev2(int " fd ", const struct iovec *" iov ", int " iovcnt , +.BI " off_t " offset ", int " flags ); .fi .sp .in -4n @@ -162,9 +168,9 @@ The system call combines the functionality of .BR writev () and -.BR pwrite (2). +.BR pwrite (2) "." It performs the same task as -.BR writev (), +.BR writev () "," but adds a fourth argument, .IR offset , which specifies the file offset at which the output operation @@ -174,15 +180,41 @@ The file offset is not changed by these system calls. The file referred to by .I fd must be capable of seeking. +.SS preadv2() and pwritev2() + +This pair of system calls has similar functionality to the +.BR preadv () +and +.BR pwritev () +calls, but adds a fifth argument, \fIflags\fP, which modifies the behavior on a per call basis. + +Like the +.BR preadv () +and +.BR pwritev () +calls, they accept an \fIoffset\fP argument. Unlike those calls, if the \fIoffset\fP argument is set to -1 then the current file offset is used and updated. + +The \fIflags\fP arguments to +.BR preadv2 () +and +.BR pwritev2 () +contains a bitwise OR of one or more of the following flags: +.TP +.BR RWF_NONBLOCK " (only " preadv2() " since Linux 3.19)" +Performs a non-blocking operation for regular files (not sockets) opened in buffered mode (not +.BR O_DIRECT ")." + .SH RETURN VALUE On success, -.BR readv () -and +.BR readv () "," .BR preadv () -return the number of bytes read; -.BR writev () and +.BR preadv2 () +return the number of bytes read; +.BR writev () "," .BR pwritev () +and +.BR pwritev2 () return the number of bytes written. On error, \-1 is returned, and \fIerrno\fP is set appropriately. .SH ERRORS @@ -191,12 +223,22 @@ The errors are as given for and .BR write (2). Furthermore, -.BR preadv () -and +.BR preadv () "," +.BR preadv2 () "," .BR pwritev () +and +.BR pwritev2 () can also fail for the same reasons as .BR lseek (2). -Additionally, the following error is defined: +Additionally, the following errors are defined: +.TP +.B EAGAIN +The operation would block. This is possible if the file descriptor \fIfd\fP refers to a socket and has been marked nonblocking +.RB ( O_NONBLOCK ), +or the operation is a +.BR preadv2 +and the \fIflags\fP argument is set to +.BR RWF_NONBLOCK. .TP .B EINVAL The sum of the @@ -207,12 +249,17 @@ value. .TP .B EINVAL The vector count \fIiovcnt\fP is less than zero or greater than the -permitted maximum. +permitted maximum. Or, an unknown flag is specified in \fIflags\fP. .SH VERSIONS .BR preadv () and .BR pwritev () first appeared in Linux 2.6.30; library support was added in glibc 2.10. +.sp +.BR preadv2 () +and +.BR pwritev2 () +first appeared in Linux 4.1 .SH CONFORMING TO .BR readv (), .BR writev (): @@ -225,6 +272,10 @@ first appeared in Linux 2.6.30; library support was added in glibc 2.10. .BR preadv (), .BR pwritev (): nonstandard, but present also on the modern BSDs. +.sp +.BR preadv2 (), +.BR pwritev2 (): +nonstandard, Linux extension. .SH NOTES POSIX.1-2001 allows an implementation to place a limit on the number of items that can be passed in