qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thayne Harbaugh <thayne@c2.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] linux-user readlinkat() syscall
Date: Wed, 19 Sep 2007 07:04:19 -0600	[thread overview]
Message-ID: <1190207059.9564.111.camel@phantasm.home.enterpriseandprosperity.com> (raw)
In-Reply-To: <1190207013.9564.109.camel@phantasm.home.enterpriseandprosperity.com>

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

This patch adds the readlinkat syscall to linux-user.

[-- Attachment #2: 32_readlinkat.patch --]
[-- Type: text/x-patch, Size: 2372 bytes --]

Index: qemu/linux-user/syscall.c
===================================================================
--- qemu.orig/linux-user/syscall.c	2007-09-19 06:26:51.000000000 -0600
+++ qemu/linux-user/syscall.c	2007-09-19 06:27:29.000000000 -0600
@@ -160,6 +160,7 @@
 #define __NR_sys_mkdirat __NR_mkdirat
 #define __NR_sys_mknodat __NR_mknodat
 #define __NR_sys_openat __NR_openat
+#define __NR_sys_readlinkat __NR_readlinkat
 #define __NR_sys_renameat __NR_renameat
 #define __NR_sys_rt_sigqueueinfo __NR_rt_sigqueueinfo
 #define __NR_sys_symlinkat __NR_symlinkat
@@ -210,6 +211,10 @@
 #if defined(TARGET_NR_openat) && defined(__NR_openat)
 _syscall4(int,sys_openat,int,dirfd,const char *,pathname,int,flags,mode_t,mode)
 #endif
+#if defined(TARGET_NR_readlinkat) && defined(__NR_readlinkat)
+_syscall4(int,sys_readlinkat,int,dirfd,const char *,pathname,
+          char *,buf,size_t,bufsize)
+#endif
 #if defined(TARGET_NR_renameat) && defined(__NR_renameat)
 _syscall4(int,sys_renameat,int,olddirfd,const char *,oldpath,
           int,newdirfd,const char *,newpath)
@@ -3584,6 +3589,28 @@
             unlock_user(p, arg1, 0);
         }
         break;
+#if defined(TARGET_NR_readlinkat) && defined(__NR_readlinkat)
+    case TARGET_NR_readlinkat:
+        if (!arg2 || !arg3) {
+            ret = -EFAULT;
+            goto fail;
+	}
+        {
+            void *p2 = NULL;
+            p  = lock_user_string(arg2);
+            p2 = lock_user(arg3, arg4, 0);
+            if (!access_ok(VERIFY_READ, p, 1)
+                || !access_ok(VERIFY_READ, p2, 1))
+        	ret = -EFAULT;
+            else
+                ret = get_errno(sys_readlinkat(arg1, path(p), p2, arg4));
+            if (p2)
+                unlock_user(p2, arg3, ret);
+            if (p)
+                unlock_user(p, arg2, 0);
+        }
+        break;
+#endif
 #ifdef TARGET_NR_uselib
     case TARGET_NR_uselib:
         goto unimplemented;
Index: qemu/linux-user/arm/syscall_nr.h
===================================================================
--- qemu.orig/linux-user/arm/syscall_nr.h	2007-09-19 06:26:21.000000000 -0600
+++ qemu/linux-user/arm/syscall_nr.h	2007-09-19 06:26:57.000000000 -0600
@@ -334,4 +334,5 @@
 #define TARGET_NR_renameat			329
 #define TARGET_NR_linkat			330
 #define TARGET_NR_symlinkat			331
+#define TARGET_NR_readlinkat			332
 #define TARGET_NR_utimensat			348

  reply	other threads:[~2007-09-19 13:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-19 12:46 [Qemu-devel] [PATCH] linux-user *at() syscalls Thayne Harbaugh
2007-09-19 12:51 ` [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall Thayne Harbaugh
2007-09-19 12:53   ` [Qemu-devel] Re: [PATCH] linux-user futimesat() syscall Thayne Harbaugh
2007-09-19 12:54     ` [Qemu-devel] Re: [PATCH] linux-user openat() syscall Thayne Harbaugh
2007-09-19 12:57       ` [Qemu-devel] Re: [PATCH] linux-user mkdirat() syscall Thayne Harbaugh
2007-09-19 12:58         ` [Qemu-devel] Re: [PATCH] linux-user mknodat() syscall Thayne Harbaugh
2007-09-19 12:59           ` [Qemu-devel] Re: [PATCH] linux-user fchownat() syscall Thayne Harbaugh
2007-09-19 13:00             ` [Qemu-devel] Re: [PATCH] linux-user unlinkat() syscall Thayne Harbaugh
2007-09-19 13:01               ` [Qemu-devel] Re: [PATCH] linux-user renameat() syscall Thayne Harbaugh
2007-09-19 13:02                 ` [Qemu-devel] Re: [PATCH] linux-user linkat() syscall Thayne Harbaugh
2007-09-19 13:03                   ` [Qemu-devel] Re: [PATCH] linux-user symlinkat() syscall Thayne Harbaugh
2007-09-19 13:04                     ` Thayne Harbaugh [this message]
2007-09-19 13:05                       ` [Qemu-devel] Re: [PATCH] linux-user fchmodat() syscall Thayne Harbaugh
2007-09-19 13:06                         ` [Qemu-devel] Re: [PATCH] linux-user faccessat() syscall Thayne Harbaugh
2007-09-19 13:09                           ` [Qemu-devel] Re: [PATCH] linux-user stat64_put_user function Thayne Harbaugh
2007-09-19 13:11                             ` [Qemu-devel] Re: [PATCH] linux-user fstatat syscall Thayne Harbaugh
2007-10-02 20:50     ` [Qemu-devel] Re: [PATCH] linux-user futimesat() syscall Thayne Harbaugh
2007-09-23 15:42   ` [Qemu-devel] Re: [PATCH] linux-user utimensat() syscall Thiemo Seufer
2007-09-23 16:58     ` Stuart Anderson
2007-09-24 19:45       ` Thayne Harbaugh
2007-09-25  4:25         ` Thayne Harbaugh

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=1190207059.9564.111.camel@phantasm.home.enterpriseandprosperity.com \
    --to=thayne@c2.net \
    --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).