Yes, that section is missing. It should be just as you said.
int futex_down(atomic_t *count)
{
if (!atomic_dec_and_test(count))
return sys_futex(count,FUTEX_DOWN);
return 0;
}
One needs to ensure that the atomic nature is compiled in (i.e. SMP)
even if SMP is not enabled in the machine.
Rusty, could you post that code that you are using.
Also, the check on PROT_SEM is missing. I tried this before and glibc filtered
these flags out when set. But effectively, one still needs to check
whether semaphores are allowed during the sys_futex call.
This is expensive, because the protections are associated with the VMA.
find_vma() is not an option here, that's why I did the hashing and more persistent
objects rather than hashed wait queues.
I'd suggest to drop the requirements for this flag PROT_SEM.
I don't see tremendous value for it anyway, and it creates quite some
headache if its to be enforced, which it is not in Rusty's code.
My code could do it, but as it comes with the complexity discussed earlier.
-- Hubertus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/