From patchwork Wed Dec 14 15:37:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 5703 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 54AB923E0E for ; Wed, 14 Dec 2011 15:37:27 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id 48B53A1808F for ; Wed, 14 Dec 2011 15:37:27 +0000 (UTC) Received: by mail-ey0-f180.google.com with SMTP id k10so750954eaa.11 for ; Wed, 14 Dec 2011 07:37:27 -0800 (PST) Received: by 10.204.156.208 with SMTP id y16mr1237712bkw.72.1323877046950; Wed, 14 Dec 2011 07:37:26 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.129.2 with SMTP id hg2cs12026bkc; Wed, 14 Dec 2011 07:37:26 -0800 (PST) Received: by 10.68.73.7 with SMTP id h7mr4021009pbv.57.1323877044795; Wed, 14 Dec 2011 07:37:24 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id k1si6850159pbh.51.2011.12.14.07.37.23 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 14 Dec 2011 07:37:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1RaqtT-0005BM-RY; Wed, 14 Dec 2011 15:37:19 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio Subject: [PATCH 3/3] linux-user: Implement *listxattr syscalls Date: Wed, 14 Dec 2011 15:37:19 +0000 Message-Id: <1323877039-19891-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1323877039-19891-1-git-send-email-peter.maydell@linaro.org> References: <1323877039-19891-1-git-send-email-peter.maydell@linaro.org> Implement listxattr, flistxattr and llistxattr syscalls. Signed-off-by: Peter Maydell --- 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: {