Skip to contentSkip to conversation

Add mincore syscall

PATCH Applied Riku Voipio 3 participants 3 messages Sep 19, 2008 – Oct 1, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add mincore syscall

---
 linux-user/syscall.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
linux-user/syscall.c +13 -1
index 8e6e735..cb75c94 100644
@@ -5574,7 +5574,19 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         goto unimplemented;
 #ifdef TARGET_NR_mincore
     case TARGET_NR_mincore:
-        goto unimplemented;
+        {
+            void *a;
+            ret = -TARGET_EFAULT;
+            if (!(a = lock_user(VERIFY_READ, arg1,arg2, 0)))
+                goto efault;
+            if (!(p = lock_user_string(arg3)))
+                goto mincore_fail;
+            ret = get_errno(mincore(a, arg2, p));
+            unlock_user(p, arg3, ret);
+            mincore_fail:
+            unlock_user(a, arg1, 0);
+        }
+        break;
 #endif
 #ifdef TARGET_NR_fadvise64_64
      case TARGET_NR_fadvise64_64:
Signature · 5 lines
1.5.6.5


-- 
"rm -rf" only sounds scary if you don't have backups
#1 lore raw
Quoted 21 lines · Riku Voipio
---
 linux-user/syscall.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
linux-user/syscall.c +6 -1
index 8e6e735..cb75c94 100644
@@ -5574,7 +5574,19 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         goto unimplemented;
 #ifdef TARGET_NR_mincore
     case TARGET_NR_mincore:
-        goto unimplemented;
+        {
+            void *a;
+            ret = -TARGET_EFAULT;
+            if (!(a = lock_user(VERIFY_READ, arg1,arg2, 0)))
+                goto efault;
+            if (!(p = lock_user_string(arg3)))

linux-user/syscall.c abi_long do_syscall(void *cpu_env, int num, abi_long arg1, · line 5592

Quoted 10 lines
linux-user/syscall.c +7 -0
+                goto mincore_fail;
+            ret = get_errno(mincore(a, arg2, p));
+            unlock_user(p, arg3, ret);
+            mincore_fail:
+            unlock_user(a, arg1, 0);
+        }
+        break;
 #endif
 #ifdef TARGET_NR_fadvise64_64
      case TARGET_NR_fadvise64_64:

Looks good for me. Added to my patchset.

Signature · 3 lines
Regards,  Kirill A. Shutemov
 + Belarus, Minsk
 + ALT Linux Team, http://www.altlinux.com/
#2 lore raw
In reply to Riku Voipio

Applied, thanks.

Quoted 40 lines · Riku Voipio
---
 linux-user/syscall.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
linux-user/syscall.c +13 -1
index 8e6e735..cb75c94 100644
@@ -5574,7 +5574,19 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         goto unimplemented;
 #ifdef TARGET_NR_mincore
     case TARGET_NR_mincore:
-        goto unimplemented;
+        {
+            void *a;
+            ret = -TARGET_EFAULT;
+            if (!(a = lock_user(VERIFY_READ, arg1,arg2, 0)))
+                goto efault;
+            if (!(p = lock_user_string(arg3)))
+                goto mincore_fail;
+            ret = get_errno(mincore(a, arg2, p));
+            unlock_user(p, arg3, ret);
+            mincore_fail:
+            unlock_user(a, arg1, 0);
+        }
+        break;
 #endif
 #ifdef TARGET_NR_fadvise64_64
      case TARGET_NR_fadvise64_64:
Signature · 5 lines
1.5.6.5


-- 
"rm -rf" only sounds scary if you don't have backups
Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net