[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20071011.163506.111196303.davem@davemloft.net>
Date: Thu, 11 Oct 2007 16:35:06 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: sdake@...hat.com
Cc: netdev@...r.kernel.org
Subject: Re: bytes received from recvmsg doesn't match FIONREAD
From: Steven Dake <sdake@...hat.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.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists