From 683158e0c42dc68e3c43a32b6e5d832c5280e94e Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sun, 3 Dec 1995 10:00:22 +0000 Subject: * sysdeps/mach/hurd/brk.c (DATA_SIZE): Bump to 128MB. (_hurd_set_brk): Try to allocate more space when we run out. * sysdeps/generic/sbrk.c: If __curbrk is zero, call __brk with zero and examine it again. * sysdeps/unix/sysv/linux/i386/brk.c: New file. * sysdeps/unix/sysv/linux/i386/brk.S: File removed. * sysdeps/unix/sysv/linux/i386/sbrk.S: File removed. * sysdeps/unix/sysv/linux/dl-sysdep.c: New file. --- sysdeps/mach/hurd/brk.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'sysdeps/mach') diff --git a/sysdeps/mach/hurd/brk.c b/sysdeps/mach/hurd/brk.c index a96286b..49b370a 100644 --- a/sysdeps/mach/hurd/brk.c +++ b/sysdeps/mach/hurd/brk.c @@ -23,8 +23,8 @@ Cambridge, MA 02139, USA. */ #include /* For `struct mutex'. */ -/* Initial maximum size of the data segment (32MB, which is arbitrary). */ -#define DATA_SIZE (32 * 1024 * 1024) +/* Initial maximum size of the data segment (this is arbitrary). */ +#define DATA_SIZE (128 * 1024 * 1024) /* Up to the page including this address is allocated from the kernel. @@ -85,13 +85,20 @@ _hurd_set_brk (vm_address_t addr) return -1; } - /* Make the memory accessible. */ - if (err = __vm_protect (__mach_task_self (), pagebrk, pagend - pagebrk, - 0, VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)) + if (pagend > _hurd_data_end) { - errno = err; - return -1; + /* We didn't allocate enough space! Hopefully we can get some more! */ + err = __vm_allocate (__mach_task_self (), &pagebrk, pagend - pagebrk, 0); + if (! err) + _hurd_data_end = pagend; } + else + /* Make the memory accessible. */ + err = __vm_protect (__mach_task_self (), pagebrk, pagend - pagebrk, + 0, VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); + + if (err) + return __hurd_fail (err); _hurd_brk = addr; return 0; @@ -112,7 +119,7 @@ init_brk (void) pagend = round_page (_hurd_brk); - _hurd_data_end = (vm_address_t) &__data_start + DATA_SIZE; + _hurd_data_end = round_page ((vm_address_t) &__data_start + DATA_SIZE); if (pagend < _hurd_data_end) { -- cgit v1.1