User: Password:
|
|
Subscribe / Log in / New account

tee() with your splice()?

tee() with your splice()?

Posted Apr 13, 2006 14:31 UTC (Thu) by RobSeace (subscriber, #4435)
Parent article: tee() with your splice()?

Why not just have tee()'s non-consumption of input behavior simply be
specified by a new flag for splice(), rather than have a completely
separate syscall?


(Log in to post comments)

tee() with your splice()?

Posted Apr 13, 2006 15:49 UTC (Thu) by axboe (subscriber, #904) [Link]

Because then you want to outputs at least, otherwise you'd end up with a new pipe just containing what you consumed. Not very interesting. And it was decided that the semantics of a one -> one tee was more appropriate than a one -> two where the input is consumed.

With the current tee, you can think of it as simply a pipe dupe with memcpy() like semantics.

tee() with your splice()?

Posted Apr 13, 2006 16:36 UTC (Thu) by RobSeace (subscriber, #4435) [Link]

I'm not sure I understand why it would have to be any different internally...
I understand what tee() is doing, but I was just saying why not have a new
flag to splice() specify doing exactly that, rather than add a new syscall
to do it... Then, your example code that does tee() followed by splice(),
would instead just do two separate splice() calls... But, internally,
splice() could do the same thing tee() does (when the hypothetical new flag
is set), couldn't it? Or, is there some internal implementation trickery
that I'm completely missing? (Or, is it just that it seems unclean to add
such behavior to splice()? Ie: splice() should always be expected to
consume the input, and you don't want break that assumption, even with a
special flag?)

tee() with your splice()?

Posted Apr 25, 2006 8:24 UTC (Tue) by hozelda (guest, #19341) [Link]

I really am not sure of the answer to your question, but it made me wonder why not have Linux just have one system call "function()" and simply call it with a different flag depeding on whether we want to read or write or chmod etc. function(READ, fd, buff, bytes) to read, function(WRITE, fd, ...) to write, etc.

Or if we just had to have 2, then "function" and "ioctl" (that's my vote).

If 3: "function" "ioctl" and "read." In particular, read(WRITE, fd, ...) for opening a file, read (OPEN, ...) for duplicating a file descriptor, read (IOCTL, ...) for closing a network connection, function(READ, ...) for reserving memory, and function (CHMOD, ...) for shutting the system. Everything else should be doable with ioctl(..).

Cool! We should suggest this on the mailing lists!!!

[On a serious note, splice and tee may be related; for example, splice(WITH_TEE) might just increment counters beyond 1 and add ptrs to some linked list, etc. I don't really know. Maybe. But what really concerns me is your desire to do away with system calls.]


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds