Re: Socket hack question.

Joel Eriksson (jen@ettnet.se)
Thu, 19 Apr 2001 04:06:18 +0200


On Wed, Apr 18, 2001 at 07:31:55PM -0400, Mark Hahn wrote:
> > post. :-) But I thought sendfile() could only be used for sending data
> > from a "regular" file descriptor to another file- or socket descriptor..?
>
> he said the syscall (ie, interface) already existed,
> not that it was implemented how you want it.

Well, that's right, I could still use the sendfile() interface. If I
would like to implement sendfile() for socket -> [file|socket], would
it be possible to do something like in the following pseudocode:

if srcfd is socket then
s = sock struct for srcfd
s->foo_member = dstfd
s->data_ready = my_data_ready
block until srcfd is closed

Where foo_member was added by me to the sock struct and my_data_ready
writes to dstfd before calling the default data_ready function. To
follow the sendfile() semantics I should add a max_forward or something
too. Btw, how would I accomplish the block until srcfd is closed, is
it possible (ok, anything is _possible_ but..)?

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