This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] sim: dv-cfi: check for posix_fallocate


Some systems (like OS X) do not have posix_fallocate.  Add a configure
check for it before we try to use it.  This is less work than trying
to support old systems.

URL: http://sourceware.org/bugzilla/show_bug.cgi?id=13161
Signed-off-by: Mike Frysinger <vapier@gentoo.org>

2011-11-06  Mike Frysinger  <vapier@gentoo.org>

	PR sim/13161
	* configure.ac (AC_CHECK_FUNCS): Add posix_fallocate.
	* configure: Regenerate.
	* dv-cfi.c (attach_cfi_regs): Check for HAVE_POSIX_FALLOCATE.
---
 sim/common/configure.ac |    2 +-
 sim/common/dv-cfi.c     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sim/common/configure.ac b/sim/common/configure.ac
index a683f37..e771575 100644
--- a/sim/common/configure.ac
+++ b/sim/common/configure.ac
@@ -34,7 +34,7 @@ AC_SUBST(TARGET_SUBDIR)
 
 # These aren't all needed yet, but will be eventually.
 AC_CHECK_HEADERS(stdlib.h string.h strings.h time.h sys/times.h sys/stat.h sys/mman.h)
-AC_CHECK_FUNCS(mmap munmap lstat truncate ftruncate)
+AC_CHECK_FUNCS(mmap munmap lstat truncate ftruncate posix_fallocate)
 AC_CHECK_MEMBERS([[struct stat.st_dev], [struct stat.st_ino],
 [struct stat.st_mode], [struct stat.st_nlink], [struct stat.st_uid],
 [struct stat.st_gid], [struct stat.st_rdev], [struct stat.st_size],
diff --git a/sim/common/dv-cfi.c b/sim/common/dv-cfi.c
index a1ecaf9..04b004b 100644
--- a/sim/common/dv-cfi.c
+++ b/sim/common/dv-cfi.c
@@ -727,7 +727,7 @@ attach_cfi_regs (struct hw *me, struct cfi *cfi)
   /* Figure out where our initial flash data is coming from.  */
   if (fd != -1 && fd_writable)
     {
-#ifdef HAVE_MMAP
+#if defined (HAVE_MMAP) && defined (HAVE_POSIX_FALLOCATE)
       posix_fallocate (fd, 0, cfi->dev_size);
 
       cfi->mmap = mmap (NULL, cfi->dev_size,
-- 
1.7.6.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]