Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Mar 2003 22:01:13 +0300 (MSK)
From:      Igor Sysoev <is@rambler-co.ru>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        arch@FreeBSD.ORG
Subject:   Re: Should sendfile() to return ENOBUFS?
Message-ID:  <Pine.BSF.4.21.0303042200360.3930-100000@is>
In-Reply-To: <3E64E9B8.EDCA54FE@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 4 Mar 2003, Terry Lambert wrote:

>Before sendfile(), the answer was to mmap() the data to be sent,
>and then call write() on it.  Doing that guaranteed that you would
>not have to copy the data from user space to kernel space, because
>>the mapping was already established.  That solution can still work,
>without using sendfile() to get the same performance.  The performance
>"win" of sendfile is the assumption that the entire file will be
>sent as a result of a single system call.

It's seems to me that FreeBSD (at least 4.x) write()s mmap()ed file
to the socket as well as it write()s malloc()ed memory,
i.e. it simply copies user data to kernel mbufs.
aio_write() on the socket does the same.
And sendfile() is the single syscall that set mbuf.ext_buf to page
wihout coping.


Igor Sysoev
http://sysoev.ru/en/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0303042200360.3930-100000>