Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Mar 2022 23:17:07 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 262535] Linuxulator sendfile does not support all file descriptors
Message-ID:  <bug-262535-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D262535

            Bug ID: 262535
           Summary: Linuxulator sendfile does not support all file
                    descriptors
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: james@mclgh.net

Created attachment 232438
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D232438&action=
=3Dedit
Patch to add a fallback to Linuxulator sendfile to support any FDs

In Linux < 2.6.33, sendfile could only be used to send from a file to a soc=
ket.
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 impleme=
nted
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. Here is another
thread on freebsd-emulation describing the same problem:

https://www.mail-archive.com/freebsd-emulation@freebsd.org/msg11340.html

Attached is a patch which changes the Linuxulator sendfile such that it will
use FreeBSD sendfile where possible, but otherwise fallback on a simple
read/write loop for compatibility.

I would very much appreciate some feedback on the patch, 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 hardcod=
ed
would be welcome.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-262535-227>