Skip to content
Browse files

Add truncate and ftruncate syscall shims.

  • Loading branch information...
1 parent 847edf8 commit 2aedea7f04f7877c89e963cf6bb57f14ae905ec9 @staceyson committed Oct 9, 2012
Showing with 26 additions and 3 deletions.
  1. +26 −3 work/qemu-1.2.0/bsd-user/syscall.c
View
29 work/qemu-1.2.0/bsd-user/syscall.c
@@ -59,6 +59,13 @@ static inline abi_long get_errno(abi_long ret)
return ret;
}
+static inline int
+host_to_target_errno(int err)
+{
+ /* XXX need to translate host errnos here */
+ return (err);
+}
+
#define target_to_host_bitmask(x, tbl) (x)
static inline int is_error(abi_long ret)
@@ -2207,6 +2214,25 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1,
ret = get_errno(dup2(arg1, arg2));
break;
+ case TARGET_FREEBSD_NR_truncate:
+ if (!(p = lock_user_string(arg1)))
+ goto efault;
+ if (regpairs_aligned(cpu_env)) {
+ arg2 = arg3;
+ arg3 = arg4;
+ }
+ ret = truncate(p, target_offset64(arg2, arg3));
+ unlock_user(p, arg1, 0);
+ break;
+
+ case TARGET_FREEBSD_NR_ftruncate:
+ if (regpairs_aligned(cpu_env)) {
+ arg2 = arg3;
+ arg3 = arg4;
+ }
+ ret = ftruncate(arg1, target_offset64(arg2, arg3));
+ break;
+
case TARGET_FREEBSD_NR_acct:
if (arg1 == 0) {
ret = get_errno(acct(NULL));
@@ -2619,9 +2645,6 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1,
case TARGET_FREEBSD_NR_rfork:
case TARGET_FREEBSD_NR_vfork:
- case TARGET_FREEBSD_NR_truncate:
- case TARGET_FREEBSD_NR_ftruncate:
-
case TARGET_FREEBSD_NR_getgroups:
case TARGET_FREEBSD_NR_setgroups:

0 comments on commit 2aedea7

Please sign in to comment.
Something went wrong with that request. Please try again.