Re: sendfile() documentation

Felix von Leitner (leitner@math.fu-berlin.de)
Thu, 17 Dec 1998 13:24:40 +0100


Thus spake Linus Torvalds (torvalds@transmeta.com):
> >To be honest, I don't understand why anyone would want to use it.
> >If I use sendfile, I need to open a new process/thread for every
> >connection, right?
> No. sendfile() was designed to do the right thing wrt nonblocking
> writes, so you can have a select() loop with sendfile() the same way
> you'd have it with read()+write().

Sorry, I do not understand that.
If I use sendfile with nonblocking writes, there is no gain compared to
using read+write except that I don't need a buffer.
I would see the value of sendfile if I could just use sendfile and then
select on writing and it would only return when all the bytes have been
transferred. Now, _that_ would be great ;)

The reason to use sendfile would be to save the context switches, so I
don't want my select to return all the time, right?

Felix

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/