[issue10882] Add os.sendfile()
Giampaolo Rodola'
report at bugs.python.org
Tue Jan 25 12:47:52 CET 2011
Giampaolo Rodola' <g.rodola at gmail.com> added the comment:
Please note that on FreeBSD things work a little bit differently for non-blocking sockets:
http://www.freebsd.org/cgi/man.cgi?query=sendfile&sektion=2
In details I'm talking about:
> When using a socket marked for non-blocking I/O, sendfile() may send
> fewer bytes than requested. In this case, the number of bytes
> success-fully written is returned in *sbytes (if specified), and the
> error EAGAIN is returned.
...and the similar note about EBUSY, later in the page.
Something like this should work:
ret = sendfile(in, out, offset, &sbytes, &sf, flags);
...
if (ret == -1) {
if ((errno == EAGAIN) || (errno == EBUSY)) {
return Py_BuildValue("ll", sbytes, offset + sbytes);
}
return posix_error();
}
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10882>
_______________________________________
More information about the Python-bugs-list
mailing list