All of lore.kernel.org
 help / color / mirror / Atom feed
* splice() on unix sockets
@ 2009-04-22 22:15 Mark Hills
  0 siblings, 0 replies; only message in thread
From: Mark Hills @ 2009-04-22 22:15 UTC (permalink / raw)
  To: linux-kernel

I found that splice() can operate from a pipe to a unix socket, but from a 
unix socket to a pipe fails with EINVAL.

On investigation, splicing from a pipe to a unix socket (af_unix.c) gets 
routed through a regular unix_stream_sendmsg (via sock_no_sendpage). If my 
understanding is correct this means it will copy memory and not 
references, so it's not actually a splice.

If so, splice() behaves inconsistently; sometimes it fails on unsupported 
file descriptors, sometimes it falls back to a copy. The man page favours 
the former, but the latter could also be useful -- to call splice() with 
any pair of fds and have the kernel do the best it can.

Splicing between unix sockets and pipes would give a useful performance 
benefit. Is there any work in progress on this? Are there any caveats to 
implementing it?

Thanks,

-- 
Mark

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-22 23:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-22 22:15 splice() on unix sockets Mark Hills

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.