* [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues
@ 2016-09-22 16:56 Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 01/10] linux-user: Add support for adjtimex() syscall Aleksandar Markovic
` (11 more replies)
0 siblings, 12 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2016-09-22 16:56 UTC (permalink / raw)
To: qemu-devel, riku.voipio, laurent, peter.maydell, petar.jovanovic,
miodrag.dinic, aleksandar.rikalo, aleksandar.markovic
From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
v6->v7:
- rebased to the latest code (there was a large linux-user change since
v6, consisting of 26 patches)
- slightly changed order of patches
- changed PATH_MAX to 128 in sysfs() patch (last remaining item
that was supposed to be in the previous version)
v5->v6:
- rebased to the latest code
- reworked all patches according to review feedback
- added two new patches on syncfs() and mq_open()
- some improvements in commit messages
v4->v5:
- removed three cleanup patches
v3->v4:
- rebased to the latest code
- added patch on clock_adjtime() support
- minor commit messages improvements
v2->v3:
- rebased to the latest code
- merged patches on adjtimex(), sysfs(), and ustat() from another series
- added patch on socketcall() support
- cleanup patches reorganized
v1->v2:
- improved usage of "#ifdefs" in patch on syslog()
- removed EIDRM-related code from patch on msgrcv(), since this error
code is already handled well
- added three cleanup patches
(v1 for some reason did not appear on qemu-devel, but mails are sent)
This series fixes certain Qemu user mode issues. The fixes mainly originate
from observation of LTP tests failures for execution in Qemu user mode on
various platforms. The series also contains a cleanup patch.
Aleksandar Markovic (10):
linux-user: Add support for adjtimex() syscall
linux-user: Add support for clock_adjtime() syscall
linux-user: Add support for syncfs() syscall
linux-user: Add support for sysfs() syscall
linux-user: Add support for ustat() syscall
linux-user: Fix mq_open() syscall support
linux-user: Fix msgrcv() and msgsnd() syscalls support
linux-user: Fix socketcall() syscall support
linux-user: Fix syslog() syscall support
linux-user: Remove a duplicate item from strace.list
linux-user/strace.c | 260 ++++++++++++++++++++++++++++++---
linux-user/strace.list | 13 +-
linux-user/syscall.c | 358 ++++++++++++++++++++++++++++++++++++----------
linux-user/syscall_defs.h | 101 ++++++++++---
4 files changed, 612 insertions(+), 120 deletions(-)
--
2.9.3
^ permalink raw reply [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v7 01/10] linux-user: Add support for adjtimex() syscall
2016-09-22 16:56 [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Aleksandar Markovic
@ 2016-09-22 16:56 ` Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 02/10] linux-user: Add support for clock_adjtime() syscall Aleksandar Markovic
` (10 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2016-09-22 16:56 UTC (permalink / raw)
To: qemu-devel, riku.voipio, laurent, peter.maydell, petar.jovanovic,
miodrag.dinic, aleksandar.rikalo, aleksandar.markovic
From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
This patch implements Qemu user mode adjtimex() syscall support.
Syscall adjtimex() reads and optionally sets parameters for a clock
adjustment algorithm used in network synchonization or similar scenarios.
Its declaration is:
int adjtimex(struct timex *buf);
The correspondent source code in the Linux kernel is at kernel/time.c,
line 206.
The Qemu implementation is based on invocation of host's adjtimex(), and
its key part is in the "TARGET_NR_adjtimex" case segment of the the main
switch statement of the function do_syscall(), in linux-user/syscalls.c. All
necessary conversions of the data structures from target to host and from
host to target are covered. Two new functions, target_to_host_timex() and
host_to_target_timex(), are provided for the purpose of such conversions.
For that purpose, the support for related structure "timex" had tp be added
to the file linux-user/syscall_defs.h, based on its definition in Linux
kernel. Also, the relevant support for "-strace" Qemu option is included
in files linux-user/strace.c and linux-user/strace.list.
This patch also fixes failures of LTP tests adjtimex01 and adjtimex02, if
executed in Qemu user mode.
Signed-off-by: Aleksandar Rikalo <aleksandar.rikalo@imgtec.com>
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
linux-user/strace.c | 46 +++++++++++++++++++++++++
linux-user/strace.list | 3 +-
linux-user/syscall.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++-
linux-user/syscall_defs.h | 28 +++++++++++++++
4 files changed, 162 insertions(+), 2 deletions(-)
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 1e51360..f37b386 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -577,6 +577,52 @@ print_syscall_ret_newselect(const struct syscallname *name, abi_long ret)
}
#endif
+/* special meanings of adjtimex()' non-negative return values */
+#define TARGET_TIME_OK 0 /* clock synchronized, no leap second */
+#define TARGET_TIME_INS 1 /* insert leap second */
+#define TARGET_TIME_DEL 2 /* delete leap second */
+#define TARGET_TIME_OOP 3 /* leap second in progress */
+#define TARGET_TIME_WAIT 4 /* leap second has occurred */
+#define TARGET_TIME_ERROR 5 /* clock not synchronized */
+static void
+print_syscall_ret_adjtimex(const struct syscallname *name, abi_long ret)
+{
+ const char *errstr = NULL;
+
+ gemu_log(" = ");
+ if (ret < 0) {
+ gemu_log("-1 errno=%d", errno);
+ errstr = target_strerror(-ret);
+ if (errstr) {
+ gemu_log(" (%s)", errstr);
+ }
+ } else {
+ gemu_log(TARGET_ABI_FMT_ld, ret);
+ switch (ret) {
+ case TARGET_TIME_OK:
+ gemu_log(" TIME_OK (clock synchronized, no leap second)");
+ break;
+ case TARGET_TIME_INS:
+ gemu_log(" TIME_INS (insert leap second)");
+ break;
+ case TARGET_TIME_DEL:
+ gemu_log(" TIME_DEL (delete leap second)");
+ break;
+ case TARGET_TIME_OOP:
+ gemu_log(" TIME_OOP (leap second in progress)");
+ break;
+ case TARGET_TIME_WAIT:
+ gemu_log(" TIME_WAIT (leap second has occurred)");
+ break;
+ case TARGET_TIME_ERROR:
+ gemu_log(" TIME_ERROR (clock not synchronized)");
+ break;
+ }
+ }
+
+ gemu_log("\n");
+}
+
UNUSED static struct flags access_flags[] = {
FLAG_GENERIC(F_OK),
FLAG_GENERIC(R_OK),
diff --git a/linux-user/strace.list b/linux-user/strace.list
index aa967a2..44e8322 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -16,7 +16,8 @@
{ TARGET_NR_add_key, "add_key" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_adjtimex
-{ TARGET_NR_adjtimex, "adjtimex" , NULL, NULL, NULL },
+{ TARGET_NR_adjtimex, "adjtimex" , "%s(%p)", NULL,
+ print_syscall_ret_adjtimex },
#endif
#ifdef TARGET_NR_afs_syscall
{ TARGET_NR_afs_syscall, "afs_syscall" , NULL, NULL, NULL },
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 7aa2c1d..7ad5b96 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -35,6 +35,7 @@
#include <sys/swap.h>
#include <linux/capability.h>
#include <sched.h>
+#include <sys/timex.h>
#ifdef __ia64__
int __clone2(int (*fn)(void *), void *child_stack_base,
size_t stack_size, int flags, void *arg, ...);
@@ -6769,6 +6770,77 @@ static inline abi_long host_to_target_itimerspec(abi_ulong target_addr,
return 0;
}
+static inline abi_long target_to_host_timex(struct timex *host_tx,
+ abi_long target_addr)
+{
+ struct target_timex *target_tx;
+
+ if (!lock_user_struct(VERIFY_READ, target_tx, target_addr, 1)) {
+ return -TARGET_EFAULT;
+ }
+
+ __get_user(host_tx->modes, &target_tx->modes);
+ __get_user(host_tx->offset, &target_tx->offset);
+ __get_user(host_tx->freq, &target_tx->freq);
+ __get_user(host_tx->maxerror, &target_tx->maxerror);
+ __get_user(host_tx->esterror, &target_tx->esterror);
+ __get_user(host_tx->status, &target_tx->status);
+ __get_user(host_tx->constant, &target_tx->constant);
+ __get_user(host_tx->precision, &target_tx->precision);
+ __get_user(host_tx->tolerance, &target_tx->tolerance);
+ __get_user(host_tx->time.tv_sec, &target_tx->time.tv_sec);
+ __get_user(host_tx->time.tv_usec, &target_tx->time.tv_usec);
+ __get_user(host_tx->tick, &target_tx->tick);
+ __get_user(host_tx->ppsfreq, &target_tx->ppsfreq);
+ __get_user(host_tx->jitter, &target_tx->jitter);
+ __get_user(host_tx->shift, &target_tx->shift);
+ __get_user(host_tx->stabil, &target_tx->stabil);
+ __get_user(host_tx->jitcnt, &target_tx->jitcnt);
+ __get_user(host_tx->calcnt, &target_tx->calcnt);
+ __get_user(host_tx->errcnt, &target_tx->errcnt);
+ __get_user(host_tx->stbcnt, &target_tx->stbcnt);
+ __get_user(host_tx->tai, &target_tx->tai);
+
+ unlock_user_struct(target_tx, target_addr, 0);
+ return 0;
+}
+
+static inline abi_long host_to_target_timex(abi_long target_addr,
+ struct timex *host_tx)
+{
+ struct target_timex *target_tx;
+
+ if (!lock_user_struct(VERIFY_WRITE, target_tx, target_addr, 0)) {
+ return -TARGET_EFAULT;
+ }
+
+ __put_user(host_tx->modes, &target_tx->modes);
+ __put_user(host_tx->offset, &target_tx->offset);
+ __put_user(host_tx->freq, &target_tx->freq);
+ __put_user(host_tx->maxerror, &target_tx->maxerror);
+ __put_user(host_tx->esterror, &target_tx->esterror);
+ __put_user(host_tx->status, &target_tx->status);
+ __put_user(host_tx->constant, &target_tx->constant);
+ __put_user(host_tx->precision, &target_tx->precision);
+ __put_user(host_tx->tolerance, &target_tx->tolerance);
+ __put_user(host_tx->time.tv_sec, &target_tx->time.tv_sec);
+ __put_user(host_tx->time.tv_usec, &target_tx->time.tv_usec);
+ __put_user(host_tx->tick, &target_tx->tick);
+ __put_user(host_tx->ppsfreq, &target_tx->ppsfreq);
+ __put_user(host_tx->jitter, &target_tx->jitter);
+ __put_user(host_tx->shift, &target_tx->shift);
+ __put_user(host_tx->stabil, &target_tx->stabil);
+ __put_user(host_tx->jitcnt, &target_tx->jitcnt);
+ __put_user(host_tx->calcnt, &target_tx->calcnt);
+ __put_user(host_tx->errcnt, &target_tx->errcnt);
+ __put_user(host_tx->stbcnt, &target_tx->stbcnt);
+ __put_user(host_tx->tai, &target_tx->tai);
+
+ unlock_user_struct(target_tx, target_addr, 1);
+ return 0;
+}
+
+
static inline abi_long target_to_host_sigevent(struct sigevent *host_sevp,
abi_ulong target_addr)
{
@@ -9537,7 +9609,20 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#endif
#endif
case TARGET_NR_adjtimex:
- goto unimplemented;
+ {
+ struct timex host_buf;
+
+ if (target_to_host_timex(&host_buf, arg1) != 0) {
+ goto efault;
+ }
+ ret = get_errno(adjtimex(&host_buf));
+ if (!is_error(ret)) {
+ if (host_to_target_timex(arg1, &host_buf) != 0) {
+ goto efault;
+ }
+ }
+ }
+ break;
#ifdef TARGET_NR_create_module
case TARGET_NR_create_module:
#endif
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 5c19c5c..e47a61a 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -207,6 +207,34 @@ struct target_itimerspec {
struct target_timespec it_value;
};
+struct target_timex {
+ abi_uint modes; /* Mode selector */
+ abi_long offset; /* Time offset */
+ abi_long freq; /* Frequency offset */
+ abi_long maxerror; /* Maximum error (microseconds) */
+ abi_long esterror; /* Estimated error (microseconds) */
+ abi_int status; /* Clock command/status */
+ abi_long constant; /* PLL (phase-locked loop) time constant */
+ abi_long precision; /* Clock precision (microseconds, ro) */
+ abi_long tolerance; /* Clock freq. tolerance (ppm, ro) */
+ struct target_timeval time; /* Current time */
+ abi_long tick; /* Microseconds between clock ticks */
+ abi_long ppsfreq; /* PPS (pulse per second) frequency */
+ abi_long jitter; /* PPS jitter (ro); nanoseconds */
+ abi_int shift; /* PPS interval duration (seconds) */
+ abi_long stabil; /* PPS stability */
+ abi_long jitcnt; /* PPS jitter limit exceeded (ro) */
+ abi_long calcnt; /* PPS calibration intervals */
+ abi_long errcnt; /* PPS calibration errors */
+ abi_long stbcnt; /* PPS stability limit exceeded */
+ abi_int tai; /* TAI offset */
+
+ /* Further padding bytes to allow for future expansion */
+ abi_int:32; abi_int:32; abi_int:32; abi_int:32;
+ abi_int:32; abi_int:32; abi_int:32; abi_int:32;
+ abi_int:32; abi_int:32; abi_int:32;
+};
+
typedef abi_long target_clock_t;
#define TARGET_HZ 100
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v7 02/10] linux-user: Add support for clock_adjtime() syscall
2016-09-22 16:56 [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 01/10] linux-user: Add support for adjtimex() syscall Aleksandar Markovic
@ 2016-09-22 16:56 ` Aleksandar Markovic
2016-10-07 13:03 ` Riku Voipio
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 03/10] linux-user: Add support for syncfs() syscall Aleksandar Markovic
` (9 subsequent siblings)
11 siblings, 1 reply; 20+ messages in thread
From: Aleksandar Markovic @ 2016-09-22 16:56 UTC (permalink / raw)
To: qemu-devel, riku.voipio, laurent, peter.maydell, petar.jovanovic,
miodrag.dinic, aleksandar.rikalo, aleksandar.markovic
From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
This patch implements Qemu user mode clock_adjtime() syscall support.
The implementation is based on invocation of host's clock_adjtime(), and is
very similar to the implementation of adjtimex() syscall support. The main
difference is the presence of "clockid_t" argument in clock_adjtime().
Signed-off-by: Aleksandar Rikalo <aleksandar.rikalo@imgtec.com>
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
linux-user/strace.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++
linux-user/strace.list | 3 ++
linux-user/syscall.c | 17 +++++++++++
3 files changed, 96 insertions(+)
diff --git a/linux-user/strace.c b/linux-user/strace.c
index f37b386..a61717d 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -435,6 +435,69 @@ print_fdset(int n, abi_ulong target_fds_addr)
}
#endif
+#ifdef TARGET_NR_clock_adjtime
+/* IDs of the various system clocks */
+#define TARGET_CLOCK_REALTIME 0
+#define TARGET_CLOCK_MONOTONIC 1
+#define TARGET_CLOCK_PROCESS_CPUTIME_ID 2
+#define TARGET_CLOCK_THREAD_CPUTIME_ID 3
+#define TARGET_CLOCK_MONOTONIC_RAW 4
+#define TARGET_CLOCK_REALTIME_COARSE 5
+#define TARGET_CLOCK_MONOTONIC_COARSE 6
+#define TARGET_CLOCK_BOOTTIME 7
+#define TARGET_CLOCK_REALTIME_ALARM 8
+#define TARGET_CLOCK_BOOTTIME_ALARM 9
+#define TARGET_CLOCK_SGI_CYCLE 10
+#define TARGET_CLOCK_TAI 11
+
+static void
+print_clockid(int clockid, int last)
+{
+ switch (clockid) {
+ case TARGET_CLOCK_REALTIME:
+ gemu_log("CLOCK_REALTIME");
+ break;
+ case TARGET_CLOCK_MONOTONIC:
+ gemu_log("CLOCK_MONOTONIC");
+ break;
+ case TARGET_CLOCK_PROCESS_CPUTIME_ID:
+ gemu_log("CLOCK_PROCESS_CPUTIME_ID");
+ break;
+ case TARGET_CLOCK_THREAD_CPUTIME_ID:
+ gemu_log("CLOCK_THREAD_CPUTIME_ID");
+ break;
+ case TARGET_CLOCK_MONOTONIC_RAW:
+ gemu_log("CLOCK_MONOTONIC_RAW");
+ break;
+ case TARGET_CLOCK_REALTIME_COARSE:
+ gemu_log("CLOCK_REALTIME_COARSE");
+ break;
+ case TARGET_CLOCK_MONOTONIC_COARSE:
+ gemu_log("CLOCK_MONOTONIC_COARSE");
+ break;
+ case TARGET_CLOCK_BOOTTIME:
+ gemu_log("CLOCK_BOOTTIME");
+ break;
+ case TARGET_CLOCK_REALTIME_ALARM:
+ gemu_log("CLOCK_REALTIME_ALARM");
+ break;
+ case TARGET_CLOCK_BOOTTIME_ALARM:
+ gemu_log("CLOCK_BOOTTIME_ALARM");
+ break;
+ case TARGET_CLOCK_SGI_CYCLE:
+ gemu_log("CLOCK_SGI_CYCLE");
+ break;
+ case TARGET_CLOCK_TAI:
+ gemu_log("CLOCK_TAI");
+ break;
+ default:
+ gemu_log("%d", clockid);
+ break;
+ }
+ gemu_log("%s", get_comma(last));
+}
+#endif
+
/*
* Sysycall specific output functions
*/
@@ -1096,6 +1159,19 @@ print_chmod(const struct syscallname *name,
}
#endif
+#ifdef TARGET_NR_clock_adjtime
+static void
+print_clock_adjtime(const struct syscallname *name,
+ abi_long arg0, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5)
+{
+ print_syscall_prologue(name);
+ print_clockid(arg0, 0);
+ print_pointer(arg1, 1);
+ print_syscall_epilogue(name);
+}
+#endif
+
#ifdef TARGET_NR_clone
static void do_print_clone(unsigned int flags, abi_ulong newsp,
abi_ulong parent_tidptr, target_ulong newtls,
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 44e8322..01aecfc 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -73,6 +73,9 @@
#ifdef TARGET_NR_chroot
{ TARGET_NR_chroot, "chroot" , NULL, NULL, NULL },
#endif
+#ifdef TARGET_NR_clock_adjtime
+{ TARGET_NR_clock_adjtime, "clock_adjtime" , NULL, print_clock_adjtime, NULL },
+#endif
#ifdef TARGET_NR_clock_getres
{ TARGET_NR_clock_getres, "clock_getres" , NULL, NULL, NULL },
#endif
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 7ad5b96..9f11ca2 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9623,6 +9623,23 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
}
}
break;
+#if defined(TARGET_NR_clock_adjtime)
+ case TARGET_NR_clock_adjtime:
+ {
+ struct timex host_buf;
+
+ if (target_to_host_timex(&host_buf, arg2) != 0) {
+ goto efault;
+ }
+ ret = get_errno(clock_adjtime(arg1, &host_buf));
+ if (!is_error(ret)) {
+ if (host_to_target_timex(arg2, &host_buf) != 0) {
+ goto efault;
+ }
+ }
+ }
+ break;
+#endif
#ifdef TARGET_NR_create_module
case TARGET_NR_create_module:
#endif
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v7 03/10] linux-user: Add support for syncfs() syscall
2016-09-22 16:56 [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 01/10] linux-user: Add support for adjtimex() syscall Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 02/10] linux-user: Add support for clock_adjtime() syscall Aleksandar Markovic
@ 2016-09-22 16:56 ` Aleksandar Markovic
2016-10-07 13:06 ` Riku Voipio
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 04/10] linux-user: Add support for sysfs() syscall Aleksandar Markovic
` (8 subsequent siblings)
11 siblings, 1 reply; 20+ messages in thread
From: Aleksandar Markovic @ 2016-09-22 16:56 UTC (permalink / raw)
To: qemu-devel, riku.voipio, laurent, peter.maydell, petar.jovanovic,
miodrag.dinic, aleksandar.rikalo, aleksandar.markovic
From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
This patch implements syncfs() syscall support. The implementation
consists of a straightforward invocation of host's syncfs() only.
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
linux-user/syscall.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 9f11ca2..1af3e10 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8069,6 +8069,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
sync();
ret = 0;
break;
+#if defined(TARGET_NR_syncfs)
+ case TARGET_NR_syncfs:
+ ret = get_errno(syncfs(arg1));
+ break;
+#endif
case TARGET_NR_kill:
ret = get_errno(safe_kill(arg1, target_to_host_signal(arg2)));
break;
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v7 04/10] linux-user: Add support for sysfs() syscall
2016-09-22 16:56 [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Aleksandar Markovic
` (2 preceding siblings ...)
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 03/10] linux-user: Add support for syncfs() syscall Aleksandar Markovic
@ 2016-09-22 16:56 ` Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 05/10] linux-user: Add support for ustat() syscall Aleksandar Markovic
` (7 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2016-09-22 16:56 UTC (permalink / raw)
To: qemu-devel, riku.voipio, laurent, peter.maydell, petar.jovanovic,
miodrag.dinic, aleksandar.rikalo, aleksandar.markovic
From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
This patch implements Qemu user mode sysfs() syscall support.
Syscall sysfs() involves returning information about the filesystem types
currently present in the kernel, and can operate in three distinct flavors,
depending on its first argument.
Its specific is that its declaration is threefold:
int sysfs(int option, const char *fsname);
int sysfs(int option, unsigned int fs_index, char *buf);
int sysfs(int option);
Its implementation in Linux kernel is at fs/filesystems.c, line 184.
The implementation in Qemu user mode is based on invocation of host's sysfs(),
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. Based on the value of the first argument, three
cases are distinguished, and such conversions are implemented separately
for each case. Relevant support for "-strace" option is included in files
linux-user/strace.c and linux-user/strace.list.
This patch also fixes failures of LTP tests sysfs01, sysfs02, sysfs03,
sysfs04, sysfs05, and sysfs06, if executed in Qemu user mode.
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
linux-user/strace.c | 27 +++++++++++++++++++++++++++
linux-user/strace.list | 2 +-
linux-user/syscall.c | 39 ++++++++++++++++++++++++++++++++++++---
3 files changed, 64 insertions(+), 4 deletions(-)
diff --git a/linux-user/strace.c b/linux-user/strace.c
index a61717d..772711b 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -2342,6 +2342,33 @@ print_kill(const struct syscallname *name,
}
#endif
+#ifdef TARGET_NR_sysfs
+static void
+print_sysfs(const struct syscallname *name,
+ abi_long arg0, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5)
+{
+ print_syscall_prologue(name);
+ /* arg0 is normally 1, 2, or 3 */
+ switch (arg0) {
+ case 1:
+ print_raw_param("%d", arg0, 0);
+ print_string(arg1, 1);
+ break;
+ case 2:
+ print_raw_param("%d", arg0, 0);
+ print_raw_param("%u", arg1, 0);
+ print_pointer(arg2, 1);
+ break;
+ /* if arg0 is 3, desired output is the same as default */
+ default:
+ print_raw_param("%d", arg0, 1);
+ break;
+ }
+ print_syscall_epilogue(name);
+}
+#endif
+
/*
* An array of all of the syscalls we know about
*/
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 01aecfc..38139ba 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -1372,7 +1372,7 @@
{ TARGET_NR_sys_epoll_wait, "sys_epoll_wait" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_sysfs
-{ TARGET_NR_sysfs, "sysfs" , NULL, NULL, NULL },
+{ TARGET_NR_sysfs, "sysfs" , NULL, print_sysfs, NULL },
#endif
#ifdef TARGET_NR_sysinfo
{ TARGET_NR_sysinfo, "sysinfo" , NULL, NULL, NULL },
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1af3e10..563796a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -7450,7 +7450,7 @@ static int do_openat(void *cpu_env, int dirfd, const char *pathname, int flags,
if (fake_open->filename) {
const char *tmpdir;
- char filename[PATH_MAX];
+ char filename[128];
int fd, r;
/* create temporary file to map stat to */
@@ -9666,9 +9666,42 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
case TARGET_NR_bdflush:
goto unimplemented;
#endif
-#ifdef TARGET_NR_sysfs
+#if defined(TARGET_NR_sysfs)
case TARGET_NR_sysfs:
- goto unimplemented;
+ switch (arg1) {
+ case 1:
+ {
+ p = lock_user_string(arg2);
+ if (!p) {
+ goto efault;
+ }
+ ret = get_errno(syscall(__NR_sysfs, arg1, p));
+ unlock_user(p, arg2, 0);
+ }
+ break;
+ case 2:
+ {
+ char buf[PATH_MAX];
+ memset(buf, 0, PATH_MAX);
+ ret = get_errno(syscall(__NR_sysfs, arg1, arg2, buf));
+ if (!is_error(ret)) {
+ int len = PATH_MAX;
+ if (len > strlen(buf)) {
+ len = strlen(buf);
+ }
+ if (copy_to_user(arg3, buf, len) != 0) {
+ goto efault;
+ }
+ }
+ }
+ break;
+ case 3:
+ ret = get_errno(syscall(__NR_sysfs, arg1));
+ break;
+ default:
+ ret = -EINVAL;
+ }
+ break;
#endif
case TARGET_NR_personality:
ret = get_errno(personality(arg1));
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v7 05/10] linux-user: Add support for ustat() syscall
2016-09-22 16:56 [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Aleksandar Markovic
` (3 preceding siblings ...)
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 04/10] linux-user: Add support for sysfs() syscall Aleksandar Markovic
@ 2016-09-22 16:56 ` Aleksandar Markovic
2016-10-21 17:04 ` Riku Voipio
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 06/10] linux-user: Fix mq_open() syscall support Aleksandar Markovic
` (6 subsequent siblings)
11 siblings, 1 reply; 20+ messages in thread
From: Aleksandar Markovic @ 2016-09-22 16:56 UTC (permalink / raw)
To: qemu-devel, riku.voipio, laurent, peter.maydell, petar.jovanovic,
miodrag.dinic, aleksandar.rikalo, aleksandar.markovic
From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
This patch implements Qemu user mode ustat() syscall support.
Syscall ustat() returns information about a mounted filesystem.
Its declaration is:
int ustat(dev_t dev, struct ustat *ubuf);
Its Linux kernel implementation is at fs/compat.c, line 334.
The Qemu implementation proposed in this patch is similar to the
Qemu 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. Support for target_ustat is included. 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 <aleksandar.markovic@imgtec.com>
---
linux-user/syscall.c | 23 +++++++++++++++++++++--
linux-user/syscall_defs.h | 6 ++++++
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 563796a..d28f3e6 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>
@@ -8226,9 +8227,27 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
ret = get_errno(chroot(p));
unlock_user(p, arg1, 0);
break;
-#ifdef TARGET_NR_ustat
+#if defined(TARGET_NR_ustat)
case TARGET_NR_ustat:
- goto unimplemented;
+ {
+ struct ustat ust;
+
+ ret = get_errno(ustat(arg1, &ust));
+ if (!is_error(ret)) {
+ struct target_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);
+ memcpy(target_ust->f_fname, ust.f_fname, 6);
+ memcpy(target_ust->f_fpack, ust.f_fpack, 6);
+ unlock_user_struct(target_ust, arg2, 1);
+ }
+ }
+ break;
+
#endif
#ifdef TARGET_NR_dup2
case TARGET_NR_dup2:
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index e47a61a..2c183d1 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2164,6 +2164,12 @@ struct target_statfs64 {
};
#endif
+struct target_ustat {
+ abi_ulong f_tfree;
+ abi_int f_tinode;
+ char f_fname[6];
+ char f_fpack[6];
+};
#define TARGET_F_DUPFD 0 /* dup */
#define TARGET_F_GETFD 1 /* get close_on_exec */
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v7 06/10] linux-user: Fix mq_open() syscall support
2016-09-22 16:56 [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Aleksandar Markovic
` (4 preceding siblings ...)
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 05/10] linux-user: Add support for ustat() syscall Aleksandar Markovic
@ 2016-09-22 16:56 ` Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 07/10] linux-user: Fix msgrcv() and msgsnd() syscalls support Aleksandar Markovic
` (5 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2016-09-22 16:56 UTC (permalink / raw)
To: qemu-devel, riku.voipio, laurent, peter.maydell, petar.jovanovic,
miodrag.dinic, aleksandar.rikalo, aleksandar.markovic
From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
Conversion of file creation flags (O_CREAT, ...) from target to host
was missing.
Also, this patch implements better error handling.
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
linux-user/syscall.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index d28f3e6..d89f21b 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -11525,16 +11525,18 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#if defined(TARGET_NR_mq_open) && defined(__NR_mq_open)
case TARGET_NR_mq_open:
{
- struct mq_attr posix_mq_attr, *attrp;
+ struct mq_attr posix_mq_attr;
+ int host_flags;
+ host_flags = target_to_host_bitmask(arg2, fcntl_flags_tbl);
+ if (copy_from_user_mq_attr(&posix_mq_attr, arg4) != 0) {
+ goto efault;
+ }
p = lock_user_string(arg1 - 1);
- if (arg4 != 0) {
- copy_from_user_mq_attr (&posix_mq_attr, arg4);
- attrp = &posix_mq_attr;
- } else {
- attrp = 0;
+ if (!p) {
+ goto efault;
}
- ret = get_errno(mq_open(p, arg2, arg3, attrp));
+ ret = get_errno(mq_open(p, host_flags, arg3, &posix_mq_attr));
unlock_user (p, arg1, 0);
}
break;
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v7 07/10] linux-user: Fix msgrcv() and msgsnd() syscalls support
2016-09-22 16:56 [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Aleksandar Markovic
` (5 preceding siblings ...)
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 06/10] linux-user: Fix mq_open() syscall support Aleksandar Markovic
@ 2016-09-22 16:56 ` Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 08/10] linux-user: Fix socketcall() syscall support Aleksandar Markovic
` (4 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2016-09-22 16:56 UTC (permalink / raw)
To: qemu-devel, riku.voipio, laurent, peter.maydell, petar.jovanovic,
miodrag.dinic, aleksandar.rikalo, aleksandar.markovic
From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
If syscalls msgrcv() and msgsnd() fail, they return E2BIG, EACCES,
EAGAIN, EFAULT, EIDRM, EINTR, EINVAL, ENOMEM, or ENOMSG.
By examining negative scenarios of these syscalls for Mips, it was
established that ENOMSG does not have the same value accross all
platforms, but it is nevertheless not included for conversion in
the correspondant conversion table defined in linux-user/syscall.c.
This is certainly a bug, since it leads to the incorrect emulation
of msgrcv() and msgsnd() for scenarios involving ENOMSG.
This patch fixes this by extending the conversion table to include
ENOMSG.
Also, LTP test msgrcv04 will be fixed for some platforms.
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/syscall.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index d89f21b..eee9707 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -789,6 +789,9 @@ static uint16_t host_to_target_errno_table[ERRNO_TABLE_SIZE] = {
#ifdef ENOTRECOVERABLE
[ENOTRECOVERABLE] = TARGET_ENOTRECOVERABLE,
#endif
+#ifdef ENOMSG
+ [ENOMSG] = TARGET_ENOMSG,
+#endif
};
static inline int host_to_target_errno(int err)
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v7 08/10] linux-user: Fix socketcall() syscall support
2016-09-22 16:56 [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Aleksandar Markovic
` (6 preceding siblings ...)
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 07/10] linux-user: Fix msgrcv() and msgsnd() syscalls support Aleksandar Markovic
@ 2016-09-22 16:56 ` Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 09/10] linux-user: Fix syslog() " Aleksandar Markovic
` (3 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2016-09-22 16:56 UTC (permalink / raw)
To: qemu-devel, riku.voipio, laurent, peter.maydell, petar.jovanovic,
miodrag.dinic, aleksandar.rikalo, aleksandar.markovic
From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
Since not all Linux host platforms support socketcall() (most notably
Intel), do_socketcall() function in Qemu's syscalls.c is implemented to
mirror the corespondant implementation of socketcall() in Linux kernel,
and to utilise individual socket operations that are supported on all
Linux platforms. (see kernel source file net/socket.c, definition of
socketcall).
However, error codes produced by Qemu implementation are wrong for the
cases of invalid values of the first argument. Also, naming of constants
is not consistent with kernel one, and not consistant with Qemu convention
of prefixing such constants with "TARGET_". This patch in that light
brings do_socketcall() closer to its kernel counterpart, and in that way
fixes the errors and yields more consisrtent Qemu code.
There were also three missing cases (among 20) for strace support for
socketcall(). The array that contains pointers for appropriate printing
functions is updated with 3 elements, however pointers to functions are
left NULL, and its implementation is left for future.
Also, this patch fixes failure of LTP test socketcall02, if executed on some
Qemu emulated sywstems (uer mode).
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
linux-user/strace.c | 39 ++++++++-------
linux-user/syscall.c | 119 ++++++++++++++++++++++++----------------------
linux-user/syscall_defs.h | 42 ++++++++--------
3 files changed, 105 insertions(+), 95 deletions(-)
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 772711b..1922cb4 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -1751,29 +1751,32 @@ print_optint:
}
#define PRINT_SOCKOP(name, func) \
- [SOCKOP_##name] = { #name, func }
+ [TARGET_SYS_##name] = { #name, func }
static struct {
const char *name;
void (*print)(const char *, abi_long);
} scall[] = {
- PRINT_SOCKOP(socket, do_print_socket),
- PRINT_SOCKOP(bind, do_print_sockaddr),
- PRINT_SOCKOP(connect, do_print_sockaddr),
- PRINT_SOCKOP(listen, do_print_listen),
- PRINT_SOCKOP(accept, do_print_sockaddr),
- PRINT_SOCKOP(getsockname, do_print_sockaddr),
- PRINT_SOCKOP(getpeername, do_print_sockaddr),
- PRINT_SOCKOP(socketpair, do_print_socketpair),
- PRINT_SOCKOP(send, do_print_sendrecv),
- PRINT_SOCKOP(recv, do_print_sendrecv),
- PRINT_SOCKOP(sendto, do_print_msgaddr),
- PRINT_SOCKOP(recvfrom, do_print_msgaddr),
- PRINT_SOCKOP(shutdown, do_print_shutdown),
- PRINT_SOCKOP(sendmsg, do_print_msg),
- PRINT_SOCKOP(recvmsg, do_print_msg),
- PRINT_SOCKOP(setsockopt, do_print_sockopt),
- PRINT_SOCKOP(getsockopt, do_print_sockopt),
+ PRINT_SOCKOP(SOCKET, do_print_socket),
+ PRINT_SOCKOP(BIND, do_print_sockaddr),
+ PRINT_SOCKOP(CONNECT, do_print_sockaddr),
+ PRINT_SOCKOP(LISTEN, do_print_listen),
+ PRINT_SOCKOP(ACCEPT, do_print_sockaddr),
+ PRINT_SOCKOP(GETSOCKNAME, do_print_sockaddr),
+ PRINT_SOCKOP(GETPEERNAME, do_print_sockaddr),
+ PRINT_SOCKOP(SOCKETPAIR, do_print_socketpair),
+ PRINT_SOCKOP(SEND, do_print_sendrecv),
+ PRINT_SOCKOP(RECV, do_print_sendrecv),
+ PRINT_SOCKOP(SENDTO, do_print_msgaddr),
+ PRINT_SOCKOP(RECVFROM, do_print_msgaddr),
+ PRINT_SOCKOP(SHUTDOWN, do_print_shutdown),
+ PRINT_SOCKOP(SETSOCKOPT, do_print_sockopt),
+ PRINT_SOCKOP(GETSOCKOPT, do_print_sockopt),
+ PRINT_SOCKOP(SENDMSG, do_print_msg),
+ PRINT_SOCKOP(RECVMSG, do_print_msg),
+ PRINT_SOCKOP(ACCEPT4, NULL),
+ PRINT_SOCKOP(RECVMMSG, NULL),
+ PRINT_SOCKOP(SENDMMSG, NULL),
};
static void
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index eee9707..65a76e4 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3897,89 +3897,94 @@ fail:
}
#ifdef TARGET_NR_socketcall
-/* do_socketcall() Must return target values and target errnos. */
+/* do_socketcall() must return target values and target errnos. */
static abi_long do_socketcall(int num, abi_ulong vptr)
{
- static const unsigned ac[] = { /* number of arguments per call */
- [SOCKOP_socket] = 3, /* domain, type, protocol */
- [SOCKOP_bind] = 3, /* sockfd, addr, addrlen */
- [SOCKOP_connect] = 3, /* sockfd, addr, addrlen */
- [SOCKOP_listen] = 2, /* sockfd, backlog */
- [SOCKOP_accept] = 3, /* sockfd, addr, addrlen */
- [SOCKOP_accept4] = 4, /* sockfd, addr, addrlen, flags */
- [SOCKOP_getsockname] = 3, /* sockfd, addr, addrlen */
- [SOCKOP_getpeername] = 3, /* sockfd, addr, addrlen */
- [SOCKOP_socketpair] = 4, /* domain, type, protocol, tab */
- [SOCKOP_send] = 4, /* sockfd, msg, len, flags */
- [SOCKOP_recv] = 4, /* sockfd, msg, len, flags */
- [SOCKOP_sendto] = 6, /* sockfd, msg, len, flags, addr, addrlen */
- [SOCKOP_recvfrom] = 6, /* sockfd, msg, len, flags, addr, addrlen */
- [SOCKOP_shutdown] = 2, /* sockfd, how */
- [SOCKOP_sendmsg] = 3, /* sockfd, msg, flags */
- [SOCKOP_recvmsg] = 3, /* sockfd, msg, flags */
- [SOCKOP_sendmmsg] = 4, /* sockfd, msgvec, vlen, flags */
- [SOCKOP_recvmmsg] = 4, /* sockfd, msgvec, vlen, flags */
- [SOCKOP_setsockopt] = 5, /* sockfd, level, optname, optval, optlen */
- [SOCKOP_getsockopt] = 5, /* sockfd, level, optname, optval, optlen */
+ static const unsigned nargs[] = { /* number of arguments per operation */
+ [TARGET_SYS_SOCKET] = 3, /* domain, type, protocol */
+ [TARGET_SYS_BIND] = 3, /* fd, addr, addrlen */
+ [TARGET_SYS_CONNECT] = 3, /* fd, addr, addrlen */
+ [TARGET_SYS_LISTEN] = 2, /* fd, backlog */
+ [TARGET_SYS_ACCEPT] = 3, /* fd, addr, addrlen */
+ [TARGET_SYS_GETSOCKNAME] = 3, /* fd, addr, addrlen */
+ [TARGET_SYS_GETPEERNAME] = 3, /* fd, addr, addrlen */
+ [TARGET_SYS_SOCKETPAIR] = 4, /* domain, type, protocol, tab */
+ [TARGET_SYS_SEND] = 4, /* fd, msg, len, flags */
+ [TARGET_SYS_RECV] = 4, /* fd, msg, len, flags */
+ [TARGET_SYS_SENDTO] = 6, /* fd, msg, len, flags, addr, addrlen */
+ [TARGET_SYS_RECVFROM] = 6, /* fd, msg, len, flags, addr, addrlen */
+ [TARGET_SYS_SHUTDOWN] = 2, /* fd, how */
+ [TARGET_SYS_SETSOCKOPT] = 5, /* fd, level, optname, optval, optlen */
+ [TARGET_SYS_GETSOCKOPT] = 5, /* fd, level, optname, optval, optlen */
+ [TARGET_SYS_SENDMSG] = 3, /* fd, msg, flags */
+ [TARGET_SYS_RECVMSG] = 3, /* fd, msg, flags */
+ [TARGET_SYS_ACCEPT4] = 4, /* fd, addr, addrlen, flags */
+ [TARGET_SYS_RECVMMSG] = 4, /* fd, msgvec, vlen, flags */
+ [TARGET_SYS_SENDMMSG] = 4, /* fd, msgvec, vlen, flags */
};
abi_long a[6]; /* max 6 args */
+ unsigned i;
- /* first, collect the arguments in a[] according to ac[] */
- if (num >= 0 && num < ARRAY_SIZE(ac)) {
- unsigned i;
- assert(ARRAY_SIZE(a) >= ac[num]); /* ensure we have space for args */
- for (i = 0; i < ac[num]; ++i) {
- if (get_user_ual(a[i], vptr + i * sizeof(abi_long)) != 0) {
- return -TARGET_EFAULT;
- }
+ /* check the range of the first argument num */
+ /* (TARGET_SYS_SENDMMSG is the highest among TARGET_SYS_xxx) */
+ if (num < 1 || num > TARGET_SYS_SENDMMSG) {
+ return -TARGET_EINVAL;
+ }
+ /* ensure we have space for args */
+ if (nargs[num] > ARRAY_SIZE(a)) {
+ return -TARGET_EINVAL;
+ }
+ /* collect the arguments in a[] according to nargs[] */
+ for (i = 0; i < nargs[num]; ++i) {
+ if (get_user_ual(a[i], vptr + i * sizeof(abi_long)) != 0) {
+ return -TARGET_EFAULT;
}
}
-
- /* now when we have the args, actually handle the call */
+ /* now when we have the args, invoke the appropriate underlying function */
switch (num) {
- case SOCKOP_socket: /* domain, type, protocol */
+ case TARGET_SYS_SOCKET: /* domain, type, protocol */
return do_socket(a[0], a[1], a[2]);
- case SOCKOP_bind: /* sockfd, addr, addrlen */
+ case TARGET_SYS_BIND: /* sockfd, addr, addrlen */
return do_bind(a[0], a[1], a[2]);
- case SOCKOP_connect: /* sockfd, addr, addrlen */
+ case TARGET_SYS_CONNECT: /* sockfd, addr, addrlen */
return do_connect(a[0], a[1], a[2]);
- case SOCKOP_listen: /* sockfd, backlog */
+ case TARGET_SYS_LISTEN: /* sockfd, backlog */
return get_errno(listen(a[0], a[1]));
- case SOCKOP_accept: /* sockfd, addr, addrlen */
+ case TARGET_SYS_ACCEPT: /* sockfd, addr, addrlen */
return do_accept4(a[0], a[1], a[2], 0);
- case SOCKOP_accept4: /* sockfd, addr, addrlen, flags */
- return do_accept4(a[0], a[1], a[2], a[3]);
- case SOCKOP_getsockname: /* sockfd, addr, addrlen */
+ case TARGET_SYS_GETSOCKNAME: /* sockfd, addr, addrlen */
return do_getsockname(a[0], a[1], a[2]);
- case SOCKOP_getpeername: /* sockfd, addr, addrlen */
+ case TARGET_SYS_GETPEERNAME: /* sockfd, addr, addrlen */
return do_getpeername(a[0], a[1], a[2]);
- case SOCKOP_socketpair: /* domain, type, protocol, tab */
+ case TARGET_SYS_SOCKETPAIR: /* domain, type, protocol, tab */
return do_socketpair(a[0], a[1], a[2], a[3]);
- case SOCKOP_send: /* sockfd, msg, len, flags */
+ case TARGET_SYS_SEND: /* sockfd, msg, len, flags */
return do_sendto(a[0], a[1], a[2], a[3], 0, 0);
- case SOCKOP_recv: /* sockfd, msg, len, flags */
+ case TARGET_SYS_RECV: /* sockfd, msg, len, flags */
return do_recvfrom(a[0], a[1], a[2], a[3], 0, 0);
- case SOCKOP_sendto: /* sockfd, msg, len, flags, addr, addrlen */
+ case TARGET_SYS_SENDTO: /* sockfd, msg, len, flags, addr, addrlen */
return do_sendto(a[0], a[1], a[2], a[3], a[4], a[5]);
- case SOCKOP_recvfrom: /* sockfd, msg, len, flags, addr, addrlen */
+ case TARGET_SYS_RECVFROM: /* sockfd, msg, len, flags, addr, addrlen */
return do_recvfrom(a[0], a[1], a[2], a[3], a[4], a[5]);
- case SOCKOP_shutdown: /* sockfd, how */
+ case TARGET_SYS_SHUTDOWN: /* sockfd, how */
return get_errno(shutdown(a[0], a[1]));
- case SOCKOP_sendmsg: /* sockfd, msg, flags */
+ case TARGET_SYS_SETSOCKOPT: /* sockfd, level, optname, optval, optlen */
+ return do_setsockopt(a[0], a[1], a[2], a[3], a[4]);
+ case TARGET_SYS_GETSOCKOPT: /* sockfd, level, optname, optval, optlen */
+ return do_getsockopt(a[0], a[1], a[2], a[3], a[4]);
+ case TARGET_SYS_SENDMSG: /* sockfd, msg, flags */
return do_sendrecvmsg(a[0], a[1], a[2], 1);
- case SOCKOP_recvmsg: /* sockfd, msg, flags */
+ case TARGET_SYS_RECVMSG: /* sockfd, msg, flags */
return do_sendrecvmsg(a[0], a[1], a[2], 0);
- case SOCKOP_sendmmsg: /* sockfd, msgvec, vlen, flags */
- return do_sendrecvmmsg(a[0], a[1], a[2], a[3], 1);
- case SOCKOP_recvmmsg: /* sockfd, msgvec, vlen, flags */
+ case TARGET_SYS_ACCEPT4: /* sockfd, addr, addrlen, flags */
+ return do_accept4(a[0], a[1], a[2], a[3]);
+ case TARGET_SYS_RECVMMSG: /* sockfd, msgvec, vlen, flags */
return do_sendrecvmmsg(a[0], a[1], a[2], a[3], 0);
- case SOCKOP_setsockopt: /* sockfd, level, optname, optval, optlen */
- return do_setsockopt(a[0], a[1], a[2], a[3], a[4]);
- case SOCKOP_getsockopt: /* sockfd, level, optname, optval, optlen */
- return do_getsockopt(a[0], a[1], a[2], a[3], a[4]);
+ case TARGET_SYS_SENDMMSG: /* sockfd, msgvec, vlen, flags */
+ return do_sendrecvmmsg(a[0], a[1], a[2], a[3], 1);
default:
gemu_log("Unsupported socketcall: %d\n", num);
- return -TARGET_ENOSYS;
+ return -TARGET_EINVAL;
}
}
#endif
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 2c183d1..a5b3439 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -9,26 +9,28 @@
#include "syscall_nr.h"
-#define SOCKOP_socket 1
-#define SOCKOP_bind 2
-#define SOCKOP_connect 3
-#define SOCKOP_listen 4
-#define SOCKOP_accept 5
-#define SOCKOP_getsockname 6
-#define SOCKOP_getpeername 7
-#define SOCKOP_socketpair 8
-#define SOCKOP_send 9
-#define SOCKOP_recv 10
-#define SOCKOP_sendto 11
-#define SOCKOP_recvfrom 12
-#define SOCKOP_shutdown 13
-#define SOCKOP_setsockopt 14
-#define SOCKOP_getsockopt 15
-#define SOCKOP_sendmsg 16
-#define SOCKOP_recvmsg 17
-#define SOCKOP_accept4 18
-#define SOCKOP_recvmmsg 19
-#define SOCKOP_sendmmsg 20
+
+/* socket operations for socketcall() */
+#define TARGET_SYS_SOCKET 1 /* socket() */
+#define TARGET_SYS_BIND 2 /* bind() */
+#define TARGET_SYS_CONNECT 3 /* connect() */
+#define TARGET_SYS_LISTEN 4 /* listen() */
+#define TARGET_SYS_ACCEPT 5 /* accept() */
+#define TARGET_SYS_GETSOCKNAME 6 /* getsockname() */
+#define TARGET_SYS_GETPEERNAME 7 /* getpeername() */
+#define TARGET_SYS_SOCKETPAIR 8 /* socketpair() */
+#define TARGET_SYS_SEND 9 /* send() */
+#define TARGET_SYS_RECV 10 /* recv() */
+#define TARGET_SYS_SENDTO 11 /* sendto() */
+#define TARGET_SYS_RECVFROM 12 /* recvfrom() */
+#define TARGET_SYS_SHUTDOWN 13 /* shutdown() */
+#define TARGET_SYS_SETSOCKOPT 14 /* setsockopt() */
+#define TARGET_SYS_GETSOCKOPT 15 /* getsockopt() */
+#define TARGET_SYS_SENDMSG 16 /* sendmsg() */
+#define TARGET_SYS_RECVMSG 17 /* recvmsg() */
+#define TARGET_SYS_ACCEPT4 18 /* accept4() */
+#define TARGET_SYS_RECVMMSG 19 /* recvmmsg() */
+#define TARGET_SYS_SENDMMSG 20 /* sendmmsg() */
#define IPCOP_semop 1
#define IPCOP_semget 2
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v7 09/10] linux-user: Fix syslog() syscall support
2016-09-22 16:56 [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Aleksandar Markovic
` (7 preceding siblings ...)
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 08/10] linux-user: Fix socketcall() syscall support Aleksandar Markovic
@ 2016-09-22 16:56 ` Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 10/10] linux-user: Remove a duplicate item from strace.list Aleksandar Markovic
` (2 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2016-09-22 16:56 UTC (permalink / raw)
To: qemu-devel, riku.voipio, laurent, peter.maydell, petar.jovanovic,
miodrag.dinic, aleksandar.rikalo, aleksandar.markovic
From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
There are currently several problems related to syslog() support.
For example, if the second argument "bufp" of target syslog() syscall
is NULL, the current implementation always returns error code EFAULT.
However, NULL is a perfectly valid value for the second argument for
many use cases of this syscall. This is, for example, visible from
this excerpt of man page for syslog(2):
> EINVAL Bad arguments (e.g., bad type; or for type 2, 3, or 4, buf is
> NULL, or len is less than zero; or for type 8, the level is
> outside the range 1 to 8).
Moreover, the argument "bufp" is ignored for all cases of values of the
first argument, except 2, 3 and 4. This means that for such cases
(the first argument is not 2, 3 or 4), there is no need to pass "buf"
between host and target, and it can be set to NULL while calling host's
syslog(), without loss of emulation accuracy.
Note also that if "bufp" is NULL and the first argument is 2, 3 or 4, the
correct returned error code is EINVAL, not EFAULT.
All these details are reflected in this patch.
"#ifdef TARGET_NR_syslog" is also proprerly inserted when needed.
Support for Qemu's "-strace" switch for syslog() syscall is included too.
LTP tests syslog11 and syslog12 pass with this patch (while fail without
it), on any platform.
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
linux-user/strace.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++
linux-user/strace.list | 2 +-
linux-user/syscall.c | 49 ++++++++++++++++++++++++++++----
linux-user/syscall_defs.h | 25 ++++++++++++++++
4 files changed, 141 insertions(+), 7 deletions(-)
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 1922cb4..d20d4c0 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -1903,6 +1903,78 @@ print_rt_sigprocmask(const struct syscallname *name,
}
#endif
+#ifdef TARGET_NR_syslog
+static void
+print_syslog_action(abi_ulong arg, int last)
+{
+ const char *type;
+
+ switch (arg) {
+ case TARGET_SYSLOG_ACTION_CLOSE: {
+ type = "SYSLOG_ACTION_CLOSE";
+ break;
+ }
+ case TARGET_SYSLOG_ACTION_OPEN: {
+ type = "SYSLOG_ACTION_OPEN";
+ break;
+ }
+ case TARGET_SYSLOG_ACTION_READ: {
+ type = "SYSLOG_ACTION_READ";
+ break;
+ }
+ case TARGET_SYSLOG_ACTION_READ_ALL: {
+ type = "SYSLOG_ACTION_READ_ALL";
+ break;
+ }
+ case TARGET_SYSLOG_ACTION_READ_CLEAR: {
+ type = "SYSLOG_ACTION_READ_CLEAR";
+ break;
+ }
+ case TARGET_SYSLOG_ACTION_CLEAR: {
+ type = "SYSLOG_ACTION_CLEAR";
+ break;
+ }
+ case TARGET_SYSLOG_ACTION_CONSOLE_OFF: {
+ type = "SYSLOG_ACTION_CONSOLE_OFF";
+ break;
+ }
+ case TARGET_SYSLOG_ACTION_CONSOLE_ON: {
+ type = "SYSLOG_ACTION_CONSOLE_ON";
+ break;
+ }
+ case TARGET_SYSLOG_ACTION_CONSOLE_LEVEL: {
+ type = "SYSLOG_ACTION_CONSOLE_LEVEL";
+ break;
+ }
+ case TARGET_SYSLOG_ACTION_SIZE_UNREAD: {
+ type = "SYSLOG_ACTION_SIZE_UNREAD";
+ break;
+ }
+ case TARGET_SYSLOG_ACTION_SIZE_BUFFER: {
+ type = "SYSLOG_ACTION_SIZE_BUFFER";
+ break;
+ }
+ default: {
+ print_raw_param("%ld", arg, last);
+ return;
+ }
+ }
+ gemu_log("%s%s", type, get_comma(last));
+}
+
+static void
+print_syslog(const struct syscallname *name,
+ abi_long arg0, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5)
+{
+ print_syscall_prologue(name);
+ print_syslog_action(arg0, 0);
+ print_pointer(arg1, 0);
+ print_raw_param("%d", arg2, 1);
+ print_syscall_epilogue(name);
+}
+#endif
+
#ifdef TARGET_NR_mknod
static void
print_mknod(const struct syscallname *name,
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 38139ba..680bbf8 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -1381,7 +1381,7 @@
{ TARGET_NR_sys_kexec_load, "sys_kexec_load" , NULL, NULL, NULL },
#endif
#ifdef TARGET_NR_syslog
-{ TARGET_NR_syslog, "syslog" , NULL, NULL, NULL },
+{ TARGET_NR_syslog, "syslog" , NULL, print_syslog, NULL },
#endif
#ifdef TARGET_NR_sysmips
{ TARGET_NR_sysmips, "sysmips" , NULL, NULL, NULL },
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 65a76e4..abd73e7 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9338,14 +9338,51 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
ret = do_setsockopt(arg1, arg2, arg3, arg4, (socklen_t) arg5);
break;
#endif
-
+#if defined(TARGET_NR_syslog)
case TARGET_NR_syslog:
- if (!(p = lock_user_string(arg2)))
- goto efault;
- ret = get_errno(sys_syslog((int)arg1, p, (int)arg3));
- unlock_user(p, arg2, 0);
- break;
+ {
+ int len = arg2;
+ switch (arg1) {
+ case TARGET_SYSLOG_ACTION_CLOSE: /* Close log */
+ case TARGET_SYSLOG_ACTION_OPEN: /* Open log */
+ case TARGET_SYSLOG_ACTION_CLEAR: /* Clear ring buffer */
+ case TARGET_SYSLOG_ACTION_CONSOLE_OFF: /* Disable logging */
+ case TARGET_SYSLOG_ACTION_CONSOLE_ON: /* Enable logging */
+ case TARGET_SYSLOG_ACTION_CONSOLE_LEVEL: /* Set messages level */
+ case TARGET_SYSLOG_ACTION_SIZE_UNREAD: /* Number of chars */
+ case TARGET_SYSLOG_ACTION_SIZE_BUFFER: /* Size of the buffer */
+ {
+ ret = get_errno(sys_syslog((int)arg1, NULL, (int)arg3));
+ }
+ break;
+ case TARGET_SYSLOG_ACTION_READ: /* Read from log */
+ case TARGET_SYSLOG_ACTION_READ_CLEAR: /* Read/clear msgs */
+ case TARGET_SYSLOG_ACTION_READ_ALL: /* Read last messages */
+ {
+ if (len < 0) {
+ ret = -TARGET_EINVAL;
+ goto fail;
+ }
+ if (len == 0) {
+ break;
+ }
+ p = lock_user(VERIFY_WRITE, arg2, arg3, 0);
+ if (!p) {
+ ret = -TARGET_EINVAL;
+ goto fail;
+ }
+ ret = get_errno(sys_syslog((int)arg1, p, (int)arg3));
+ unlock_user(p, arg2, arg3);
+ }
+ break;
+ default:
+ ret = -EINVAL;
+ break;
+ }
+ }
+ break;
+#endif
case TARGET_NR_setitimer:
{
struct itimerval value, ovalue, *pvalue;
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index a5b3439..c9aea13 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2678,4 +2678,29 @@ struct target_user_cap_data {
uint32_t inheritable;
};
+/* from kernel's include/linux/syslog.h */
+
+/* Close the log. Currently a NOP. */
+#define TARGET_SYSLOG_ACTION_CLOSE 0
+/* Open the log. Currently a NOP. */
+#define TARGET_SYSLOG_ACTION_OPEN 1
+/* Read from the log. */
+#define TARGET_SYSLOG_ACTION_READ 2
+/* Read all messages remaining in the ring buffer. */
+#define TARGET_SYSLOG_ACTION_READ_ALL 3
+/* Read and clear all messages remaining in the ring buffer */
+#define TARGET_SYSLOG_ACTION_READ_CLEAR 4
+/* Clear ring buffer. */
+#define TARGET_SYSLOG_ACTION_CLEAR 5
+/* Disable printk's to console */
+#define TARGET_SYSLOG_ACTION_CONSOLE_OFF 6
+/* Enable printk's to console */
+#define TARGET_SYSLOG_ACTION_CONSOLE_ON 7
+/* Set level of messages printed to console */
+#define TARGET_SYSLOG_ACTION_CONSOLE_LEVEL 8
+/* Return number of unread characters in the log buffer */
+#define TARGET_SYSLOG_ACTION_SIZE_UNREAD 9
+/* Return size of the log buffer */
+#define TARGET_SYSLOG_ACTION_SIZE_BUFFER 10
+
#endif
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Qemu-devel] [PATCH v7 10/10] linux-user: Remove a duplicate item from strace.list
2016-09-22 16:56 [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Aleksandar Markovic
` (8 preceding siblings ...)
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 09/10] linux-user: Fix syslog() " Aleksandar Markovic
@ 2016-09-22 16:56 ` Aleksandar Markovic
2016-09-22 18:43 ` [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Laurent Vivier
2016-09-24 10:19 ` Riku Voipio
11 siblings, 0 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2016-09-22 16:56 UTC (permalink / raw)
To: qemu-devel, riku.voipio, laurent, peter.maydell, petar.jovanovic,
miodrag.dinic, aleksandar.rikalo, aleksandar.markovic
From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
There is a duplicate item in strace.list. It is benign, but it
shouldn't be there, since it may lead to confusion and even bugs
in the future. It is the only duplicate in strace.list. This
patch removes it.
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
linux-user/strace.list | 3 ---
1 file changed, 3 deletions(-)
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 680bbf8..f8896d8 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -1353,9 +1353,6 @@
#ifdef TARGET_NR_sync
{ TARGET_NR_sync, "sync" , NULL, NULL, NULL },
#endif
-#ifdef TARGET_NR_sync_file_range
-{ TARGET_NR_sync_file_range, "sync_file_range" , NULL, NULL, NULL },
-#endif
#ifdef TARGET_NR_syscall
{ TARGET_NR_syscall, "syscall" , NULL, NULL, NULL },
#endif
--
2.9.3
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues
2016-09-22 16:56 [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Aleksandar Markovic
` (9 preceding siblings ...)
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 10/10] linux-user: Remove a duplicate item from strace.list Aleksandar Markovic
@ 2016-09-22 18:43 ` Laurent Vivier
2016-09-23 8:43 ` Aleksandar Markovic
2016-09-24 10:19 ` Riku Voipio
11 siblings, 1 reply; 20+ messages in thread
From: Laurent Vivier @ 2016-09-22 18:43 UTC (permalink / raw)
To: Aleksandar Markovic, qemu-devel, riku.voipio, peter.maydell,
petar.jovanovic, miodrag.dinic, aleksandar.rikalo,
aleksandar.markovic
Le 22/09/2016 à 18:56, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
>
> v6->v7:
>
> - rebased to the latest code (there was a large linux-user change since
> v6, consisting of 26 patches)
> - slightly changed order of patches
> - changed PATH_MAX to 128 in sysfs() patch (last remaining item
> that was supposed to be in the previous version)
At first glance of the patch, you didn't change the good PATH_MAX...
Laurent
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues
2016-09-22 18:43 ` [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Laurent Vivier
@ 2016-09-23 8:43 ` Aleksandar Markovic
2016-09-23 9:03 ` Laurent Vivier
0 siblings, 1 reply; 20+ messages in thread
From: Aleksandar Markovic @ 2016-09-23 8:43 UTC (permalink / raw)
To: Laurent Vivier, Aleksandar Markovic, qemu-devel@nongnu.org,
riku.voipio@iki.fi, peter.maydell@linaro.org, Petar Jovanovic,
Miodrag Dinic, Aleksandar Rikalo
> - changed PATH_MAX to 128 in sysfs() patch (last remaining item
> that was supposed to be in the previous version)
At first glance of the patch, you didn't change the good PATH_MAX...
Laurent
It slipped through the cracks. Sorry. :( My bad. But all other changes are in. Rebase is also good, this series sits *after* 26-patch linux-user change. Speaking about PATH_MAX, I intended to replace it with hardcoded 128. However, another possibility is replacing it with NAME_MAX (255). Or to leave PATH_MAX (4096)? Or something else altogether? What do you think? Thanks, Aleksandar
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues
2016-09-23 8:43 ` Aleksandar Markovic
@ 2016-09-23 9:03 ` Laurent Vivier
0 siblings, 0 replies; 20+ messages in thread
From: Laurent Vivier @ 2016-09-23 9:03 UTC (permalink / raw)
To: Aleksandar Markovic, Aleksandar Markovic, qemu-devel@nongnu.org,
riku.voipio@iki.fi, peter.maydell@linaro.org, Petar Jovanovic,
Miodrag Dinic, Aleksandar Rikalo
Le 23/09/2016 à 10:43, Aleksandar Markovic a écrit :
> > - changed PATH_MAX to 128 in sysfs() patch (last remaining item
> > that was supposed to be in the previous version)/
>
> At first glance of the patch, you didn't change the good PATH_MAX...
>
> Laurent/
>
> It slipped through the cracks. Sorry. :( My bad. But all other changes
> are in. Rebase is also good, this series sits *after* 26-patch
> linux-user change. Speaking about PATH_MAX, I intended to replace it
> with hardcoded 128. However, another possibility is replacing it with
> NAME_MAX (255). Or to leave PATH_MAX (4096)? Or something else
> altogether? What do you think? Thanks, Aleksandar
I've looked at the kernel code and there is no defined value for this
length (this is a pointer to a string), but it seems the length of the
longest string is 14 [1]. So 4096 seems really overkill.
Laurent
[1] grep -rh -A3 "struct file_system_type " . |grep "\.name" |sed -n
's/[^"]*"\([^"]*\)".*/\1/p'|while read name; do echo $name|wc -c;
done|sort -n|tail -1
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues
2016-09-22 16:56 [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Aleksandar Markovic
` (10 preceding siblings ...)
2016-09-22 18:43 ` [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Laurent Vivier
@ 2016-09-24 10:19 ` Riku Voipio
11 siblings, 0 replies; 20+ messages in thread
From: Riku Voipio @ 2016-09-24 10:19 UTC (permalink / raw)
To: Aleksandar Markovic
Cc: qemu-devel, laurent, peter.maydell, petar.jovanovic,
miodrag.dinic, aleksandar.rikalo, aleksandar.markovic
On Thu, Sep 22, 2016 at 06:56:49PM +0200, Aleksandar Markovic wrote:
> This series fixes certain Qemu user mode issues. The fixes mainly originate
> from observation of LTP tests failures for execution in Qemu user mode on
> various platforms. The series also contains a cleanup patch.
Thanks, all except the sysfs patch have been applied to
linux-user-for-upstream que.
Riku
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH v7 02/10] linux-user: Add support for clock_adjtime() syscall
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 02/10] linux-user: Add support for clock_adjtime() syscall Aleksandar Markovic
@ 2016-10-07 13:03 ` Riku Voipio
0 siblings, 0 replies; 20+ messages in thread
From: Riku Voipio @ 2016-10-07 13:03 UTC (permalink / raw)
To: Aleksandar Markovic
Cc: qemu-devel, laurent, peter.maydell, petar.jovanovic,
miodrag.dinic, aleksandar.rikalo, aleksandar.markovic
On Thu, Sep 22, 2016 at 06:56:51PM +0200, Aleksandar Markovic wrote:
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
>
> This patch implements Qemu user mode clock_adjtime() syscall support.
>
> The implementation is based on invocation of host's clock_adjtime(), and is
> very similar to the implementation of adjtimex() syscall support. The main
> difference is the presence of "clockid_t" argument in clock_adjtime().
> Signed-off-by: Aleksandar Rikalo <aleksandar.rikalo@imgtec.com>
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> ---
> linux-user/strace.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++
> linux-user/strace.list | 3 ++
> linux-user/syscall.c | 17 +++++++++++
> 3 files changed, 96 insertions(+)
>
> diff --git a/linux-user/strace.c b/linux-user/strace.c
> index f37b386..a61717d 100644
> --- a/linux-user/strace.c
> +++ b/linux-user/strace.c
> @@ -435,6 +435,69 @@ print_fdset(int n, abi_ulong target_fds_addr)
> }
> #endif
>
> +#ifdef TARGET_NR_clock_adjtime
> +/* IDs of the various system clocks */
> +#define TARGET_CLOCK_REALTIME 0
> +#define TARGET_CLOCK_MONOTONIC 1
> +#define TARGET_CLOCK_PROCESS_CPUTIME_ID 2
> +#define TARGET_CLOCK_THREAD_CPUTIME_ID 3
> +#define TARGET_CLOCK_MONOTONIC_RAW 4
> +#define TARGET_CLOCK_REALTIME_COARSE 5
> +#define TARGET_CLOCK_MONOTONIC_COARSE 6
> +#define TARGET_CLOCK_BOOTTIME 7
> +#define TARGET_CLOCK_REALTIME_ALARM 8
> +#define TARGET_CLOCK_BOOTTIME_ALARM 9
> +#define TARGET_CLOCK_SGI_CYCLE 10
> +#define TARGET_CLOCK_TAI 11
> +
> +static void
> +print_clockid(int clockid, int last)
> +{
> + switch (clockid) {
> + case TARGET_CLOCK_REALTIME:
> + gemu_log("CLOCK_REALTIME");
> + break;
> + case TARGET_CLOCK_MONOTONIC:
> + gemu_log("CLOCK_MONOTONIC");
> + break;
> + case TARGET_CLOCK_PROCESS_CPUTIME_ID:
> + gemu_log("CLOCK_PROCESS_CPUTIME_ID");
> + break;
> + case TARGET_CLOCK_THREAD_CPUTIME_ID:
> + gemu_log("CLOCK_THREAD_CPUTIME_ID");
> + break;
> + case TARGET_CLOCK_MONOTONIC_RAW:
> + gemu_log("CLOCK_MONOTONIC_RAW");
> + break;
> + case TARGET_CLOCK_REALTIME_COARSE:
> + gemu_log("CLOCK_REALTIME_COARSE");
> + break;
> + case TARGET_CLOCK_MONOTONIC_COARSE:
> + gemu_log("CLOCK_MONOTONIC_COARSE");
> + break;
> + case TARGET_CLOCK_BOOTTIME:
> + gemu_log("CLOCK_BOOTTIME");
> + break;
> + case TARGET_CLOCK_REALTIME_ALARM:
> + gemu_log("CLOCK_REALTIME_ALARM");
> + break;
> + case TARGET_CLOCK_BOOTTIME_ALARM:
> + gemu_log("CLOCK_BOOTTIME_ALARM");
> + break;
> + case TARGET_CLOCK_SGI_CYCLE:
> + gemu_log("CLOCK_SGI_CYCLE");
> + break;
> + case TARGET_CLOCK_TAI:
> + gemu_log("CLOCK_TAI");
> + break;
> + default:
> + gemu_log("%d", clockid);
> + break;
> + }
> + gemu_log("%s", get_comma(last));
> +}
> +#endif
> +
> /*
> * Sysycall specific output functions
> */
> @@ -1096,6 +1159,19 @@ print_chmod(const struct syscallname *name,
> }
> #endif
>
> +#ifdef TARGET_NR_clock_adjtime
> +static void
> +print_clock_adjtime(const struct syscallname *name,
> + abi_long arg0, abi_long arg1, abi_long arg2,
> + abi_long arg3, abi_long arg4, abi_long arg5)
> +{
> + print_syscall_prologue(name);
> + print_clockid(arg0, 0);
> + print_pointer(arg1, 1);
> + print_syscall_epilogue(name);
> +}
> +#endif
> +
> #ifdef TARGET_NR_clone
> static void do_print_clone(unsigned int flags, abi_ulong newsp,
> abi_ulong parent_tidptr, target_ulong newtls,
> diff --git a/linux-user/strace.list b/linux-user/strace.list
> index 44e8322..01aecfc 100644
> --- a/linux-user/strace.list
> +++ b/linux-user/strace.list
> @@ -73,6 +73,9 @@
> #ifdef TARGET_NR_chroot
> { TARGET_NR_chroot, "chroot" , NULL, NULL, NULL },
> #endif
> +#ifdef TARGET_NR_clock_adjtime
> +{ TARGET_NR_clock_adjtime, "clock_adjtime" , NULL, print_clock_adjtime, NULL },
> +#endif
> #ifdef TARGET_NR_clock_getres
> { TARGET_NR_clock_getres, "clock_getres" , NULL, NULL, NULL },
> #endif
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 7ad5b96..9f11ca2 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -9623,6 +9623,23 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> }
> }
> break;
> +#if defined(TARGET_NR_clock_adjtime)
> + case TARGET_NR_clock_adjtime:
> + {
> + struct timex host_buf;
> +
> + if (target_to_host_timex(&host_buf, arg2) != 0) {
> + goto efault;
> + }
> + ret = get_errno(clock_adjtime(arg1, &host_buf));
When compiling on SuSe11:
linux-user/syscall.o: In function `do_syscall':
/work/linux-user/syscall.c:9710: undefined reference to `clock_adjtime'
The syscall is new enough that it needs a CONFIG_CLOCK_ADJTIME test in configure.
> + if (!is_error(ret)) {
> + if (host_to_target_timex(arg2, &host_buf) != 0) {
> + goto efault;
> + }
> + }
> + }
> + break;
> +#endif
> #ifdef TARGET_NR_create_module
> case TARGET_NR_create_module:
> #endif
> --
> 2.9.3
>
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH v7 03/10] linux-user: Add support for syncfs() syscall
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 03/10] linux-user: Add support for syncfs() syscall Aleksandar Markovic
@ 2016-10-07 13:06 ` Riku Voipio
2016-10-07 14:48 ` Aleksandar Markovic
0 siblings, 1 reply; 20+ messages in thread
From: Riku Voipio @ 2016-10-07 13:06 UTC (permalink / raw)
To: Aleksandar Markovic
Cc: qemu-devel, laurent, peter.maydell, petar.jovanovic,
miodrag.dinic, aleksandar.rikalo, aleksandar.markovic
On Thu, Sep 22, 2016 at 06:56:52PM +0200, Aleksandar Markovic wrote:
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
>
> This patch implements syncfs() syscall support. The implementation
> consists of a straightforward invocation of host's syncfs() only.
>
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> ---
> linux-user/syscall.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 9f11ca2..1af3e10 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -8069,6 +8069,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> sync();
> ret = 0;
> break;
> +#if defined(TARGET_NR_syncfs)
> + case TARGET_NR_syncfs:
> + ret = get_errno(syncfs(arg1));
> + break;
> +#endif
When compiling on Suse11:
linux-user/syscall.o: In function `do_syscall':
/work/linux-user/syscall.c:8090: undefined reference to `syncfs'
library support was added to glibc in version 2.14, which newer than
the glibc in the oldest distros qemu building is still supported (2.11
in Sles11).
CONFIG_SYNCFS checki and guard needed.
Riku
> case TARGET_NR_kill:
> ret = get_errno(safe_kill(arg1, target_to_host_signal(arg2)));
> break;
> --
> 2.9.3
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH v7 03/10] linux-user: Add support for syncfs() syscall
2016-10-07 13:06 ` Riku Voipio
@ 2016-10-07 14:48 ` Aleksandar Markovic
0 siblings, 0 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2016-10-07 14:48 UTC (permalink / raw)
To: Riku Voipio, Aleksandar Markovic
Cc: qemu-devel@nongnu.org, laurent@vivier.eu,
peter.maydell@linaro.org, Petar Jovanovic, Miodrag Dinic,
Aleksandar Rikalo
Hello, Riku,
Thanks a lot for following up. I'm glad I now know the lowest version among supported glibcs. Would you like me to make a new version of two patches that you mentioned using detection in configure as you described, or perhaps you had something else in mind?
Thanks,
Aleksandar
________________________________________
From: Riku Voipio [riku.voipio@iki.fi]
Sent: Friday, October 07, 2016 6:06 AM
To: Aleksandar Markovic
Cc: qemu-devel@nongnu.org; laurent@vivier.eu; peter.maydell@linaro.org; Petar Jovanovic; Miodrag Dinic; Aleksandar Rikalo; Aleksandar Markovic
Subject: Re: [Qemu-devel] [PATCH v7 03/10] linux-user: Add support for syncfs() syscall
On Thu, Sep 22, 2016 at 06:56:52PM +0200, Aleksandar Markovic wrote:
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
>
> This patch implements syncfs() syscall support. The implementation
> consists of a straightforward invocation of host's syncfs() only.
>
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> ---
> linux-user/syscall.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 9f11ca2..1af3e10 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -8069,6 +8069,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> sync();
> ret = 0;
> break;
> +#if defined(TARGET_NR_syncfs)
> + case TARGET_NR_syncfs:
> + ret = get_errno(syncfs(arg1));
> + break;
> +#endif
When compiling on Suse11:
linux-user/syscall.o: In function `do_syscall':
/work/linux-user/syscall.c:8090: undefined reference to `syncfs'
library support was added to glibc in version 2.14, which newer than
the glibc in the oldest distros qemu building is still supported (2.11
in Sles11).
CONFIG_SYNCFS checki and guard needed.
Riku
> case TARGET_NR_kill:
> ret = get_errno(safe_kill(arg1, target_to_host_signal(arg2)));
> break;
> --
> 2.9.3
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] [PATCH v7 05/10] linux-user: Add support for ustat() syscall
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 05/10] linux-user: Add support for ustat() syscall Aleksandar Markovic
@ 2016-10-21 17:04 ` Riku Voipio
2016-10-21 18:01 ` [Qemu-devel] ?==?utf-8?q? " Aleksandar Markovic
0 siblings, 1 reply; 20+ messages in thread
From: Riku Voipio @ 2016-10-21 17:04 UTC (permalink / raw)
To: Aleksandar Markovic
Cc: qemu-devel, laurent, peter.maydell, petar.jovanovic,
miodrag.dinic, aleksandar.rikalo, aleksandar.markovic
On Thu, Sep 22, 2016 at 06:56:54PM +0200, Aleksandar Markovic wrote:
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
>
> This patch implements Qemu user mode ustat() syscall support.
>
> Syscall ustat() returns information about a mounted filesystem.
>
> Its declaration is:
>
> int ustat(dev_t dev, struct ustat *ubuf);
>
> Its Linux kernel implementation is at fs/compat.c, line 334.
>
> The Qemu implementation proposed in this patch is similar to the
> Qemu 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. Support for target_ustat is included. 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.
Had to drop this patch from my series. Not all platforms implement
ustat anymore. As Peter suggested, it is probably better implement ustat
with calling statvfs or statfs.
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> ---
> linux-user/syscall.c | 23 +++++++++++++++++++++--
> linux-user/syscall_defs.h | 6 ++++++
> 2 files changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 563796a..d28f3e6 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>
> @@ -8226,9 +8227,27 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> ret = get_errno(chroot(p));
> unlock_user(p, arg1, 0);
> break;
> -#ifdef TARGET_NR_ustat
> +#if defined(TARGET_NR_ustat)
> case TARGET_NR_ustat:
> - goto unimplemented;
> + {
> + struct ustat ust;
> +
> + ret = get_errno(ustat(arg1, &ust));
> + if (!is_error(ret)) {
> + struct target_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);
> + memcpy(target_ust->f_fname, ust.f_fname, 6);
> + memcpy(target_ust->f_fpack, ust.f_fpack, 6);
> + unlock_user_struct(target_ust, arg2, 1);
> + }
> + }
> + break;
> +
> #endif
> #ifdef TARGET_NR_dup2
> case TARGET_NR_dup2:
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index e47a61a..2c183d1 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -2164,6 +2164,12 @@ struct target_statfs64 {
> };
> #endif
>
> +struct target_ustat {
> + abi_ulong f_tfree;
> + abi_int f_tinode;
> + char f_fname[6];
> + char f_fpack[6];
> +};
>
> #define TARGET_F_DUPFD 0 /* dup */
> #define TARGET_F_GETFD 1 /* get close_on_exec */
> --
> 2.9.3
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Qemu-devel] ?==?utf-8?q? [PATCH v7 05/10] linux-user: Add support for ustat() syscall
2016-10-21 17:04 ` Riku Voipio
@ 2016-10-21 18:01 ` Aleksandar Markovic
0 siblings, 0 replies; 20+ messages in thread
From: Aleksandar Markovic @ 2016-10-21 18:01 UTC (permalink / raw)
To: Riku Voipio
Cc: laurent, peter.maydell, petar.jovanovic, miodrag.dinic,
aleksandar.rikalo, aleksandar.markovic, qemu-devel
Sure, thanks for all other efforts that you put regarding my patches.
I may post another version in some time. There is no rush wrt 2.8 as far as I am concerned.
-------- Original Message --------
Subject: Re: [PATCH v7 05/10] linux-user: Add support for ustat() syscall
Date: Friday, October 21, 2016 19:04 CEST
From: Riku Voipio <riku.voipio@iki.fi>
To: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>
CC: qemu-devel@nongnu.org, laurent@vivier.eu, peter.maydell@linaro.org, petar.jovanovic@imgtec.com, miodrag.dinic@imgtec.com, aleksandar.rikalo@imgtec.com, aleksandar.markovic@imgtec.com
References: <20160922165712.79809-1-aleksandar.markovic@rt-rk.com> <20160922165712.79809-6-aleksandar.markovic@rt-rk.com>
On Thu, Sep 22, 2016 at 06:56:54PM +0200, Aleksandar Markovic wrote:
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
>
> This patch implements Qemu user mode ustat() syscall support.
>
> Syscall ustat() returns information about a mounted filesystem.
>
> Its declaration is:
>
> int ustat(dev_t dev, struct ustat *ubuf);
>
> Its Linux kernel implementation is at fs/compat.c, line 334.
>
> The Qemu implementation proposed in this patch is similar to the
> Qemu 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. Support for target_ustat is included. 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.
Had to drop this patch from my series. Not all platforms implement
ustat anymore. As Peter suggested, it is probably better implement ustat
with calling statvfs or statfs.
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> ---
> linux-user/syscall.c | 23 +++++++++++++++++++++--
> linux-user/syscall_defs.h | 6 ++++++
> 2 files changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 563796a..d28f3e6 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>
> @@ -8226,9 +8227,27 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> ret = get_errno(chroot(p));
> unlock_user(p, arg1, 0);
> break;
> -#ifdef TARGET_NR_ustat
> +#if defined(TARGET_NR_ustat)
> case TARGET_NR_ustat:
> - goto unimplemented;
> + {
> + struct ustat ust;
> +
> + ret = get_errno(ustat(arg1, &ust));
> + if (!is_error(ret)) {
> + struct target_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);
> + memcpy(target_ust->f_fname, ust.f_fname, 6);
> + memcpy(target_ust->f_fpack, ust.f_fpack, 6);
> + unlock_user_struct(target_ust, arg2, 1);
> + }
> + }
> + break;
> +
> #endif
> #ifdef TARGET_NR_dup2
> case TARGET_NR_dup2:
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index e47a61a..2c183d1 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -2164,6 +2164,12 @@ struct target_statfs64 {
> };
> #endif
>
> +struct target_ustat {
> + abi_ulong f_tfree;
> + abi_int f_tinode;
> + char f_fname[6];
> + char f_fpack[6];
> +};
>
> #define TARGET_F_DUPFD 0 /* dup */
> #define TARGET_F_GETFD 1 /* get close_on_exec */
> --
> 2.9.3
>
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2016-10-21 18:01 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-22 16:56 [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 01/10] linux-user: Add support for adjtimex() syscall Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 02/10] linux-user: Add support for clock_adjtime() syscall Aleksandar Markovic
2016-10-07 13:03 ` Riku Voipio
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 03/10] linux-user: Add support for syncfs() syscall Aleksandar Markovic
2016-10-07 13:06 ` Riku Voipio
2016-10-07 14:48 ` Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 04/10] linux-user: Add support for sysfs() syscall Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 05/10] linux-user: Add support for ustat() syscall Aleksandar Markovic
2016-10-21 17:04 ` Riku Voipio
2016-10-21 18:01 ` [Qemu-devel] ?==?utf-8?q? " Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 06/10] linux-user: Fix mq_open() syscall support Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 07/10] linux-user: Fix msgrcv() and msgsnd() syscalls support Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 08/10] linux-user: Fix socketcall() syscall support Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 09/10] linux-user: Fix syslog() " Aleksandar Markovic
2016-09-22 16:56 ` [Qemu-devel] [PATCH v7 10/10] linux-user: Remove a duplicate item from strace.list Aleksandar Markovic
2016-09-22 18:43 ` [Qemu-devel] [PATCH v7 00/10] linux-user: Fix assorted Qemu user mode issues Laurent Vivier
2016-09-23 8:43 ` Aleksandar Markovic
2016-09-23 9:03 ` Laurent Vivier
2016-09-24 10:19 ` Riku Voipio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).