diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2011-12-14 15:37:19 +0000 |
---|---|---|
committer | Riku Voipio <riku.voipio@linaro.org> | 2012-02-02 17:51:20 +0200 |
commit | fb5590f7f5a897fc8e2ff36051fa0aa917ef4053 (patch) | |
tree | 78e49c61fed84e13038d716358a49858a324b6cb /linux-user/syscall.c | |
parent | 30297b55f797e5b74d1823b64c52b1bebd2a5d85 (diff) | |
download | hqemu-fb5590f7f5a897fc8e2ff36051fa0aa917ef4053.zip hqemu-fb5590f7f5a897fc8e2ff36051fa0aa917ef4053.tar.gz |
linux-user: Implement *listxattr syscalls
Implement listxattr, flistxattr and llistxattr syscalls.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r-- | 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: { |