mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-27 04:55:01 +08:00
ddfabf89bb
2004-10-12 Frank Ch. Eigler <fche@redhat.com> * configure.ac: Check for more headers, functions. * mf-hooks2.c (mkbuffer, unmkbuffer): New helper functions for tracking overridden FILE buffers. (fopen, setvbuf): New/revised hook functions for buffer overriding. (setbuf,setlinebuf,fdopen,freopen,fopen64,freopen64,fclose): Ditto. (fflush): Accept given NULL stream (means "all streams"). * mf-runtime.h.in: * mf-runtime.c (__mfu_check): Accept accesses that span adjacent HEAP/GUESS objects. (LOOKUP_CACHE_SIZE_MAX): Raise to 64K entries tentatively. (__mf_adapt_cache): Use them all. * testsuite/libmudflap.c/pass35-frag.c: Update warning message. * testsuite/libmudflap.c++/ctors.exp: Ditto. * testsuite/libmudflap.c/{pass51,pass52}-frag.c: New tests. * configure, config.h.in: Regenerated. From-SVN: r88996
42 lines
835 B
C
42 lines
835 B
C
/* Test object-spanning accesses. This is most conveniently done with
|
|
mmap, thus the config.h specificity here. */
|
|
#include "../config.h"
|
|
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
#ifdef HAVE_SYS_MMAN_H
|
|
#include <sys/mman.h>
|
|
#endif
|
|
|
|
int main ()
|
|
{
|
|
#ifndef MAP_ANONYMOUS
|
|
#define MAP_ANONYMOUS MAP_ANON
|
|
#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)
|
|
return 1;
|
|
|
|
memset (p, 0, 4*pg);
|
|
rc = munmap (p, pg);
|
|
if (rc < 0) return 1;
|
|
memset (p+pg, 0, 3*pg);
|
|
rc = munmap (p+pg, pg);
|
|
if (rc < 0) return 1;
|
|
memset (p+2*pg, 0, 2*pg);
|
|
rc = munmap (p+2*pg, pg);
|
|
if (rc < 0) return 1;
|
|
memset (p+3*pg, 0, pg);
|
|
rc = munmap (p+3*pg, pg);
|
|
if (rc < 0) return 1;
|
|
#endif
|
|
|
|
return 0;
|
|
}
|