From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H2Ulc-0008Or-Hw for qemu-devel@nongnu.org; Thu, 04 Jan 2007 10:44:32 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H2Ulb-0008NL-0F for qemu-devel@nongnu.org; Thu, 04 Jan 2007 10:44:31 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H2Ula-0008NC-Ml for qemu-devel@nongnu.org; Thu, 04 Jan 2007 10:44:30 -0500 Received: from [213.184.230.195] (helo=localhost.localdomain) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H2UlZ-0006on-V6 for qemu-devel@nongnu.org; Thu, 04 Jan 2007 10:44:30 -0500 Date: Thu, 4 Jan 2007 17:44:34 +0200 From: "Kirill A. Shutemov" Subject: Re: [Qemu-devel] [PATCH] Support fcntl F_GETLK64, F_SETLK64, F_SETLKW64 Message-ID: <20070104154434.GA31770@localhost.localdomain> References: <20070104151244.GA30484@localhost.localdomain> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="f2QGlHpHGjS2mn6Y" Content-Disposition: inline In-Reply-To: <20070104151244.GA30484@localhost.localdomain> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --f2QGlHpHGjS2mn6Y Content-Type: multipart/mixed; boundary="pWyiEgJYm5f9v55/" Content-Disposition: inline --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On [Thu, 04.01.2007 17:12], Kirill A. Shutemov wrote: > In the attachment patch to support three new fcntl. Tested on host x86_64, > target arm. Attached, sorry. --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="qemu-0.8.2-alt-flock64.patch" Content-Transfer-Encoding: quoted-printable --- qemu-0.8.2.orig/linux-user/syscall.c 2006-12-15 16:47:53 +0200 +++ qemu-0.8.2/linux-user/syscall.c 2006-12-15 19:18:10 +0200 @@ -1687,6 +1687,8 @@ { struct flock fl; struct target_flock *target_fl; + struct flock64 fl64; + struct target_flock64 *target_fl64; long ret; =20 switch(cmd) { @@ -1716,10 +1718,27 @@ break; =20 case TARGET_F_GETLK64: + ret =3D fcntl(fd, cmd >> 1, &fl64); + if (ret =3D=3D 0) { + lock_user_struct(target_fl64, arg, 0); + target_fl64->l_type =3D tswap16(fl64.l_type) >> 1; + target_fl64->l_whence =3D tswap16(fl64.l_whence); + target_fl64->l_start =3D tswapl(fl64.l_start); + target_fl64->l_len =3D tswapl(fl64.l_len); + target_fl64->l_pid =3D tswapl(fl64.l_pid); + unlock_user_struct(target_fl64, arg, 1); + } + break; case TARGET_F_SETLK64: case TARGET_F_SETLKW64: - ret =3D -1; - errno =3D EINVAL; + lock_user_struct(target_fl64, arg, 1); + fl64.l_type =3D tswap16(target_fl64->l_type) >> 1; + fl64.l_whence =3D tswap16(target_fl64->l_whence); + fl64.l_start =3D tswapl(target_fl64->l_start); + fl64.l_len =3D tswapl(target_fl64->l_len); + fl64.l_pid =3D tswap16(target_fl64->l_pid); + unlock_user_struct(target_fl64, arg, 0); + ret =3D fcntl(fd, cmd >> 1, &fl64); break; =20 case F_GETFL: --pWyiEgJYm5f9v55/-- --f2QGlHpHGjS2mn6Y Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFFnSDibWYnhzC5v6oRAjBGAKCEl2btbHuD5n+jWuG9koCC5UetfQCeNOlq mVxcQP62EBk4rnX3atjG55Q= =djNw -----END PGP SIGNATURE----- --f2QGlHpHGjS2mn6Y--