freebsd-src icon indicating copy to clipboard operation
freebsd-src copied to clipboard

linuxulator: add sendfile fallback for non-socket FDs

Open jamesamcl opened this issue 3 years ago • 1 comments

In Linux < 2.6.33, sendfile could only be used to send from a file to a socket. This is the behaviour implemented by the FreeBSD Linuxulator. However, since 2.6.33, sendfile can send from any FD to any other FD, which is not implemented by FreeBSD sendfile or by the Linuxulator.

I ran into this problem trying to run the game "Factorio" using the Linuxulator, which relies on sendfile to copy files on disk. This patch changes the Linuxulator sendfile such that it will use FreeBSD sendfile where possible, but otherwise fallback on a simple read/write loop.

I would very much appreciate some feedback, as I have never contributed to the FreeBSD kernel before. In particular, any suggestion for a better way to choose the buffer size than the arbitrary 8 KB I have hardcoded would be welcome.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262535

jamesamcl avatar Mar 13 '22 23:03 jamesamcl

Also uploaded at https://reviews.freebsd.org/D34555

jamesamcl avatar Mar 14 '22 22:03 jamesamcl

what's the status of this? I see a lot of feedback on D34555, but no updates after a point... ideally, we'd have it just done there since that's more preferred than pull requests... So if I don't hear anything, I'll close this soon.

bsdimp avatar Feb 05 '23 23:02 bsdimp

I'm going to close this. there's no activity on the Phab reivew after the initial feedback. This isn't ready to land. Once it is ready, please go ahead and re-open the pull request. I'll leave the phab open.

bsdimp avatar Feb 27 '23 23:02 bsdimp