[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2] check for utimensat() availability on configure
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PATCH 2/2] check for utimensat() availability on configure |
Date: |
Tue, 9 Jun 2009 18:26:32 -0300 |
Some glibc versions don't have utimensat() available, but have other xxxat()
functions. Make a separated check for utimensat() to make sure we can compile
linux-user against some older glibc versions.
Signed-off-by: Eduardo Habkost <address@hidden>
---
configure | 24 ++++++++++++++++++++++++
linux-user/syscall.c | 25 +++++++++++++++++--------
2 files changed, 41 insertions(+), 8 deletions(-)
diff --git a/configure b/configure
index 89e7f53..a5ea78f 100755
--- a/configure
+++ b/configure
@@ -1254,6 +1254,27 @@ EOF
fi
fi
+# Check for utimensat() separatedly, because some glibc versions
+# have unlinkat() but not utimensat() available
+utimensat=no
+if [ "$linux_user" = "yes" -a "$atfile" = "yes" ] ; then
+ cat > $TMPC << EOF
+#define _ATFILE_SOURCE
+#include <sys/stat.h>
+#include <fcntl.h>
+
+int
+main(void)
+{
+ struct timespec times[2];
+ return (utimensat(AT_FDCWD, "nonexistent_file", times, 0));
+}
+EOF
+ if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+ utimensat=yes
+ fi
+fi
+
# Check for inotify functions when we are building linux-user
# emulator. This is done because older glibc versions don't
# have syscall stubs for these implemented. In that case we
@@ -1673,6 +1694,9 @@ fi
if test "$atfile" = "yes" ; then
echo "#define CONFIG_ATFILE 1" >> $config_h
fi
+if test "$utimensat" = "yes" ; then
+ echo "#define CONFIG_UTIMENSAT 1" >> $config_h
+fi
if test "$inotify" = "yes" ; then
echo "#define CONFIG_INOTIFY 1" >> $config_h
fi
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index d851edc..42e2b77 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -413,13 +413,6 @@ static int sys_unlinkat(int dirfd, const char *pathname,
int flags)
return (unlinkat(dirfd, pathname, flags));
}
#endif
-#ifdef TARGET_NR_utimensat
-static int sys_utimensat(int dirfd, const char *pathname,
- const struct timespec times[2], int flags)
-{
- return (utimensat(dirfd, pathname, times, flags));
-}
-#endif
#else /* !CONFIG_ATFILE */
/*
@@ -478,12 +471,28 @@ _syscall3(int,sys_symlinkat,const char *,oldpath,
#if defined(TARGET_NR_unlinkat) && defined(__NR_unlinkat)
_syscall3(int,sys_unlinkat,int,dirfd,const char *,pathname,int,flags)
#endif
+
+#endif /* CONFIG_ATFILE */
+
+
+#ifdef CONFIG_UTIMENSAT
+
+#ifdef TARGET_NR_utimensat
+static int sys_utimensat(int dirfd, const char *pathname,
+ const struct timespec times[2], int flags)
+{
+ return (utimensat(dirfd, pathname, times, flags));
+}
+#endif
+
+#else /* !CONFIG_UTIMENSAT */
#if defined(TARGET_NR_utimensat) && defined(__NR_utimensat)
_syscall4(int,sys_utimensat,int,dirfd,const char *,pathname,
const struct timespec *,tsp,int,flags)
#endif
-#endif /* CONFIG_ATFILE */
+#endif /* CONFIG_UTIMENSAT */
+
#ifdef CONFIG_INOTIFY
#include <sys/inotify.h>
--
1.6.3.rc4.29.g8146
- [Qemu-devel] [PATCH 0/2] linux-user: fix build error against older glibcs, Eduardo Habkost, 2009/06/09
- [Qemu-devel] [PATCH 2/2] check for utimensat() availability on configure,
Eduardo Habkost <=
- Re: [Qemu-devel] [PATCH 2/2] check for utimensat() availability on configure, Rtp, 2009/06/09
- Re: [Qemu-devel] [PATCH 2/2] check for utimensat() availability on configure, Eduardo Habkost, 2009/06/10
- Re: [Qemu-devel] [PATCH 2/2] check for utimensat() availability on configure, Rtp, 2009/06/10
- Re: [Qemu-devel] [PATCH 2/2] check for utimensat() availability on configure, Eduardo Habkost, 2009/06/10
- Re: [Qemu-devel] [PATCH 2/2] check for utimensat() availability on configure, Riku Voipio, 2009/06/10
- Re: [Qemu-devel] [PATCH 2/2] check for utimensat() availability on configure, Eduardo Habkost, 2009/06/10
- Re: [Qemu-devel] [PATCH 2/2] check for utimensat() availability on configure, Riku Voipio, 2009/06/11
- Re: [Qemu-devel] [PATCH 2/2] check for utimensat() availability on configure, Riku Voipio, 2009/06/10
- Re: [Qemu-devel] [PATCH 2/2] check for utimensat() availability on configure, Glauber Costa, 2009/06/10
- Re: [Qemu-devel] [PATCH 2/2] check for utimensat() availability on configure, Rtp, 2009/06/10