[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Emulation of sendfile().



On 17/02/2014 09:12, Eric Wong wrote:
> Robert Millan <rmh@debian.org> wrote:
>> If you can write a Linux-compatible sendfile() which uses BSD-ish SYS_sendfile
>> as backend, I guess they'll have no problem exporting a new symbol in glibc?
>> After all, it's glibc who claims to provide it (via <sys/sendfile.h>).
> 
> I emulate Linux sendfile on (non-Debian) FreeBSD that way in cmogstored.
> Feel free to grab the linux_sendfile() wrapper from cmogstored:
> 	http://bogomips.org/cmogstored.git/plain/http_get.c
> The linux_sendfile wrapper is trivial and I'm OK with relicensing from
> the existing GPLv3+ to any DFSG-approved license

Thank you. I've just opened a bug in libc0.1-dev to keep track of this.
 
>> You don't have to rewrite anything to use bsd_sendfile(). If you're trying
>> to build BSD software, you can use freebsd-glue if you think this will ease your
>> porting work.
> 
> Interesting, I didn't know about bsd_sendfile nor freebsd-glue, I was
> using pread+write to emulate it on Debian kFreeBSD.
> 
> Can't seem to detect bsd_sendfile, though (maybe I'm missing something
> obvious, this is on Debian sid x86_64, kFreeBSD):
> 
> $ gcc -o x x.c -Wall
> /tmp/ccJILHMP.o: In function `main':
> x.c:(.text+0x30): undefined reference to `bsd_sendfile'
> collect2: error: ld returned 1 exit status

You need -lfreebsd-glue.

-- 
Robert Millan


Reply to: