All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] fadvise64 support
@ 2007-05-09 15:27 Alexander Graf
  0 siblings, 0 replies; only message in thread
From: Alexander Graf @ 2007-05-09 15:27 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 267 bytes --]

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

[-- Attachment #2: qemu-0.9.0-fadvise64.patch --]
[-- Type: text/x-patch, Size: 1799 bytes --]

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-05-09 15:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-09 15:27 [Qemu-devel] [PATCH] fadvise64 support Alexander Graf

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.