splice() on unix sockets
From: Mark Hills
Date: Wed Apr 22 2009 - 19:06:30 EST
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/