3 ms·
Should sendfile(2) not report error if it managed to send a non-zero amount of data? IIRC write(2) behaves like that.
by Joker_vD 4y ago
Should sendfile(2) not report error if it managed to send a non-zero amount of data? IIRC write(2) behaves like that.
- DannyBee 4y agoI don't honestly remember all of the write semantics - I thought it will only not report error if it gets interrupted by a signal handler after it wrote something. In case of true error, i thought it always return an error. write does have a weird error-checking semantic - you can get it to check for a bunch of errors without writing data by using a count of 0. At least as documented, sendfile does not have any of these semantics - it only returns number of bytes written if the transfer was successful. Otherwise, you can't tell how far it made it :)
- saurik 4y agoAs documented, sendfile (I haven't looked at whatever this "spliced_copy" is) does what Joker_vD said it should: if it does a partial write then it is considered "successful" and the caller is required to retry the call if less than the expected amount of data was sent.
- DannyBee 4y agoWhere is this documented? man sendfile on my linux box doesn't even contain the word "partial", nor does it say what you said in some other way that i can see.