From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: laurent@vivier.eu
Subject: [Qemu-devel] [PATCH v6 36/49] linux-user: Split out utime, utimes, futimesat
Date: Sat, 19 Jan 2019 08:31:09 +1100 [thread overview]
Message-ID: <20190118213122.22865-36-richard.henderson@linaro.org> (raw)
In-Reply-To: <20190118213122.22865-1-richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
linux-user/syscall-defs.h | 9 ++++
linux-user/strace.c | 41 ---------------
linux-user/syscall-file.inc.c | 95 +++++++++++++++++++++++++++++++++++
linux-user/syscall.c | 63 -----------------------
linux-user/strace.list | 9 ----
5 files changed, 104 insertions(+), 113 deletions(-)
diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h
index 9d0dd7457b..2767e335d8 100644
--- a/linux-user/syscall-defs.h
+++ b/linux-user/syscall-defs.h
@@ -36,6 +36,9 @@ SYSCALL_DEF(execve, ARG_STR, ARG_PTR, ARG_PTR);
SYSCALL_DEF(execveat, ARG_ATDIRFD, ARG_STR, ARG_PTR, ARG_PTR, ARG_ATFLAG);
SYSCALL_DEF(fchmod, ARG_DEC, ARG_MODEFLAG);
SYSCALL_DEF(fchmodat, ARG_ATDIRFD, ARG_STR, ARG_MODEFLAG);
+#ifdef TARGET_NR_futimesat
+SYSCALL_DEF(futimesat, ARG_ATDIRFD, ARG_STR, ARG_PTR);
+#endif
#ifdef TARGET_NR_fork
SYSCALL_DEF(fork);
#endif
@@ -172,6 +175,12 @@ SYSCALL_DEF(umount2, ARG_STR, ARG_UMOUNTFLAG);
SYSCALL_DEF(unlink, ARG_STR);
#endif
SYSCALL_DEF(unlinkat, ARG_ATDIRFD, ARG_STR, ARG_UNLINKATFLAG);
+#ifdef TARGET_NR_utime
+SYSCALL_DEF(utime, ARG_STR, ARG_PTR);
+#endif
+#ifdef TARGET_NR_utimes
+SYSCALL_DEF(utimes, ARG_STR, ARG_PTR);
+#endif
#ifdef TARGET_NR_vfork
/* Emulate vfork() with fork(). */
SYSCALL_DEF_FULL(vfork, .impl = impl_fork);
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 78781b8817..b54949df27 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -1284,21 +1284,6 @@ print_fcntl(const struct syscallname *name,
#endif
-#ifdef TARGET_NR_futimesat
-static void
-print_futimesat(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_at_dirfd(arg0, 0);
- print_string(arg1, 0);
- print_timeval(arg2, 0);
- print_timeval(arg2 + sizeof (struct target_timeval), 1);
- print_syscall_epilogue(name);
-}
-#endif
-
#if defined(TARGET_NR_socket)
static void
print_socket(const struct syscallname *name,
@@ -2003,32 +1988,6 @@ print_symlinkat(const struct syscallname *name,
}
#endif
-#ifdef TARGET_NR_utime
-static void
-print_utime(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_string(arg0, 0);
- print_pointer(arg1, 1);
- print_syscall_epilogue(name);
-}
-#endif
-
-#ifdef TARGET_NR_utimes
-static void
-print_utimes(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_string(arg0, 0);
- print_pointer(arg1, 1);
- print_syscall_epilogue(name);
-}
-#endif
-
#ifdef TARGET_NR_utimensat
static void
print_utimensat(const struct syscallname *name,
diff --git a/linux-user/syscall-file.inc.c b/linux-user/syscall-file.inc.c
index 7ec1c26347..6a7ef80bfc 100644
--- a/linux-user/syscall-file.inc.c
+++ b/linux-user/syscall-file.inc.c
@@ -84,6 +84,38 @@ SYSCALL_IMPL(fchmodat)
return do_fchmodat(arg1, arg2, arg3);
}
+#ifdef TARGET_NR_futimesat
+SYSCALL_IMPL(futimesat)
+{
+ int dirfd = arg1;
+ abi_ulong target_path = arg2;
+ abi_ulong target_tv = arg3;
+ struct timeval *tvp, tv[2];
+ char *p;
+ abi_long ret;
+
+ if (target_tv) {
+ if (copy_from_user_timeval(&tv[0], target_tv)
+ || copy_from_user_timeval(&tv[1],
+ target_tv +
+ sizeof(struct target_timeval))) {
+ return -TARGET_EFAULT;
+ }
+ tvp = tv;
+ } else {
+ tvp = NULL;
+ }
+
+ p = lock_user_string(target_path);
+ if (!p) {
+ return -TARGET_EFAULT;
+ }
+ ret = get_errno(futimesat(dirfd, path(p), tvp));
+ unlock_user(p, target_path, 0);
+ return ret;
+}
+#endif
+
static abi_long do_linkat(int olddirfd, abi_ulong target_oldpath,
int newdirfd, abi_ulong target_newpath,
int flags)
@@ -867,6 +899,69 @@ SYSCALL_IMPL(unlinkat)
return do_unlinkat(arg1, arg2, arg3);
}
+#ifdef TARGET_NR_utime
+SYSCALL_IMPL(utime)
+{
+ abi_ulong target_path = arg1;
+ abi_ulong target_times = arg2;
+ struct utimbuf tbuf, *host_tbuf;
+ struct target_utimbuf *target_tbuf;
+ char *p;
+ abi_long ret;
+
+ if (target_times) {
+ if (!lock_user_struct(VERIFY_READ, target_tbuf, target_times, 1)) {
+ return -TARGET_EFAULT;
+ }
+ tbuf.actime = tswapal(target_tbuf->actime);
+ tbuf.modtime = tswapal(target_tbuf->modtime);
+ unlock_user_struct(target_tbuf, arg2, 0);
+ host_tbuf = &tbuf;
+ } else {
+ host_tbuf = NULL;
+ }
+
+ p = lock_user_string(target_path);
+ if (!p) {
+ return -TARGET_EFAULT;
+ }
+ ret = get_errno(utime(p, host_tbuf));
+ unlock_user(p, target_path, 0);
+ return ret;
+}
+#endif
+
+#ifdef TARGET_NR_utimes
+SYSCALL_IMPL(utimes)
+{
+ abi_ulong target_path = arg1;
+ abi_ulong target_tv = arg2;
+ struct timeval *tvp, tv[2];
+ char *p;
+ abi_long ret;
+
+ if (target_tv) {
+ if (copy_from_user_timeval(&tv[0], target_tv)
+ || copy_from_user_timeval(&tv[1],
+ target_tv +
+ sizeof(struct target_timeval))) {
+ return -TARGET_EFAULT;
+ }
+ tvp = tv;
+ } else {
+ tvp = NULL;
+ }
+
+ p = lock_user_string(target_path);
+ if (!p) {
+ return -TARGET_EFAULT;
+ }
+ ret = get_errno(utimes(p, tvp));
+ unlock_user(p, target_path, 0);
+ return ret;
+}
+#endif
+
SYSCALL_IMPL(write)
{
int fd = arg1;
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f3ea9600c8..ca462fde61 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5327,69 +5327,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
void *p;
switch(num) {
-#ifdef TARGET_NR_utime
- case TARGET_NR_utime:
- {
- struct utimbuf tbuf, *host_tbuf;
- struct target_utimbuf *target_tbuf;
- if (arg2) {
- if (!lock_user_struct(VERIFY_READ, target_tbuf, arg2, 1))
- return -TARGET_EFAULT;
- tbuf.actime = tswapal(target_tbuf->actime);
- tbuf.modtime = tswapal(target_tbuf->modtime);
- unlock_user_struct(target_tbuf, arg2, 0);
- host_tbuf = &tbuf;
- } else {
- host_tbuf = NULL;
- }
- if (!(p = lock_user_string(arg1)))
- return -TARGET_EFAULT;
- ret = get_errno(utime(p, host_tbuf));
- unlock_user(p, arg1, 0);
- }
- return ret;
-#endif
-#ifdef TARGET_NR_utimes
- case TARGET_NR_utimes:
- {
- struct timeval *tvp, tv[2];
- if (arg2) {
- if (copy_from_user_timeval(&tv[0], arg2)
- || copy_from_user_timeval(&tv[1],
- arg2 + sizeof(struct target_timeval)))
- return -TARGET_EFAULT;
- tvp = tv;
- } else {
- tvp = NULL;
- }
- if (!(p = lock_user_string(arg1)))
- return -TARGET_EFAULT;
- ret = get_errno(utimes(p, tvp));
- unlock_user(p, arg1, 0);
- }
- return ret;
-#endif
-#if defined(TARGET_NR_futimesat)
- case TARGET_NR_futimesat:
- {
- struct timeval *tvp, tv[2];
- if (arg3) {
- if (copy_from_user_timeval(&tv[0], arg3)
- || copy_from_user_timeval(&tv[1],
- arg3 + sizeof(struct target_timeval)))
- return -TARGET_EFAULT;
- tvp = tv;
- } else {
- tvp = NULL;
- }
- if (!(p = lock_user_string(arg2))) {
- return -TARGET_EFAULT;
- }
- ret = get_errno(futimesat(arg1, path(p), tvp));
- unlock_user(p, arg2, 0);
- }
- return ret;
-#endif
#ifdef TARGET_NR_access
case TARGET_NR_access:
if (!(p = lock_user_string(arg1))) {
diff --git a/linux-user/strace.list b/linux-user/strace.list
index b119b7a20c..c0c1b896f7 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -226,9 +226,6 @@
#ifdef TARGET_NR_futex
{ TARGET_NR_futex, "futex" , NULL, print_futex, NULL },
#endif
-#ifdef TARGET_NR_futimesat
-{ TARGET_NR_futimesat, "futimesat" , NULL, print_futimesat, NULL },
-#endif
#ifdef TARGET_NR_getcpu
{ TARGET_NR_getcpu, "getcpu" , "%s(%p,%d)", NULL, NULL },
#endif
@@ -1392,12 +1389,6 @@
#ifdef TARGET_NR_ustat
{ TARGET_NR_ustat, "ustat" , "%s(%#x,%p)", NULL, NULL },
#endif
-#ifdef TARGET_NR_utime
-{ TARGET_NR_utime, "utime" , NULL, print_utime, NULL },
-#endif
-#ifdef TARGET_NR_utimes
-{ TARGET_NR_utimes, "utimes" , NULL, print_utimes, NULL },
-#endif
#ifdef TARGET_NR_utrap_install
{ TARGET_NR_utrap_install, "utrap_install" , NULL, NULL, NULL },
#endif
--
2.17.2
next prev parent reply other threads:[~2019-01-18 21:33 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-18 21:30 [Qemu-devel] [PATCH v6 00/49] linux-user: Split do_syscall Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 01/49] linux-user: Setup split syscall infrastructure Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 03/49] linux-user: Split out open, open_at Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 04/49] linux-user: Share more code for open and openat Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 05/49] linux-user: Tidy do_openat loop over fakes Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 06/49] linux-user: Split out readlink, readlinkat Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 07/49] linux-user: Split out close Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 08/49] linux-user: Split out read, write Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 09/49] linux-user: Reduce regpairs_aligned & target_offset64 ifdefs Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 10/49] linux-user: Split out readv, writev Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 11/49] linux-user: Split out pread64, pwrite64 Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 12/49] linux-user: Split out preadv, pwritev Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 13/49] linux-user: Split out name_to_handle_at, open_by_handle_at Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 14/49] linux-user: Split out ipc syscalls Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 15/49] linux-user: Split out memory syscalls Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 16/49] linux-user: Split out exit Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 17/49] linux-user: Split out brk Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 18/49] linux-user: Split out clone, fork, vfork Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 19/49] linux-user: Split out wait4, waitid, waitpid Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 20/49] linux-user: Implement rusage argument to waitid Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 21/49] linux-user: Split out creat Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 22/49] linux-user: Split out link, linkat Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 23/49] linux-user: Split out unlink, unlinkat, rmdir Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 24/49] linux-user: Split out execve Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 25/49] linux-user: Implement execveat Richard Henderson
2019-01-18 21:30 ` [Qemu-devel] [PATCH v6 26/49] linux-user: Split out chdir Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 27/49] linux-user: Split out time Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 28/49] linux-user: Split out mknod, mknodat Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 29/49] linux-user: Split out chmod, fchmod, fchmodat Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 30/49] linux-user: Split out lseek, llseek Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 31/49] linux-user: Split out getpid, getppid, getxpid Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 32/49] linux-user: Split out mount Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 33/49] linux-user: Split out umount, umount2 Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 34/49] linux-user: Split out stime Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 35/49] linux-user: Split out alarm, pause Richard Henderson
2019-01-18 21:31 ` Richard Henderson [this message]
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 37/49] linux-user: Split out access, faccessat Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 38/49] linux-user: Split out nice Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 39/49] linux-user: Split out sync, syncfs Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 40/49] linux-user: Split out kill Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 41/49] linux-user: Split out rename, renameat, renameat2 Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 42/49] linux-user: Split out mkdir, mkdirat Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 43/49] linux-user: Split out dup, dup2, dup3 Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 44/49] linux-user: Split out pipe, pipe2 Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 45/49] linux-user: Split out times Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 46/49] linux-user: Split out acct Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 47/49] linux-user: Move syscall_init to the end Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 48/49] linux-user: Split out ioctl Richard Henderson
2019-02-13 13:09 ` Laurent Vivier
2019-02-13 13:46 ` Laurent Vivier
2019-04-09 23:15 ` Richard Henderson
2019-04-09 23:15 ` Richard Henderson
2019-04-09 23:30 ` Richard Henderson
2019-04-09 23:30 ` Richard Henderson
2019-04-10 1:55 ` Richard Henderson
2019-04-10 1:55 ` Richard Henderson
2019-05-09 15:44 ` Laurent Vivier
2019-05-09 15:54 ` Richard Henderson
2019-01-18 21:31 ` [Qemu-devel] [PATCH v6 49/49] linux-user: Split out fcntl, fcntl64 Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190118213122.22865-36-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).