From: Eduardo Habkost <ehabkost@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>,
Glauber Costa <glommer@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/2] check for utimensat() availability on configure
Date: Tue, 9 Jun 2009 18:26:32 -0300 [thread overview]
Message-ID: <1244582792-30589-3-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1244582792-30589-1-git-send-email-ehabkost@redhat.com>
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 <ehabkost@redhat.com>
---
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
next prev parent reply other threads:[~2009-06-09 21:26 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-09 21:26 [Qemu-devel] [PATCH 0/2] linux-user: fix build error against older glibcs Eduardo Habkost
2009-06-09 21:26 ` [Qemu-devel] [PATCH 1/2] linux-user/syscall.c: define _ATFILE_SOURCE Eduardo Habkost
2009-06-09 21:26 ` Eduardo Habkost [this message]
2009-06-09 22:06 ` [Qemu-devel] [PATCH 2/2] check for utimensat() availability on configure Arnaud Patard
2009-06-10 14:12 ` Eduardo Habkost
2009-06-10 14:39 ` Arnaud Patard
2009-06-10 19:10 ` Eduardo Habkost
2009-06-10 21:48 ` Riku Voipio
2009-06-10 22:09 ` Eduardo Habkost
2009-06-11 15:14 ` Riku Voipio
2009-06-10 16:07 ` Riku Voipio
2009-06-10 16:20 ` Glauber Costa
2009-06-10 16:30 ` Arnaud Patard
2009-06-10 16:56 ` Glauber Costa
2009-06-10 22:05 ` Riku Voipio
2009-06-11 8:33 ` Arnaud Patard
2009-06-11 15:09 ` Riku Voipio
2009-06-12 8:30 ` ltp vs linux-user (was: Re: [Qemu-devel] [PATCH 2/2] check for utimensat() availability on configure) Arnaud Patard
2009-06-11 11:27 ` [Qemu-devel] [PATCH 2/2] check for utimensat() availability on configure vibi sreenivasan
2009-06-12 13:24 ` vibi sreenivasan
2009-06-10 15:03 ` Glauber Costa
2009-06-10 21:53 ` Riku Voipio
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=1244582792-30589-3-git-send-email-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=glommer@redhat.com \
--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).