How to find system call in kernel source code?

Giorgos Keramidas keramida at
Sat Nov 26 08:21:03 GMT 2005

On 2005-11-25 21:09, David Kelly <dkelly at> wrote:
> The sendfile(2) function is apparently a kernel system call. I've
> "find /usr/src -type f -exec grep -il sendfile "{}" \;" and several
> variations yet not found where the code which performs sendfile() is
> located. Is system call 393. Guessing I'm just missing the dispatch
> table.

The "default" implementation of sendfile() is in the file:


Look for '^sendfile' with grep(1).

The arguments of sendfile() are copied in a struct sendfile_args{} and
then passed to do_sendfile().  The definition of the sendfile_args
struct is in src/sys/sys/sysproto.h and it looks a bit scary with all
that padding and macro 'magic' going on around it.

> This is also related to P/R bin/89100. At least for me, RELENG_6
> fails to send files greater than 4 GB after a few hours or days on
> the disk. Freshly copied files work fine. No problem copying the file
> with cp. And md5 confirms the contents have not changed.

This sounds suspiciously like a 32-bit value overflowing somewhere :-/

More information about the freebsd-questions mailing list