summaryrefslogtreecommitdiff
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-01-05 20:55:49 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-01-05 20:55:49 +0000
commit43f238d7b6f75244b8c47409896a9725655e52ab (patch)
treef1d002199b30c7dc35da15aae336ff2f4ef99423 /linux-user/syscall.c
parent4dbb0f5006c7a729e20199f08a9d338b11f61fef (diff)
downloadqemu-43f238d7b6f75244b8c47409896a9725655e52ab.tar.gz
Support fcntl F_GETLK64, F_SETLK64, F_SETLKW64, by Kirill A. Shutemov.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2298 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1c31218186..21f559ebc6 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1727,6 +1727,8 @@ static long do_fcntl(int fd, int cmd, target_ulong arg)
{
struct flock fl;
struct target_flock *target_fl;
+ struct flock64 fl64;
+ struct target_flock64 *target_fl64;
long ret;
switch(cmd) {
@@ -1756,10 +1758,27 @@ static long do_fcntl(int fd, int cmd, target_ulong arg)
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: