* [Qemu-devel] [PATCH] fcntl TARGET_F_GETLK64, TARGET_F_SETLK64, TARGET_F_SETLKW64
@ 2007-01-04 7:50 Kirill A. Shutemov
0 siblings, 0 replies; only message in thread
From: Kirill A. Shutemov @ 2007-01-04 7:50 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1.1: Type: text/plain, Size: 88 bytes --]
In the attachment imlementation of three fcntl. Tested on host x86_64,
target armv5tel.
[-- Attachment #1.2: qemu-0.8.2-alt-flock64.patch --]
[-- Type: text/plain, Size: 1462 bytes --]
--- 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;
switch(cmd) {
@@ -1716,10 +1718,27 @@
break;
case TARGET_F_GETLK64:
+ ret = fcntl(fd, cmd >> 1, &fl64);
+ if (ret == 0) {
+ lock_user_struct(target_fl64, arg, 0);
+ target_fl64->l_type = tswap16(fl64.l_type) >> 1;
+ target_fl64->l_whence = tswap16(fl64.l_whence);
+ target_fl64->l_start = tswapl(fl64.l_start);
+ target_fl64->l_len = tswapl(fl64.l_len);
+ target_fl64->l_pid = tswapl(fl64.l_pid);
+ unlock_user_struct(target_fl64, arg, 1);
+ }
+ break;
case TARGET_F_SETLK64:
case TARGET_F_SETLKW64:
- ret = -1;
- errno = EINVAL;
+ lock_user_struct(target_fl64, arg, 1);
+ fl64.l_type = tswap16(target_fl64->l_type) >> 1;
+ fl64.l_whence = tswap16(target_fl64->l_whence);
+ fl64.l_start = tswapl(target_fl64->l_start);
+ fl64.l_len = tswapl(target_fl64->l_len);
+ fl64.l_pid = tswap16(target_fl64->l_pid);
+ unlock_user_struct(target_fl64, arg, 0);
+ ret = fcntl(fd, cmd >> 1, &fl64);
break;
case F_GETFL:
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-01-04 7:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-04 7:50 [Qemu-devel] [PATCH] fcntl TARGET_F_GETLK64, TARGET_F_SETLK64, TARGET_F_SETLKW64 Kirill A. Shutemov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.