aio_read template.

David Collier-Brown David.Collier-Brown at Sun.COM
Tue Jun 7 11:56:07 GMT 2005


Jeremy Allison wrote:
> Volker,
> 
> 	Here is a template for the way we'd use aio_read within Samba3.
> Seems to work well on 2.6 kernels. It's a standalone program that will
> copy a file using aio_read. The one thing I haven't coped with is a 
> short read from aio_read (not an EOF read, but just reading less bytes
> than we asked for). I'm not sure if this is possible with the aio_read
> interface but thought I'd just warn you....

	Solaris carefully avoids guaranteeing no short reads,
	but tries to ensure they can't happen.

	POSIX says If the aiocb is invalid or if no asynchronous 
	I/O operation is enqueued for the aiocb, aio_return() 
	returns -1 and errno is set to indicate the error. Otherwise, 
	aio_return() returns the error status of the referenced aiocb. 

	The POSIX error status appear to be errno values, specifically 
	including EINPROGRESS, so it looks like POSIX guarantees no 
	short reads, and both Linus and the Solarii try to follow 
	that standard. A "can't happen" message might be good
	for systems that don't follow the standard, though.

--dave


-- 
David Collier-Brown,      | Always do right. This will gratify
Sun Microsystems, Toronto | some people and astonish the rest
davecb at canada.sun.com     |                      -- Mark Twain
(416) 263-5733 (x65733)   |


More information about the samba-technical mailing list