All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] linux-user: Use direct syscall for utimensat
@ 2016-07-18 10:47 Peter Maydell
  0 siblings, 0 replies; only message in thread
From: Peter Maydell @ 2016-07-18 10:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches, Riku Voipio

The linux utimensat syscall differs in semantics from the
libc function because the syscall combines the features
of utimensat() and futimens(). Rather than trying to
split these apart in order to call the two libc functions
which then call the same underlying syscall, just always
directly make the host syscall. This fixes bugs in some
of the corner cases which should return errors from the
syscall but which we were incorrectly directing to futimens().

This doesn't reduce the set of hosts that our syscall
implementation will work on, because if the direct syscall
fails ENOSYS then the libc functions would also fail ENOSYS.
(The system call has been in the kernel since 2.6.22 anyway.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
This patch supersedes http://patchwork.ozlabs.org/patch/648919/
("linux-user: fix "really futimens" condition in sys_utimensat()")

 linux-user/syscall.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 0e87157..fe72abe 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -363,16 +363,7 @@ static int sys_getcwd1(char *buf, size_t size)
 }
 
 #ifdef TARGET_NR_utimensat
-#ifdef CONFIG_UTIMENSAT
-static int sys_utimensat(int dirfd, const char *pathname,
-    const struct timespec times[2], int flags)
-{
-    if (pathname == NULL)
-        return futimens(dirfd, times);
-    else
-        return utimensat(dirfd, pathname, times, flags);
-}
-#elif defined(__NR_utimensat)
+#if defined(__NR_utimensat)
 #define __NR_sys_utimensat __NR_utimensat
 _syscall4(int,sys_utimensat,int,dirfd,const char *,pathname,
           const struct timespec *,tsp,int,flags)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-07-18 10:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-18 10:47 [Qemu-devel] [PATCH] linux-user: Use direct syscall for utimensat Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.