Bug 80362 - [PATCH] add preadv() and pwritev() system calls
Summary: [PATCH] add preadv() and pwritev() system calls
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 5.4-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-26 14:20 UTC by Marc Olzheim
Modified: 2005-09-22 20:00 UTC (History)
0 users

See Also:


Attachments
file.diff (9.82 KB, patch)
2005-04-26 14:20 UTC, Marc Olzheim
no flags Details | Diff
file.diff (9.82 KB, patch)
2005-04-26 14:20 UTC, Marc Olzheim
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Olzheim 2005-04-26 14:20:30 UTC
	FreeBSD lacks preadv() and pwritev(). Since all underlying code
	already supports the functionality it is very easy to add.
	NetBSD and OpenBSD have had these calls, that are useful in
	multi-threaded fileaccess, for years now and for orthogonality
	it's nice to have them as well.

Fix: Patches for 5.4-STABLE and 6-CURRENT to follow:

5.4-STABLE.patch:
6-CURRENT.patch:
Comment 2 Marc Olzheim 2005-06-27 15:07:23 UTC
Updated the patches again:

http://www.stack.nl/~marcolz/FreeBSD/preadv.current.20050627.patch.txt

After patching, type 'make syscalls.c' in /usr/src/sys/kern and
'make sysent' in /usr/src/sys/compat/freebsd32/

Could someone please take a look at it / commit it ?
Or do you want me to put the files generated by the two 'make's into the
patch as well ?
I figured it would be better not to, since they are generated anyway...

Marc
Comment 3 John Baldwin freebsd_committer freebsd_triage 2005-07-05 20:09:42 UTC
I've looked at this patch and have integrated into a test tree in P4 and 
played with it some.  The original patch didn't do any of the extra checks 
that pread() and pwrite() do compared to read() and write() in the preadv() 
and pwritev() functions (i.e. don't allow the operation on pipes and don't 
allow negative offsets on devices in /dev).  It also exposed some 
implementation details in the kern_p{read,write}v() interface (FOF_OFFSET 
flag) that normally should be hidden from the ABIs.  Instead, I merged much 
of the common code in dofile{read,write}() and the old kern_{read,write}v() 
such that read() and write() just construct a uio and call kern_readv() and 
kern_writev(), respectively.  I then moved the extra p* checks into the 
kern_preadv() and kern_pwritev() functions and made pread() and pwritev() 
construct a simple uio and call the kern_foov() cousin as well.  kern_foov() 
now no longer calls kern_pfoov() but instead, both are simpler wrappers 
around dofilefoo().  Also, the kern_pfoov() interface is simpler in that it 
just takes arguments normally passed to the associated syscall.  I didn't 
change any of the docs for this, just the kernel side.  The updated kernel 
patch is at http://www.FreeBSD.org/~jhb/patches/preadv.patch

Marc, can you test it to make sure nothing was broken by all the reshuffling?

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
Comment 4 John Baldwin freebsd_committer freebsd_triage 2005-07-07 19:20:44 UTC
State Changed
From-To: open->patched

Will MFC in a week or so.
Comment 5 Marc Olzheim 2005-09-22 10:55:19 UTC
Unless this is going to be merged to RELENG_4 as well (I initially built
it on RELENG_4, but don't have problems keeping the patch in my local
source tree), I'd say let's close this PR... :-)

Marc
Comment 6 John Baldwin freebsd_committer freebsd_triage 2005-09-22 19:19:24 UTC
State Changed
From-To: patched->closed

Requested by submitter.
Comment 7 John Baldwin freebsd_committer freebsd_triage 2005-09-22 19:22:28 UTC
On Thursday 22 September 2005 05:55 am, Marc Olzheim wrote:
> Unless this is going to be merged to RELENG_4 as well (I initially built
> it on RELENG_4, but don't have problems keeping the patch in my local
> source tree), I'd say let's close this PR... :-)

Ok.  Did I put it in 5?

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org