Re: [PATCH 1/2] Add a manpage for watch_queue(7)

From: David Howells
Date: Mon Aug 24 2020 - 13:54:14 EST


Ben Boeckel <me@xxxxxxxxxxxxxx> wrote:

> > One loss message. I set a flag on the last slot in the pipe ring to say that
> > message loss occurred, but there's insufficient space to store a counter
> > without making the slot larger (and I really don't want to do that).
> >
> > Note that every slot in the pipe ring has such a flag, so you could,
> > theoretically, get a loss message after every normal message that you read
> > out.
>
> Ah, so a "you lost something" is just a flag on the next event that does
> make it into the queue? I read it as a whole message existed indicating
> that data was lost. Not sure of the best wording here.

No. That flag is internal. It causes read() to fabricate a message and
insert it into the user buffer after the flagged message has been copied over.

> > bit 0 is 2^0 in this case. I'm not sure how better to describe it.
>
> OK, so the bits are in native-endian order in the enclosing bytes. But C
> just doesn't have a set ABI for bitfields (AFAIK), so I guess it's
> "whatever GCC does" in practice?

Hard to say - powerpc and s390 have bit 0 as the MSB:-/

But "& (1 << 0)" gets you 2^0, whatever the CPU book says.

David