* [Qemu-devel] [PATCH] linux-user: Fix sys_utimensat (would not compile on old glibc)
@ 2013-06-20 15:57 Peter Maydell
2013-06-25 8:25 ` Laurent Desnogues
0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2013-06-20 15:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio, patches
Commit c0d472b12e accidentally dropped the definition of
__NR_SYS_utimensat even though its use is guarded by
CONFIG_UTIMENSAT, not CONFIG_ATFILE. Some older glibc don't
have utimensat() (even if they have the other *at() functions).
Fix this by correctly cleaning up the sys_utimensat()
implementation and #defines, so that we always provide the
syscall if needed whether we're doing it via glibc or not.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
linux-user/syscall.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index cdd0c28..f7877c3 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -338,6 +338,7 @@ static int sys_openat(int dirfd, const char *pathname, int flags, mode_t mode)
}
#endif
+#ifdef TARGET_NR_utimensat
#ifdef CONFIG_UTIMENSAT
static int sys_utimensat(int dirfd, const char *pathname,
const struct timespec times[2], int flags)
@@ -347,12 +348,19 @@ static int sys_utimensat(int dirfd, const char *pathname,
else
return utimensat(dirfd, pathname, times, flags);
}
-#else
-#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat)
+#elif defined(__NR_utimensat)
+#define __NR_sys_utimensat __NR_utimensat
_syscall4(int,sys_utimensat,int,dirfd,const char *,pathname,
const struct timespec *,tsp,int,flags)
+#else
+static int sys_utimensat(int dirfd, const char *pathname,
+ const struct timespec times[2], int flags)
+{
+ errno = ENOSYS;
+ return -1;
+}
#endif
-#endif /* CONFIG_UTIMENSAT */
+#endif /* TARGET_NR_utimensat */
#ifdef CONFIG_INOTIFY
#include <sys/inotify.h>
@@ -8536,7 +8544,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
goto unimplemented_nowarn;
#endif
-#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat)
+#if defined(TARGET_NR_utimensat)
case TARGET_NR_utimensat:
{
struct timespec *tsp, ts[2];
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: Fix sys_utimensat (would not compile on old glibc)
2013-06-20 15:57 [Qemu-devel] [PATCH] linux-user: Fix sys_utimensat (would not compile on old glibc) Peter Maydell
@ 2013-06-25 8:25 ` Laurent Desnogues
0 siblings, 0 replies; 2+ messages in thread
From: Laurent Desnogues @ 2013-06-25 8:25 UTC (permalink / raw)
To: Peter Maydell; +Cc: Riku Voipio, qemu-devel@nongnu.org, patches
On Thu, Jun 20, 2013 at 5:57 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> Commit c0d472b12e accidentally dropped the definition of
> __NR_SYS_utimensat even though its use is guarded by
> CONFIG_UTIMENSAT, not CONFIG_ATFILE. Some older glibc don't
> have utimensat() (even if they have the other *at() functions).
> Fix this by correctly cleaning up the sys_utimensat()
> implementation and #defines, so that we always provide the
> syscall if needed whether we're doing it via glibc or not.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Laurent
> ---
> linux-user/syscall.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index cdd0c28..f7877c3 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -338,6 +338,7 @@ static int sys_openat(int dirfd, const char *pathname, int flags, mode_t mode)
> }
> #endif
>
> +#ifdef TARGET_NR_utimensat
> #ifdef CONFIG_UTIMENSAT
> static int sys_utimensat(int dirfd, const char *pathname,
> const struct timespec times[2], int flags)
> @@ -347,12 +348,19 @@ static int sys_utimensat(int dirfd, const char *pathname,
> else
> return utimensat(dirfd, pathname, times, flags);
> }
> -#else
> -#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat)
> +#elif defined(__NR_utimensat)
> +#define __NR_sys_utimensat __NR_utimensat
> _syscall4(int,sys_utimensat,int,dirfd,const char *,pathname,
> const struct timespec *,tsp,int,flags)
> +#else
> +static int sys_utimensat(int dirfd, const char *pathname,
> + const struct timespec times[2], int flags)
> +{
> + errno = ENOSYS;
> + return -1;
> +}
> #endif
> -#endif /* CONFIG_UTIMENSAT */
> +#endif /* TARGET_NR_utimensat */
>
> #ifdef CONFIG_INOTIFY
> #include <sys/inotify.h>
> @@ -8536,7 +8544,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
> goto unimplemented_nowarn;
> #endif
>
> -#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat)
> +#if defined(TARGET_NR_utimensat)
> case TARGET_NR_utimensat:
> {
> struct timespec *tsp, ts[2];
> --
> 1.7.9.5
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-06-25 8:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-20 15:57 [Qemu-devel] [PATCH] linux-user: Fix sys_utimensat (would not compile on old glibc) Peter Maydell
2013-06-25 8:25 ` Laurent Desnogues
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).