[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 04/11] linux-user: Add support for ustat() syscal
From: |
Aleksandar Markovic |
Subject: |
[Qemu-devel] [PATCH v4 04/11] linux-user: Add support for ustat() syscall |
Date: |
Wed, 14 Sep 2016 17:22:02 +0200 |
From: Aleksandar Markovic <address@hidden>
This patch implements Qemu user mode ustat() syscall support.
Syscall ustat() returns information about a mounted filesystem.
The implementation is similar to the implementations of statfs(),
fstatfs() and other related syscalls. It is based on invocation of
host's ustat(), and its key part is in the correspondent case segment
of the main switch statement of the function do_syscall(), in file
linux-user/syscalls.c. All necessary conversions of data structures
from target to host and from host to target are covered. Sufficient
support for "-strace" option for this syscall is already present,
and this patch does not change it.
This patch also fixes failures of LTP tests ustat01, and ustat02, if
executed on Qemu-emulated systems.
Signed-off-by: Aleksandar Markovic <address@hidden>
---
linux-user/syscall.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 3436ee6..7f8ae41 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -48,6 +48,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
#include <sys/shm.h>
#include <sys/sem.h>
#include <sys/statfs.h>
+#include <ustat.h>
#include <utime.h>
#include <sys/sysinfo.h>
#include <sys/signalfd.h>
@@ -8098,7 +8099,29 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
break;
#ifdef TARGET_NR_ustat
case TARGET_NR_ustat:
- goto unimplemented;
+ {
+ struct ustat ust;
+ int cnt;
+ ret = get_errno(ustat(arg1, &ust));
+
+ if (!is_error(ret)) {
+ struct ustat *target_ust;
+
+ if (!lock_user_struct(VERIFY_WRITE, target_ust, arg2, 0)) {
+ goto efault;
+ }
+
+ __put_user(ust.f_tfree, &target_ust->f_tfree);
+ __put_user(ust.f_tinode, &target_ust->f_tinode);
+
+ for (cnt = 0; cnt < 6; cnt++) {
+ __put_user(ust.f_fname[cnt], &target_ust->f_fname[cnt]);
+ __put_user(ust.f_fpack[cnt], &target_ust->f_fpack[cnt]);
+ }
+ unlock_user_struct(target_ust, arg2, 1);
+ }
+ break;
+ }
#endif
#ifdef TARGET_NR_dup2
case TARGET_NR_dup2:
--
2.9.3
- [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 01/11] linux-user: Add support for adjtimex() syscall, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 02/11] linux-user: Add support for clock_adjtime() syscall, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 03/11] linux-user: Add support for sysfs() syscall, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 04/11] linux-user: Add support for ustat() syscall,
Aleksandar Markovic <=
- [Qemu-devel] [PATCH v4 05/11] linux-user: Fix msgrcv() and msgsnd() syscalls support, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 06/11] linux-user: Fix socketcall() syscall support, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 07/11] linux-user: Fix syslog() syscall support, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 08/11] linux-user: Remove tabs and trailing spaces from linux-user/main.c, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 09/11] linux-user: Improve braces-related formatting in linux-user/main.c, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 10/11] linux-user: Improve usage of spaces in linux-user/main.c, Aleksandar Markovic, 2016/09/14
- [Qemu-devel] [PATCH v4 11/11] linux-user: Remove a duplicate item from strace.list, Aleksandar Markovic, 2016/09/14
- Re: [Qemu-devel] [PATCH v4 00/11] linux user: Fix assorted Qemu user mode issues, Peter Maydell, 2016/09/14