diff options
author | ljrittle <ljrittle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-01 18:10:39 +0000 |
---|---|---|
committer | ljrittle <ljrittle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-01 18:10:39 +0000 |
commit | b85203523523bbd7772e2e7ca5e3b53cf0db1d5d (patch) | |
tree | 0a95a245b35217f0af528f4b9d2ec8fcb37d4a3b /libmudflap | |
parent | 2193544ef363a21c1312afb8b877b39bb81a017e (diff) | |
download | gcc-b85203523523bbd7772e2e7ca5e3b53cf0db1d5d.tar.gz |
2009-09-01 Loren J. Rittle <ljrittle@acm.org>
Andreas Schwab <schwab@linux-m68k.org>
* testsuite/libmudflap.c/pass51-frag.c (MAP_FAILED): Define,
if not in system header; use it. On FreeBSD, must pass fd==-1
with MAP_ANON flag. Correct mmap error check.
* testsuite/libmudflap.c/fail40-frag.c: Ditto.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151277 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libmudflap')
-rw-r--r-- | libmudflap/ChangeLog | 8 | ||||
-rw-r--r-- | libmudflap/testsuite/libmudflap.c/fail40-frag.c | 7 | ||||
-rw-r--r-- | libmudflap/testsuite/libmudflap.c/pass51-frag.c | 7 |
3 files changed, 18 insertions, 4 deletions
diff --git a/libmudflap/ChangeLog b/libmudflap/ChangeLog index ef795fe38ee..5a899c18551 100644 --- a/libmudflap/ChangeLog +++ b/libmudflap/ChangeLog @@ -1,3 +1,11 @@ +2009-09-01 Loren J. Rittle <ljrittle@acm.org> + Andreas Schwab <schwab@linux-m68k.org> + + * testsuite/libmudflap.c/pass51-frag.c (MAP_FAILED): Define, + if not in system header; use it. On FreeBSD, must pass fd==-1 + with MAP_ANON flag. Correct mmap error check. + * testsuite/libmudflap.c/fail40-frag.c: Ditto. + 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> * configure.ac (AC_PREREQ): Bump to 2.64. diff --git a/libmudflap/testsuite/libmudflap.c/fail40-frag.c b/libmudflap/testsuite/libmudflap.c/fail40-frag.c index 610be20554d..fbeb6fd21d3 100644 --- a/libmudflap/testsuite/libmudflap.c/fail40-frag.c +++ b/libmudflap/testsuite/libmudflap.c/fail40-frag.c @@ -14,6 +14,9 @@ int main () #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON #endif +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif #ifdef HAVE_MMAP volatile unsigned char *p; unsigned num = getpagesize (); @@ -23,8 +26,8 @@ int main () /* Get a bit of usable address space. We really want an 2**N+1-sized object, so the low/high addresses wrap when hashed into the lookup cache. So we will manually unregister the entire mmap, then re-register a slice. */ - p = mmap (NULL, num, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0); - if (p == NULL) + p = mmap (NULL, num, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); + if (p == MAP_FAILED) return 1; /* Now unregister it, as if munmap was called. But don't actually munmap, so we can write into the memory. */ diff --git a/libmudflap/testsuite/libmudflap.c/pass51-frag.c b/libmudflap/testsuite/libmudflap.c/pass51-frag.c index b830b3a869d..2780ffd72a0 100644 --- a/libmudflap/testsuite/libmudflap.c/pass51-frag.c +++ b/libmudflap/testsuite/libmudflap.c/pass51-frag.c @@ -13,14 +13,17 @@ int main () #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON #endif +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif #ifdef HAVE_MMAP void *p; unsigned pg = getpagesize (); int rc; p = mmap (NULL, 4 * pg, PROT_READ|PROT_WRITE, - MAP_PRIVATE|MAP_ANONYMOUS, 0, 0); - if (p == NULL) + MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); + if (p == MAP_FAILED) return 1; memset (p, 0, 4*pg); |