qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] fadvise64 support
Date: Wed, 09 May 2007 17:27:18 +0200	[thread overview]
Message-ID: <4641E856.9080507@suse.de> (raw)

[-- 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

                 reply	other threads:[~2007-05-09 15:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4641E856.9080507@suse.de \
    --to=agraf@suse.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).