All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Hills <mark@pogo.org.uk>
To: linux-kernel@vger.kernel.org
Subject: splice() on unix sockets
Date: Wed, 22 Apr 2009 23:15:07 +0100 (BST)	[thread overview]
Message-ID: <alpine.BSO.2.00.0904220913580.19956@zrgural.vwaro.pbz> (raw)

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

                 reply	other threads:[~2009-04-22 23:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.BSO.2.00.0904220913580.19956@zrgural.vwaro.pbz \
    --to=mark@pogo.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.