From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: riku.voipio@linaro.org Date: Fri, 3 Feb 2012 16:49:27 +0200 Message-Id: In-Reply-To: References: Subject: [Qemu-devel] [PATCH 14/19] linux-user: Implement *listxattr syscalls List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell 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: { -- 1.7.5.4