qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Riku Voipio <riku.voipio@iki.fi>, patches@linaro.org
Subject: [Qemu-devel] [PATCH 3/3] linux-user: Implement *listxattr syscalls
Date: Wed, 14 Dec 2011 15:37:19 +0000	[thread overview]
Message-ID: <1323877039-19891-4-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1323877039-19891-1-git-send-email-peter.maydell@linaro.org>

Implement listxattr, flistxattr and llistxattr syscalls.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/syscall.c |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index a4596c0..17c8852 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -7644,9 +7644,43 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 #ifdef TARGET_NR_setxattr
     case TARGET_NR_listxattr:
     case TARGET_NR_llistxattr:
+    {
+        void *p, *b = 0;
+        if (arg2) {
+            b = lock_user(VERIFY_WRITE, arg2, arg3, 0);
+            if (!b) {
+                ret = -TARGET_EFAULT;
+                break;
+            }
+        }
+        p = lock_user_string(arg1);
+        if (p) {
+            if (num == TARGET_NR_listxattr) {
+                ret = get_errno(listxattr(p, b, arg3));
+            } else {
+                ret = get_errno(llistxattr(p, b, arg3));
+            }
+        } else {
+            ret = -TARGET_EFAULT;
+        }
+        unlock_user(p, arg1, 0);
+        unlock_user(b, arg2, arg3);
+        break;
+    }
     case TARGET_NR_flistxattr:
-        ret = -TARGET_EOPNOTSUPP;
+    {
+        void *b = 0;
+        if (arg2) {
+            b = lock_user(VERIFY_WRITE, arg2, arg3, 0);
+            if (!b) {
+                ret = -TARGET_EFAULT;
+                break;
+            }
+        }
+        ret = get_errno(flistxattr(arg1, b, arg3));
+        unlock_user(b, arg2, arg3);
         break;
+    }
     case TARGET_NR_setxattr:
     case TARGET_NR_lsetxattr:
         {
-- 
1.7.5.4

  parent reply	other threads:[~2011-12-14 15:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-14 15:37 [Qemu-devel] [PATCH 0/3] linux-user: Implement missing *xattr calls Peter Maydell
2011-12-14 15:37 ` [Qemu-devel] [PATCH 1/3] linux-user: Allow NULL value pointer in setxattr and getxattr Peter Maydell
2011-12-14 15:37 ` [Qemu-devel] [PATCH 2/3] linux-user/syscall.c: Implement f and l versions of set/get/removexattr Peter Maydell
2011-12-14 15:37 ` Peter Maydell [this message]
2012-01-04 11:39 ` [Qemu-devel] [PATCH 0/3] linux-user: Implement missing *xattr calls Peter Maydell
2012-01-27 14:32   ` Peter Maydell

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=1323877039-19891-4-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=patches@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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).