diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-11-07 16:28:52 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-11-07 16:28:52 +0000 |
commit | a13852d93636405b7b3cf87f10521e52bcaafe48 (patch) | |
tree | d5c0de9bee6ecf11dd72636d479d8f5d066781bf /sim/common | |
parent | 481d79819e0e47f23f20408a6595333012da6f58 (diff) | |
download | gdb-a13852d93636405b7b3cf87f10521e52bcaafe48.zip gdb-a13852d93636405b7b3cf87f10521e52bcaafe48.tar.gz gdb-a13852d93636405b7b3cf87f10521e52bcaafe48.tar.bz2 |
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>
Diffstat (limited to 'sim/common')
-rw-r--r-- | sim/common/ChangeLog | 7 | ||||
-rw-r--r-- | sim/common/config.in | 3 | ||||
-rwxr-xr-x | sim/common/configure | 2 | ||||
-rw-r--r-- | sim/common/configure.ac | 2 | ||||
-rw-r--r-- | sim/common/dv-cfi.c | 2 |
5 files changed, 13 insertions, 3 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index b5c5ed4..b1c7f85 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,10 @@ +2011-11-07 Mike Frysinger <vapier@gentoo.org> + + PR sim/13161 + * configure.ac (AC_CHECK_FUNCS): Add posix_fallocate. + * configure, config.in: Regenerate. + * dv-cfi.c (attach_cfi_regs): Check for HAVE_POSIX_FALLOCATE. + 2011-10-19 Mike Frysinger <vapier@gentoo.org> * acinclude.m4: Call AC_CHECK_LIB when $hardware contains cfi. diff --git a/sim/common/config.in b/sim/common/config.in index 6f93ff4..5792785 100644 --- a/sim/common/config.in +++ b/sim/common/config.in @@ -43,6 +43,9 @@ /* Define to 1 if you have the `munmap' function. */ #undef HAVE_MUNMAP +/* Define to 1 if you have the `posix_fallocate' function. */ +#undef HAVE_POSIX_FALLOCATE + /* Define to 1 if you have the `sigaction' function. */ #undef HAVE_SIGACTION diff --git a/sim/common/configure b/sim/common/configure index 4b80825..a8148bd 100755 --- a/sim/common/configure +++ b/sim/common/configure @@ -4393,7 +4393,7 @@ fi done -for ac_func in mmap munmap lstat truncate ftruncate +for ac_func in mmap munmap lstat truncate ftruncate posix_fallocate do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" 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, |