From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:44550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RarC1-0008Sw-Ae for qemu-devel@nongnu.org; Wed, 14 Dec 2011 10:56:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RarC0-0007m9-6O for qemu-devel@nongnu.org; Wed, 14 Dec 2011 10:56:29 -0500 Received: from mnementh.archaic.org.uk ([81.2.115.146]:46705) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RarBz-0007m5-DT for qemu-devel@nongnu.org; Wed, 14 Dec 2011 10:56:28 -0500 From: Peter Maydell Date: Wed, 14 Dec 2011 15:37:19 +0000 Message-Id: <1323877039-19891-4-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1323877039-19891-1-git-send-email-peter.maydell@linaro.org> References: <1323877039-19891-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 3/3] linux-user: Implement *listxattr syscalls List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Riku Voipio , patches@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: { -- 1.7.5.4