tech-kern archive

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

Re: Emulating missing linux syscalls



Am Tue, Apr 12, 2022 at 04:56:05PM -0000 schrieb Christos Zoulas:
> In article <YlV0WgcFGhH/vSIP%bec.de@localhost>, Joerg Sonnenberger  <joerg%bec.de@localhost> wrote:
> >Am Tue, Apr 12, 2022 at 12:29:21PM -0000 schrieb Christos Zoulas:
> >> In article
> ><CALigkZQpW8-wAty57d=hpsx6eo_RmacQ=pkej+FezNS_r6Mq=w%mail.gmail.com@localhost>,
> >> Piyush Sachdeva  <piyushsachdeva245%gmail.com@localhost> wrote:
> >> >-=-=-=-=-=-
> >> >
> >> >Dear Stephen Borrill,
> >> >My name is Piyush, and I was looking into the
> >> >'Emulating missing Linux syscalls' project hoping to contribute
> >> >to this year's GSoC.
> >> >
> >> >I wanted to be sure of a few basic things before I go ahead:
> >> >- linux binaries are found in- src/sys/compat/linux
> >> >- particular implementation in - src/sys/compat/linux/common
> >> >- a few architecture-specific implementations in-
> >> >  src/sys/compat/linux/arch/<arch_name>.
> >> >- The src/sys/compat/linux/arch/<arch_name>/linux_syscalls.c file
> >> >   lists of system calls, and states if a particular syscall is present or
> >> >not.
> >> >
> >> >I was planning to work on the 'sendfile()' syscall, which I believe
> >> >is unimplemented for amd64 and a few other architectures as well.
> >> >
> >> >Considering the above points, I was hoping you could point me in
> >> >the right direction for this project. Hope to hear from you soon.
> >> 
> >> I would look into porting the FreeBSD implementation of sendfile to NetBSD.
> >
> >sendfile(2) for Linux compat can be emulated in the kernel without
> >backing. That said, a real splice(2) or even splicev(2) would be really
> >nice to have. But that's a different project and arguable, a potentially
> >more generally useful one, too.
> 
> 
> Yes, splice is more general (as opposed to send a file to a socket), but I
> think splice has limitations too (one of the fds needs to be a pipe).
> Is that true only for linux?

splice(2) as a concept is much older than the current Linux implementation.
There is no reason why zero-copying for sockets should require a
different system call for zero-copying from/to pipes. There are valid
reasons for other combinations, too. Consider /bin/cp for example.

I was saying that the Linux system call can be implemented without a
kernel backend, because I don't consider zero copy a necessary part of
the interface contract. It's a perfectly valid, if a bit slower
implementation to do allocate a kernel buffer and do IO via that.

Joerg


Home | Main Index | Thread Index | Old Index