aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-04-29 20:39:06 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-04-29 20:39:06 +0000
commit77e4672d8d3f0cca922b5d288ef227023777caf1 (patch)
tree796991e7c37b1fc124fc025d464951e214b78cb9 /linux-user
parentd34720fd7ddfe88ea99da0c06bcd60d6aa1a55cd (diff)
flock support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@101 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/syscall.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ca52eb4e9e..01e943b70f 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1414,16 +1414,42 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
ret = do_ioctl(arg1, arg2, arg3);
break;
case TARGET_NR_fcntl:
+ {
+ struct flock fl;
+ struct target_flock *target_fl = (void *)arg3;
+
switch(arg2) {
case F_GETLK:
+ ret = get_errno(fcntl(arg1, arg2, &fl));
+ if (ret == 0) {
+ target_fl->l_type = tswap16(fl.l_type);
+ target_fl->l_whence = tswap16(fl.l_whence);
+ target_fl->l_start = tswapl(fl.l_start);
+ target_fl->l_len = tswapl(fl.l_len);
+ target_fl->l_pid = tswapl(fl.l_pid);
+ }
+ break;
+
case F_SETLK:
case F_SETLKW:
+ fl.l_type = tswap16(target_fl->l_type);
+ fl.l_whence = tswap16(target_fl->l_whence);
+ fl.l_start = tswapl(target_fl->l_start);
+ fl.l_len = tswapl(target_fl->l_len);
+ fl.l_pid = tswapl(target_fl->l_pid);
+ ret = get_errno(fcntl(arg1, arg2, &fl));
+ break;
+
+ case F_GETLK64:
+ case F_SETLK64:
+ case F_SETLKW64:
goto unimplemented;
default:
ret = get_errno(fcntl(arg1, arg2, arg3));
break;
}
break;
+ }
case TARGET_NR_mpx:
goto unimplemented;
case TARGET_NR_setpgid:
@@ -2356,16 +2382,37 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3,
goto unimplemented;
#if TARGET_LONG_BITS == 32
case TARGET_NR_fcntl64:
+ {
+ struct flock64 fl;
+ struct target_flock64 *target_fl = (void *)arg3;
+
switch(arg2) {
case F_GETLK64:
+ ret = get_errno(fcntl(arg1, arg2, &fl));
+ if (ret == 0) {
+ target_fl->l_type = tswap16(fl.l_type);
+ target_fl->l_whence = tswap16(fl.l_whence);
+ target_fl->l_start = tswap64(fl.l_start);
+ target_fl->l_len = tswap64(fl.l_len);
+ target_fl->l_pid = tswapl(fl.l_pid);
+ }
+ break;
+
case F_SETLK64:
case F_SETLKW64:
- goto unimplemented;
+ fl.l_type = tswap16(target_fl->l_type);
+ fl.l_whence = tswap16(target_fl->l_whence);
+ fl.l_start = tswap64(target_fl->l_start);
+ fl.l_len = tswap64(target_fl->l_len);
+ fl.l_pid = tswapl(target_fl->l_pid);
+ ret = get_errno(fcntl(arg1, arg2, &fl));
+ break;
default:
ret = get_errno(fcntl(arg1, arg2, arg3));
break;
}
- break;
+ break;
+ }
#endif
case TARGET_NR_security:
goto unimplemented;