--- ./bsd-os.c 2008-10-17 12:03:36.000000000 +0200 +++ ./bsd-os.c.save 2008-10-17 12:02:43.000000000 +0200 @@ -78,7 +78,7 @@ void os_init(char *argv[], char *envp[]) { - os_vm_page_size = BACKEND_PAGE_SIZE; + os_vm_page_size = getpagesize(); #ifdef __NetBSD__ netbsd_init(); @@ -112,36 +112,7 @@ if (addr) flags |= MAP_FIXED; -#ifdef __NetBSD__ - if (addr) { - os_vm_address_t curaddr = addr; - - while (len > 0) { - os_vm_address_t resaddr; - int curlen = MIN(32 * 1024 * 1024, len); - - resaddr = mmap(curaddr, curlen, OS_VM_PROT_ALL, flags, -1, 0); - - if (resaddr == (os_vm_address_t) - 1) { - perror("mmap"); - - while (curaddr > addr) { - curaddr -= 32 * 1024 * 1024; - munmap(curaddr, 32 * 1024 * 1024); - } - - return NULL; - } - - curaddr += curlen; - len -= curlen; - } - } else { -#endif addr = mmap(addr, len, OS_VM_PROT_ALL, flags, -1, 0); -#ifdef __NetBSD__ - } -#endif if (addr == MAP_FAILED) { perror("mmap"); @@ -343,7 +314,11 @@ /* NetBSD counts mmap()ed space against the process's data size limit, * so yank it up. This might be a nasty thing to do? */ getrlimit (RLIMIT_DATA, &rl); - rl.rlim_cur = RLIM_INFINITY; + /* Amazingly for such a new port, the provenance and meaning of + this number are unknown. It might just mean REALLY_BIG_LIMIT, + or possibly it should be calculated from dynamic space size. + -- CSR, 2004-04-08 */ + rl.rlim_cur = 1073741824; if (setrlimit (RLIMIT_DATA, &rl) < 0) { fprintf (stderr, "RUNTIME WARNING: unable to raise process data size limit:\n\