mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-08 04:55:52 +00:00
overhaul of the thread support. Many things are now probably broken, but at least with --tool=none, simple and not-so-simple threaded and non-thread programs work. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3265
24 lines
589 B
C
24 lines
589 B
C
#include <stdlib.h>
|
|
#include <sys/mman.h>
|
|
#include <stdio.h>
|
|
|
|
int main(void)
|
|
{
|
|
void *p;
|
|
|
|
unsigned long size = 2ul * 1023ul * 1024ul * 1024ul; // just under 2^31 (4GB)
|
|
|
|
fprintf(stderr, "Attempting too-big malloc()...\n");
|
|
p = malloc(size); // way too big!
|
|
if (p)
|
|
fprintf(stderr, "huge malloc() succeeded??\n");
|
|
|
|
fprintf(stderr, "Attempting too-big mmap()...\n");
|
|
p = mmap( 0, size, PROT_READ|PROT_WRITE|PROT_EXEC,
|
|
MAP_PRIVATE|MAP_ANON, -1, 0 );
|
|
if (-1 != (int)p)
|
|
fprintf(stderr, "huge mmap() succeeded??\n");
|
|
|
|
return 0;
|
|
}
|