Project

General

Profile

Bug #2663 » testlib.c

shamaz, 04/15/2014 09:07 AM

 
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/mman.h>

static int initialized = 0;

void lib_init() __attribute__((constructor));

void lib_init()
{
printf ("%i\n", initialized);
if (!(initialized))
{
initialized = 1;
void *addr = mmap (0x900000000, 4096, PROT_NONE, MAP_ANON|MAP_FIXED, -1, 0);
if (addr == MAP_FAILED) printf ("Failed to allocate some space with initialized == 0\n");
else printf ("mmap OK %p\n", addr);
}
}
(2-2/2)