[patch] draft to add support for futex operators FUTEX_WAIT_BITSET and FUTEX_WAKE_BITSET to the linuxulator

Chagin Dmitry dchagin at freebsd.org
Sun Jan 30 20:55:28 UTC 2011


On Sat, Jan 29, 2011 at 12:26:17PM +0000, Alexander Best wrote:
> hi there,
> 
> i've spent a couple of hours hacking support for futex operators
> FUTEX_WAIT_BITSET and FUTEX_WAKE_BITSET into the linuxulator. the following
> patch is far from perfect and in certain places it is probably doing the wrong
> thing, however it doesn't seem to break anything.
> 
> i'd appreciate if somebody could have a look at the patch and point out any
> issues. please note that the patch also contains a few unrelated comment
> changes and such (however only very few).
> 
> thanks in advance.
> 
> the patch can be found in here:
> 
> http://people.freebsd.org/~arundel/drafts/futex.diff
> 

@@ -264,7 +265,7 @@
 }

 static int
-futex_wake(struct futex *f, int n)
+futex_wake(struct futex *f, int n, int val3)
 {
        struct waiting_proc *wp, *wpt;
        int count = 0;
@@ -275,6 +276,11 @@
                    f->f_uaddr, wp, f->f_refcount);
                wp->wp_flags |= FUTEX_WP_REMOVED;
                TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
+
+               /* Unless we find a matching bit in */
+               /* the bitmask, continue searching. */
+               if (!(wp->wp_futex->f_bitmask & val3))
+                       continue;
                wakeup_one(wp);
                if (++count == n)
                        break;
@@ -325,13 +331,16 @@


probably error here, you should test bitset before removing wp from
tailq.


-- 
Have fun!
chd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-emulation/attachments/20110130/033eb432/attachment.pgp


More information about the freebsd-emulation mailing list