mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vegard Nossum <vegard.nossum@gmail.com>
To: xinglp <xinglp@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: splice lost data
Date: Wed, 8 Apr 2009 09:20:37 +0200	[thread overview]
Message-ID: <19f34abd0904080020l4f013b58va37c452b91831f85@mail.gmail.com> (raw)
In-Reply-To: <b7997bdf0904071248t48fed168r7fa21b421c74358a@mail.gmail.com>

2009/4/7 xinglp <xinglp@gmail.com>:
> 2.6.29.1 in VM
>
> When recv data more than 8K (1024*8) bytes at once, data lost happen.
>

Don't know if this is related to the problem you report, but your code is buggy.

You're checking errno before you know that splice() returned -1. Now,
I don't know the actual implementation, but as with most system calls,
the interface specifies only that errno is updated when the function
returns -1:

       "On error, splice() returns -1 and errno is set to indicate the
error." (man 2 splice)

You're also not checking explicitly for the return value 0, which
would possibly also not set errno (i.e. you're using perror() in the
case where splice() returned 0).

Please let me know if this fixes your problem!


Vegard

-- 
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
	-- E. W. Dijkstra, EWD1036

  reply	other threads:[~2009-04-08  7:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-07 19:48 xinglp
2009-04-08  7:20 ` Vegard Nossum [this message]
2009-04-08  7:54   ` xinglp

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=19f34abd0904080020l4f013b58va37c452b91831f85@mail.gmail.com \
    --to=vegard.nossum@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xinglp@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®