From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H2NMY-0008K3-H4 for qemu-devel@nongnu.org; Thu, 04 Jan 2007 02:50:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H2NMX-0008Ji-Jl for qemu-devel@nongnu.org; Thu, 04 Jan 2007 02:50:10 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H2NMX-0008Jf-GA for qemu-devel@nongnu.org; Thu, 04 Jan 2007 02:50:09 -0500 Received: from [213.184.230.195] (helo=localhost.localdomain) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H2NMW-0007pI-SL for qemu-devel@nongnu.org; Thu, 04 Jan 2007 02:50:09 -0500 From: "Kirill A. Shutemov" Message-ID: <20070104075011.GA10461@localhost.localdomain> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4ZLFUWh1odzi/v6L" Content-Disposition: inline Subject: [Qemu-devel] [PATCH] fcntl TARGET_F_GETLK64, TARGET_F_SETLK64, TARGET_F_SETLKW64 Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Thu, 04 Jan 2007 07:50:11 -0000 To: qemu-devel@nongnu.org --4ZLFUWh1odzi/v6L Content-Type: multipart/mixed; boundary="A6N2fC+uXW/VQSAv" Content-Disposition: inline --A6N2fC+uXW/VQSAv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In the attachment imlementation of three fcntl. Tested on host x86_64, target armv5tel. --A6N2fC+uXW/VQSAv 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: --A6N2fC+uXW/VQSAv-- --4ZLFUWh1odzi/v6L 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) iD8DBQFFnLGzbWYnhzC5v6oRAhOAAJ45Dn6QqgWJVxQF6W5QaQxo0xJj1ACdEHvi olmurA2Je5WxOOUcNi1AR8U= =t7kR -----END PGP SIGNATURE----- --4ZLFUWh1odzi/v6L--