/* * Será possível avançar além do espaço reservado para a pilha? */ #include #include #include #include #include #include #include #define SCRATCH "teste_mmap.txt" char* map; void recursiva() { char v[0x100]; printf ("v: %p\n", (void*) v); recursiva(); return; } int main() { int fd; struct stat buf; if ((fd = open(SCRATCH, O_RDWR, 0600)) == -1) { perror("open"); return 0; } stat(SCRATCH, &buf); if ((map = mmap (&fd, buf.st_size, PROT_WRITE | PROT_READ, MAP_SHARED, fd, 0)) == (void*) -1) { perror("mmap"); exit(-1); } printf ("map: %p\n", (void*) map); recursiva(); return(0); }