From: David Miller <davem@davemloft.net>
To: sdake@redhat.com
Cc: netdev@vger.kernel.org
Subject: Re: bytes received from recvmsg doesn't match FIONREAD
Date: Thu, 11 Oct 2007 16:35:06 -0700 (PDT) [thread overview]
Message-ID: <20071011.163506.111196303.davem@davemloft.net> (raw)
In-Reply-To: <1192144096.4147.16.camel@balance>
From: Steven Dake <sdake@redhat.com>
Date: Thu, 11 Oct 2007 16:08:15 -0700
> I wanted to verify that the size of a multicast UDP message received
> with recvmsg matches the size of the message the kernel thinks the
> message is.
>
> So I went about using the FIONREAD ioctl as follows:
>
> res = ioctl (fd, FIONCREAD, &value);
^^^^^^^^^ (typo? should be FIONREAD not FION_C_READ)
> assert (res != -1);
> bytes_received = recvmsg (fd, &msg_recv, MSG_NOSIGNAL | MSG_DONTWAIT);
> assert (bytes_received == value);
I think you want to use SIOCINQ, FIONREAD is only valid on files.
I'm surprised you didn't get an error return from ioctl() as the
VFS code seems to enforce this.
next prev parent reply other threads:[~2007-10-11 23:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-11 23:08 bytes received from recvmsg doesn't match FIONREAD Steven Dake
2007-10-11 23:35 ` David Miller [this message]
2007-10-11 23:36 ` David Stevens
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=20071011.163506.111196303.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=sdake@redhat.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 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.