From owner-freebsd-emulation@FreeBSD.ORG Sun Jan 30 20:55:28 2011 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9E8D1065672; Sun, 30 Jan 2011 20:55:28 +0000 (UTC) (envelope-from dchagin@dchagin.static.corbina.ru) Received: from contrabass.post.ru (contrabass.post.ru [85.21.78.5]) by mx1.freebsd.org (Postfix) with ESMTP id 624A08FC16; Sun, 30 Jan 2011 20:55:27 +0000 (UTC) Received: from corbina.ru (mail.post.ru [195.14.50.16]) by contrabass.post.ru (Postfix) with ESMTP id 8E247CA274; Sun, 30 Jan 2011 23:55:25 +0300 (MSK) X-Virus-Scanned: by cgpav Uf39PSi9pFi9oFi9 Received: from [10.208.17.3] (HELO dchagin.static.corbina.ru) by corbina.ru (CommuniGate Pro SMTP 5.1.14) with ESMTPS id 296900390; Sun, 30 Jan 2011 23:55:25 +0300 Received: from dchagin.static.corbina.ru (localhost [127.0.0.1]) by dchagin.static.corbina.ru (8.14.4/8.14.4) with ESMTP id p0UKtOcZ044718; Sun, 30 Jan 2011 23:55:24 +0300 (MSK) (envelope-from dchagin@dchagin.static.corbina.ru) Received: (from dchagin@localhost) by dchagin.static.corbina.ru (8.14.4/8.14.4/Submit) id p0UKtJID044717; Sun, 30 Jan 2011 23:55:19 +0300 (MSK) (envelope-from dchagin) Date: Sun, 30 Jan 2011 23:55:19 +0300 From: Chagin Dmitry To: Alexander Best Message-ID: <20110130205519.GA44685@dchagin.static.corbina.ru> References: <20110129122617.GA77148@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3V7upXqbjpZ4EhLz" Content-Disposition: inline In-Reply-To: <20110129122617.GA77148@freebsd.org> User-Agent: Mutt/1.5.19 (2009-01-05) 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 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jan 2011 20:55:28 -0000 --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--