qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] fadvise64 support


From: Alexander Graf
Subject: [Qemu-devel] [PATCH] fadvise64 support
Date: Wed, 09 May 2007 17:27:18 +0200
User-agent: Thunderbird 1.5.0.10 (X11/20060911)

Hi,

this patch should implement fadvise64 and fadvise64_64 syscall support
for at least i386 by mapping it to the host syscall. While trying out a
current glibc version with qemu-i386 it just annoyed me to get an
unsupported syscall for this.

Hope this helps,
Alex
Index: qemu-0.9.0/linux-user/syscall.c
===================================================================
--- qemu-0.9.0.orig/linux-user/syscall.c
+++ qemu-0.9.0/linux-user/syscall.c
@@ -144,6 +144,7 @@ type name (type1 arg1,type2 arg2,type3 a
 #define __NR_sys_getdents64 __NR_getdents64
 #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo
 #define __NR_sys_syslog __NR_syslog
+#define __NR_sys_fadvise64 __NR_fadvise64
 
 #if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__)
 #define __NR__llseek __NR_lseek
@@ -164,6 +165,7 @@ _syscall5(int, _llseek,  uint,  fd, ulon
           loff_t *, res, uint, wh);
 _syscall3(int,sys_rt_sigqueueinfo,int,pid,int,sig,siginfo_t *,uinfo)
 _syscall3(int,sys_syslog,int,type,char*,bufp,int,len)
+_syscall4(int,sys_fadvise64,int,fd,loff_t,offset,loff_t,len,int,advice)
 #ifdef __NR_exit_group
 _syscall1(int,exit_group,int,error_code)
 #endif
@@ -4151,6 +4153,17 @@ long do_syscall(void *cpu_env, int num, 
         break;
     }
 #endif
+#ifdef TARGET_NR_fadvise64
+    case TARGET_NR_fadvise64:
+       ret = get_errno(sys_fadvise64((int)arg1, arg2, arg3, (int)arg4));
+       break;
+#endif
+#ifdef TARGET_NR_fadvise64_64
+    case TARGET_NR_fadvise64_64:
+       // fadvise64_64 should be just a wrapper for fadvise_64
+       ret = get_errno(sys_fadvise64((int)arg1, arg2, arg3, (int)arg4));
+       break;
+#endif
     default:
     unimplemented:
         gemu_log("qemu: Unsupported syscall: %d\n", num);
Index: qemu-0.9.0/linux-user/i386/syscall_nr.h
===================================================================
--- qemu-0.9.0.orig/linux-user/i386/syscall_nr.h
+++ qemu-0.9.0/linux-user/i386/syscall_nr.h
@@ -272,3 +272,4 @@
 #define TARGET_NR_clock_nanosleep      (TARGET_NR_timer_create+8)
 
 #define TARGET_NR_utimes               271
+#define TARGET_NR_fadvise64_64         272

reply via email to

[Prev in Thread] Current Thread [Next in Thread]