From patchwork Fri Feb 3 14:49:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 139415 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 73359104792 for ; Sat, 4 Feb 2012 03:09:43 +1100 (EST) Received: from localhost ([::1]:40588 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtKTE-000166-GN for incoming@patchwork.ozlabs.org; Fri, 03 Feb 2012 09:50:36 -0500 Received: from eggs.gnu.org ([140.186.70.92]:46244) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtKSO-0007z3-TH for qemu-devel@nongnu.org; Fri, 03 Feb 2012 09:49:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RtKSF-0001Vg-Tk for qemu-devel@nongnu.org; Fri, 03 Feb 2012 09:49:44 -0500 Received: from afflict.kos.to ([92.243.29.197]:49807) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RtKSF-0001Uj-Ip for qemu-devel@nongnu.org; Fri, 03 Feb 2012 09:49:35 -0500 Received: by afflict.kos.to (Postfix, from userid 1000) id 864BC26539; Fri, 3 Feb 2012 14:49:32 +0000 (UTC) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 3 Feb 2012 16:49:27 +0200 Message-Id: X-Mailer: git-send-email 1.7.1 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 92.243.29.197 Cc: Peter Maydell Subject: [Qemu-devel] [PATCH 14/19] linux-user: Implement *listxattr syscalls X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Peter Maydell Implement listxattr, flistxattr and llistxattr syscalls. Signed-off-by: Peter Maydell Signed-off-by: Riku Voipio --- 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 762115b..ee8899e 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7798,9 +7798,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: {