|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
#include <iob_internal.h>
|
|
|
|
|
|
|
|
|
|
int64 iob_write(int64 s,io_batch* b,io_write_callback cb) {
|
|
|
|
|
int64 iob_write2(int64 s,io_batch* b,io_write_callback cb,io_sendfile_callback sfcb) {
|
|
|
|
|
iob_entry* e,* last;
|
|
|
|
|
uint64 total;
|
|
|
|
|
int64 sent;
|
|
|
|
@ -15,7 +15,7 @@ int64 iob_write(int64 s,io_batch* b,io_write_callback cb) {
|
|
|
|
|
int thatsit;
|
|
|
|
|
if (!e[i].n) continue;
|
|
|
|
|
if (e[i].type==FROMFILE)
|
|
|
|
|
sent=io_mmapwritefile(s,e[i].fd,e[i].offset,e[i].n,cb);
|
|
|
|
|
sent=sfcb(s,e[i].fd,e[i].offset,e[i].n,cb);
|
|
|
|
|
else
|
|
|
|
|
sent=cb(s,e[i].buf+e[i].offset,e[i].n);
|
|
|
|
|
if (sent>0 && (uint64)sent>e[i].n) sent=e[i].n; /* can't happen */
|
|
|
|
@ -32,3 +32,7 @@ int64 iob_write(int64 s,io_batch* b,io_write_callback cb) {
|
|
|
|
|
iob_reset(b);
|
|
|
|
|
return total;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int64 iob_write(int64 s,io_batch* b,io_write_callback cb) {
|
|
|
|
|
return iob_write2(s,b,cb,io_mmapwritefile);
|
|
|
|
|
}
|
|
|
|
|