From: Milosz Tanski <milosz@adfin.com> To: linux-kernel@vger.kernel.org Cc: Christoph Hellwig <hch@infradead.org>, linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, Mel Gorman <mgorman@suse.de>, Volker Lendecke <Volker.Lendecke@sernet.de>, Tejun Heo <tj@kernel.org>, Jeff Moyer <jmoyer@redhat.com>, "Theodore Ts'o" <tytso@mit.edu>, Al Viro <viro@zeniv.linux.org.uk>, linux-api@vger.kernel.org, Michael Kerrisk <mtk.manpages@gmail.com>, linux-man@vger.kernel.org Subject: [PATCH v2 1/2] Add preadv2/pwritev2 documentation. Date: Thu, 6 Nov 2014 10:44:26 -0500 [thread overview] Message-ID: <d2cbc4795f774b521e13ac448d07a1156c6aa04d.1415288353.git.milosz@adfin.com> (raw) In-Reply-To: <cover.1415220890.git.milosz@adfin.com> New syscalls that are a variation on the preadv/pwritev but support an extra flag argument. Signed-off-by: Milosz Tanski <milosz@adfin.com> Suggested-by: Jeff Moyer <jmoyer@redhat.com> Fixes: Jeff Moyer <jmoyer@redhat.com> --- man2/readv.2 | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 10 deletions(-) diff --git a/man2/readv.2 b/man2/readv.2 index 8748efa..31b3870 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 @@ -205,12 +247,17 @@ values overflows an .I ssize_t value. Or, 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 3.19 (if we're lucky); .SH CONFORMING TO .BR readv (), .BR writev (): @@ -223,6 +270,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 .SS C library/kernel ABI differences POSIX.1-2001 allows an implementation to place a limit on -- 1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: Milosz Tanski <milosz@adfin.com> To: linux-kernel@vger.kernel.org Cc: Christoph Hellwig <hch@infradead.org>, linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, Mel Gorman <mgorman@suse.de>, Volker Lendecke <Volker.Lendecke@sernet.de>, Tejun Heo <tj@kernel.org>, Jeff Moyer <jmoyer@redhat.com>, Theodore Ts'o <tytso@mit.edu>, Al Viro <viro@zeniv.linux.org.uk>, linux-api@vger.kernel.org, Michael Kerrisk <mtk.manpages@gmail.com>, linux-man@vger.kernel.org Subject: [PATCH v2 1/2] Add preadv2/pwritev2 documentation. Date: Thu, 6 Nov 2014 10:44:26 -0500 [thread overview] Message-ID: <d2cbc4795f774b521e13ac448d07a1156c6aa04d.1415288353.git.milosz@adfin.com> (raw) In-Reply-To: <cover.1415220890.git.milosz@adfin.com> New syscalls that are a variation on the preadv/pwritev but support an extra flag argument. Signed-off-by: Milosz Tanski <milosz@adfin.com> Suggested-by: Jeff Moyer <jmoyer@redhat.com> Fixes: Jeff Moyer <jmoyer@redhat.com> --- man2/readv.2 | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 10 deletions(-) diff --git a/man2/readv.2 b/man2/readv.2 index 8748efa..31b3870 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 @@ -205,12 +247,17 @@ values overflows an .I ssize_t value. Or, 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 3.19 (if we're lucky); .SH CONFORMING TO .BR readv (), .BR writev (): @@ -223,6 +270,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 .SS C library/kernel ABI differences POSIX.1-2001 allows an implementation to place a limit on -- 1.9.1 -- To unsubscribe, send a message with 'unsubscribe linux-aio' in the body to majordomo@kvack.org. For more info on Linux AIO, see: http://www.kvack.org/aio/ Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>
next prev parent reply other threads:[~2014-11-06 15:44 UTC|newest] Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-11-05 21:14 [PATCH v5 0/7] vfs: Non-blockling buffered fs read (page cache only) Milosz Tanski 2014-11-05 21:14 ` [PATCH v5 1/7] vfs: Prepare for adding a new preadv/pwritev with user flags Milosz Tanski 2014-11-05 21:14 ` Milosz Tanski 2014-11-05 21:14 ` [PATCH v5 2/7] vfs: Define new syscalls preadv2,pwritev2 Milosz Tanski 2014-11-05 21:14 ` Milosz Tanski 2014-11-05 21:14 ` Milosz Tanski 2014-11-06 23:25 ` Jeff Moyer 2014-11-06 23:25 ` Jeff Moyer 2014-11-07 16:28 ` Milosz Tanski 2014-11-07 16:28 ` Milosz Tanski 2014-11-05 21:14 ` [PATCH v5 3/7] x86: wire up preadv2 and pwritev2 Milosz Tanski 2014-11-05 21:14 ` Milosz Tanski 2014-11-05 21:14 ` [PATCH v5 4/7] vfs: RWF_NONBLOCK flag for preadv2 Milosz Tanski 2014-11-05 21:14 ` Milosz Tanski 2014-11-05 21:14 ` [Ocfs2-devel] " Milosz Tanski 2014-11-05 21:14 ` Milosz Tanski 2014-11-10 16:07 ` Sage Weil 2014-11-10 16:07 ` Sage Weil 2014-11-10 16:07 ` [Ocfs2-devel] " Sage Weil 2014-11-10 16:07 ` Sage Weil 2014-11-05 21:14 ` [PATCH v5 5/7] xfs: add RWF_NONBLOCK support Milosz Tanski 2014-11-05 21:14 ` Milosz Tanski 2014-11-05 21:14 ` [PATCH v5 6/7] fs: pass iocb to generic_write_sync Milosz Tanski 2014-11-05 21:14 ` [Cluster-devel] " Milosz Tanski 2014-11-05 21:14 ` Milosz Tanski 2014-11-06 10:18 ` [Cluster-devel] " Steven Whitehouse 2014-11-06 10:18 ` Steven Whitehouse 2014-11-06 10:18 ` Steven Whitehouse 2014-11-06 10:52 ` [Linux-NTFS-Dev] " Anton Altaparmakov 2014-11-06 10:52 ` [Cluster-devel] " Anton Altaparmakov 2014-11-06 10:52 ` Anton Altaparmakov 2014-11-06 16:14 ` Milosz Tanski 2014-11-06 16:14 ` [Cluster-devel] " Milosz Tanski 2014-11-06 16:14 ` Milosz Tanski 2014-11-06 12:04 ` Jan Kara 2014-11-06 12:04 ` [Cluster-devel] " Jan Kara 2014-11-06 12:04 ` Jan Kara 2014-11-05 21:14 ` [PATCH v5 7/7] fs: add a flag for per-operation O_DSYNC semantics Milosz Tanski 2014-11-05 21:14 ` Milosz Tanski 2014-11-05 21:14 ` [Ocfs2-devel] " Milosz Tanski 2014-11-05 21:14 ` Milosz Tanski 2014-11-06 23:46 ` Jeff Moyer 2014-11-06 23:46 ` [Ocfs2-devel] " Jeff Moyer 2014-11-06 23:46 ` Jeff Moyer 2014-11-07 4:22 ` [PATCH v5 7/7] " Anton Altaparmakov 2014-11-07 4:22 ` Anton Altaparmakov 2014-11-07 4:22 ` [Ocfs2-devel] " Anton Altaparmakov 2014-11-07 4:22 ` Anton Altaparmakov 2014-11-07 5:52 ` [fuse-devel] " Anand Avati 2014-11-07 5:52 ` [Ocfs2-devel] " Anand Avati 2014-11-07 6:43 ` Anton Altaparmakov 2014-11-07 6:43 ` Anton Altaparmakov 2014-11-07 6:43 ` [Ocfs2-devel] " Anton Altaparmakov 2014-11-07 14:21 ` Roger Willcocks 2014-11-07 14:21 ` Roger Willcocks 2014-11-07 14:21 ` [Ocfs2-devel] " Roger Willcocks 2014-11-07 14:21 ` Roger Willcocks 2014-11-07 14:21 ` Roger Willcocks 2014-11-07 19:58 ` Milosz Tanski 2014-11-07 19:58 ` [Ocfs2-devel] " Milosz Tanski 2014-11-07 19:58 ` Milosz Tanski 2014-11-10 16:07 ` [PATCH v5 7/7] fs: " Sage Weil 2014-11-10 16:07 ` [Ocfs2-devel] " Sage Weil 2014-11-10 16:07 ` Sage Weil 2014-11-06 7:56 ` [PATCH v5 0/7] vfs: Non-blockling buffered fs read (page cache only) Christoph Hellwig 2014-11-06 7:56 ` Christoph Hellwig 2014-11-06 15:46 ` Milosz Tanski 2014-11-06 15:46 ` Milosz Tanski 2014-11-06 15:44 ` Milosz Tanski [this message] 2014-11-06 15:44 ` [PATCH v2 1/2] Add preadv2/pwritev2 documentation Milosz Tanski 2014-11-06 15:44 ` [PATCH v2 2/2] RWF_ODSYNC flag for pwritev2 Milosz Tanski 2014-11-06 15:44 ` Milosz Tanski 2014-11-06 16:16 ` [PATCH v5 0/7] vfs: Non-blockling buffered fs read (page cache only) Milosz Tanski 2014-11-06 16:16 ` Milosz Tanski
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=d2cbc4795f774b521e13ac448d07a1156c6aa04d.1415288353.git.milosz@adfin.com \ --to=milosz@adfin.com \ --cc=Volker.Lendecke@sernet.de \ --cc=hch@infradead.org \ --cc=jmoyer@redhat.com \ --cc=linux-aio@kvack.org \ --cc=linux-api@vger.kernel.org \ --cc=linux-fsdevel@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-man@vger.kernel.org \ --cc=mgorman@suse.de \ --cc=mtk.manpages@gmail.com \ --cc=tj@kernel.org \ --cc=tytso@mit.edu \ --cc=viro@zeniv.linux.org.uk \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.