summary refs log tree commit diff
path: root/sysdeps/mach
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-12-03 10:00:22 +0000
committerRoland McGrath <roland@gnu.org>1995-12-03 10:00:22 +0000
commit683158e0c42dc68e3c43a32b6e5d832c5280e94e (patch)
treea760f36d0950bcd7be070a6424349341ee179f5a /sysdeps/mach
parent0fe4e552917483253b68ac9800b8bd292bf3a51d (diff)
downloadglibc-683158e0c42dc68e3c43a32b6e5d832c5280e94e.tar.gz
glibc-683158e0c42dc68e3c43a32b6e5d832c5280e94e.tar.xz
glibc-683158e0c42dc68e3c43a32b6e5d832c5280e94e.zip
* sysdeps/mach/hurd/brk.c (DATA_SIZE): Bump to 128MB. cvs/libc-951204 cvs/libc-951203
	(_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.
Diffstat (limited to 'sysdeps/mach')
-rw-r--r--sysdeps/mach/hurd/brk.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/sysdeps/mach/hurd/brk.c b/sysdeps/mach/hurd/brk.c
index a96286b2d9..49b370a0e3 100644
--- a/sysdeps/mach/hurd/brk.c
+++ b/sysdeps/mach/hurd/brk.c
@@ -23,8 +23,8 @@ Cambridge, MA 02139, USA.  */
 #include <cthreads.h>		/* 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)
     {