Date: Sun, 30 Jan 2011 23:55:19 +0300 From: Chagin Dmitry <dchagin@freebsd.org> To: Alexander Best <arundel@freebsd.org> Cc: freebsd-emulation@freebsd.org Subject: Re: [patch] draft to add support for futex operators FUTEX_WAIT_BITSET and FUTEX_WAKE_BITSET to the linuxulator Message-ID: <20110130205519.GA44685@dchagin.static.corbina.ru> In-Reply-To: <20110129122617.GA77148@freebsd.org> References: <20110129122617.GA77148@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jan 29, 2011 at 12:26:17PM +0000, Alexander Best wrote: > hi there, >=20 > i've spent a couple of hours hacking support for futex operators > FUTEX_WAIT_BITSET and FUTEX_WAKE_BITSET into the linuxulator. the followi= ng > patch is far from perfect and in certain places it is probably doing the = wrong > thing, however it doesn't seem to break anything. >=20 > i'd appreciate if somebody could have a look at the patch and point out a= ny > issues. please note that the patch also contains a few unrelated comment > changes and such (however only very few). >=20 > thanks in advance. >=20 > the patch can be found in here: >=20 > http://people.freebsd.org/~arundel/drafts/futex.diff >=20 @@ -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 =3D 0; @@ -275,6 +276,11 @@ f->f_uaddr, wp, f->f_refcount); wp->wp_flags |=3D 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 =3D=3D n) break; @@ -325,13 +331,16 @@ probably error here, you should test bitset before removing wp from tailq. --=20 Have fun! chd --3V7upXqbjpZ4EhLz Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.10 (FreeBSD) iEYEARECAAYFAk1F0DcACgkQ0t2Tb3OO/O0SegCfZ6zqmgwMVCaRMl64m0Jc9ypC HNgAn1gyDFpH8Pif9OAByqW7TvtJ5928 =vFHv -----END PGP SIGNATURE----- --3V7upXqbjpZ4EhLz--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110130205519.GA44685>