This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author akira
Recipients akira, asvetlov, christian.heimes, giampaolo.rodola, gvanrossum, josh.r, josiah.carlson, neologix, pitrou, rosslagerwall, yselivanov
Date 2014-04-25.08:40:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1398415255.88.0.974194439789.issue17552@psf.upfronthosting.co.za>
In-reply-to
Content
> I'm confused. Why is "blocksize" necessary at all?

My guess, it may be used to implement socket.send()-based fallback. Its meaning could be the same as *length* parameter in shutil.copyfileobj

The fallback is useful if os.sendfile doesn't exists or it doesn't accept given parameters e.g., if *file* is not mmap-like enough for os.sendfile.

> > using os.path.getsize(file.name) looks risky to me

> Why not fstat(fd) ?

os.path.getsize(file.name) in msg217121 is a pseudo-code (as said
in the comment) that expresses the intent that if *nbytes* parameter
is not specified (None) then socket.sendfile should send bytes from
the file until EOF is reached. 

In real code, if *nbytes is None*;  I would just call os.sendfile
repeatedly with a large constant *nbytes* parameter
until os.sendfile returns 0 (meaning EOF) 
without asking the file size explicitly

It assumes socket.sendfile doesn't specify its behaviour if the file
size changes between the calls.

The pseudo-code in msg217121 is my opinion about the public interface for socket.sendfile -- It is different from the one in the current socket-sendfile5.patch
History
Date User Action Args
2014-04-25 08:40:55akirasetrecipients: + akira, gvanrossum, pitrou, giampaolo.rodola, christian.heimes, josiah.carlson, asvetlov, neologix, rosslagerwall, yselivanov, josh.r
2014-04-25 08:40:55akirasetmessageid: <1398415255.88.0.974194439789.issue17552@psf.upfronthosting.co.za>
2014-04-25 08:40:55akiralinkissue17552 messages
2014-04-25 08:40:55akiracreate