[lttng-dev] urcu rfc: privatize urcu/futex.h

Lai Jiangshan laijs at cn.fujitsu.com
Tue Aug 7 21:32:21 EDT 2012


(Added a CC email address)

On 08/08/2012 09:03 AM, Lai Jiangshan wrote:
> On 08/07/2012 10:06 PM, Mathieu Desnoyers wrote:
>> Hi Lai,
>>
>> * Lai Jiangshan (laijs at cn.fujitsu.com) wrote:
>>> futex.h is in urcu/, it means it can be used by users out of the library.
>>>
>>> But
>>>
>>> If the user's system has futex, he should use #include <linux/futex.h>.
>>> If the user's system don't have futex, it is not good that if the user
>>> use this compat_futex.
>>>
>>> Because the compat_futex_async()'s behavior is different from the
>>> futex in linux.  If the caller don't change the value of @uaddr, the
>>> futex(FUTEX_WAKE) in linux can also wake a thread, but
>>> compat_futex_async() don't.  (I guess no one use this behavior, but if
>>> there are someone, we give them a wrong thing)
>>
>> Hrm, passing a NULL uaddr parameter is really not the targeted use-case.
>> We could probably just document that uaddr should not be NULL when using
>> compat_futex ?
> 
> Sorry, I wanted to show you such un-normal behavior:
> 
> /* keep the value of *uaddr unchanged, wake up a thread to do something */
> futex(FUTEX_WAKE, uaddr, ...).
> 
> This can't not wake up any thread for current compat_futex_async() implement.
> But the sys_futex() can.
> 
> 

It is hard to implement compat_futex_async() to make its behavior compatible
with sys_futex().(I don't like the two alternatives too, I just wrote what I have thought)
so I sent rfc email to suggest to privatize urcu/futex.h.

Thanks,
Lai



More information about the lttng-dev mailing list