LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Tom Spink" <tspink@gmail.com>
To: "Brent Casavant" <bcasavan@sgi.com>
Cc: "Rick Jones" <rick.jones2@hp.com>,
	netdev@vger.kernel.org, "David Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org
Subject: Re: AF_UNIX MSG_PEEK bug?
Date: Tue, 8 Jan 2008 23:46:15 +0000	[thread overview]
Message-ID: <7b9198260801081546u50f11e9ck32ec6f071efa300d@mail.gmail.com> (raw)
In-Reply-To: <7b9198260801081539x7aee72fbm53b5f298c5faf56@mail.gmail.com>

On 08/01/2008, Tom Spink <tspink@gmail.com> wrote:
> On 08/01/2008, Brent Casavant <bcasavan@sgi.com> wrote:
> > On Tue, 8 Jan 2008, Tom Spink wrote:
> >
> > > Where in the code is the message length being sent across the socket?
> >
> > In do_producer(), there are the following lines in the main loop:
> >
> >         /* Send random lengths of data */
> >         messages[i].length = (rand() % MAXLEN) + sizeof(size_t);
> >         iov[i].iov_len = messages[i].length;
> >
> > The entire "struct sockmsg" is sent across the socket, so the first
> > size_t in each message contains the length of the entire message
> > (including the size_t).  This size gets picked up at the
> > recv(...,MSG_PEEK) line in do_consumer().
> >
> > Thanks,
> > Brent
> >
> > --
> > Brent Casavant                          All music is folk music.  I ain't
> > bcasavan@sgi.com                        never heard a horse sing a song.
> > Silicon Graphics, Inc.                    -- Louis Armstrong
> >
>
> Hi,
>
> But you're not consuming the size_t on the other end.  You're only
> peeking it, i.e. you're doing the recv to peek at the message, but
> never calling recv to remove that data from the queue... or am I
> missing something?
>
> --
> Regards,
> Tom Spink
> University of Edinburgh
>

Ach.  I *am* missing something... and what I'm missing is my
understanding of the sendmsg and recvmsg calls.

A quick Google has sorted me out.

-- 
Regards,
Tom Spink
University of Edinburgh

  reply	other threads:[~2008-01-08 23:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-08 22:27 Brent Casavant
2008-01-08 22:40 ` Rick Jones
2008-01-08 22:53   ` Tom Spink
2008-01-08 23:18     ` Brent Casavant
2008-01-08 23:39       ` Tom Spink
2008-01-08 23:46         ` Tom Spink [this message]
2008-01-09  0:08           ` Brent Casavant
2008-01-08 23:20   ` Brent Casavant
2008-01-09 11:04 ` Tetsuo Handa
2008-01-09 18:01   ` Brent Casavant
2008-01-10  0:01     ` Herbert Xu
2008-01-10  1:19       ` Brent Casavant
2008-01-10  2:50       ` Brent Casavant
2008-01-10 22:35         ` Brent Casavant
2008-01-10 22:36           ` Alan Cox

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=7b9198260801081546u50f11e9ck32ec6f071efa300d@mail.gmail.com \
    --to=tspink@gmail.com \
    --cc=bcasavan@sgi.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rick.jones2@hp.com \
    --subject='Re: AF_UNIX MSG_PEEK bug?' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).