Re: [PATCH] Futexes IV (Fast Lightweight Userspace Semaphores)

Davide Libenzi
2002-03-06T02:01:39Z

On Wed, 6 Mar 2002, Rusty Russell wrote:

> In message <Pine.LNX.4.44.0203051433400.1475-100000@blue1.dev.mcafeelabs.com> y
> ou write:
> > On Tue, 5 Mar 2002, Rusty Russell wrote:
> >
> > > + pos_in_page = ((unsigned long)uaddr) % PAGE_SIZE;
> > > +
> > > + /* Must be "naturally" aligned, and not on page boundary. */
> > > + if ((pos_in_page % __alignof__(atomic_t)) != 0
> > > + || pos_in_page + sizeof(atomic_t) > PAGE_SIZE)
> > > + return -EINVAL;
> >
> > How can this :
> >
> > (pos_in_page % __alignof__(atomic_t)) != 0
> >
> > to be false, and together this :
> >
> > pos_in_page + sizeof(atomic_t) > PAGE_SIZE
> >
> > to be true ?
>
> You're assuming that __alignof__(atomic_t) = N * sizeof(atomic_t),
> where N is an integer.
>
> If alignof == 1, and sizeof == 4, you lose. I prefer to be
> future-proof.
>
> This means I should clarify the comment...

No i should do less things at a time :-(

- Davide